Skip to content

Commit

Permalink
Type checking! (#422)
Browse files Browse the repository at this point in the history
  • Loading branch information
f213 authored Feb 23, 2022
1 parent d6bd84b commit 7916908
Show file tree
Hide file tree
Showing 33 changed files with 341 additions and 179 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ orbs:
jobs:
build:
docker:
- image: cimg/python:3.10
- image: cimg/python:3.9

steps:
- checkout
Expand All @@ -31,7 +31,7 @@ jobs:

coverage:
docker:
- image: cimg/python:3.10
- image: cimg/python:3.9
steps:
- checkout
- attach_workspace:
Expand Down
1 change: 1 addition & 0 deletions {{cookiecutter.project_slug}}/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ dev-deps: deps

lint:
flake8 src
cd src && mypy

test:
cd src && pytest --dead-fixtures
Expand Down
7 changes: 7 additions & 0 deletions {{cookiecutter.project_slug}}/dev-requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,10 @@ flake8-todo
flake8-use-fstring
flake8-variables-names
flake8-walrus


mypy
django-stubs
djangorestframework-stubs
types-freezegun
types-Pillow
179 changes: 147 additions & 32 deletions {{cookiecutter.project_slug}}/dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
#
# This file is autogenerated by pip-compile
# This file is autogenerated by pip-compile with python 3.9
# To update, run:
#
# pip-compile dev-requirements.in
#
appnope==0.1.2
# via ipython
asgiref==3.5.0
# via
# -c requirements.txt
# django
astor==0.8.1
# via flake8-simplify
asttokens==2.0.5
# via stack-data
attrs==21.4.0
# via
# flake8-bugbear
Expand All @@ -16,14 +22,67 @@ attrs==21.4.0
# pytest
backcall==0.2.0
# via ipython
black==22.1.0
# via ipython
certifi==2021.10.8
# via
# -c requirements.txt
# requests
charset-normalizer==2.0.12
# via
# -c requirements.txt
# requests
click==8.0.4
# via black
cognitive-complexity==1.2.0
# via flake8-cognitive-complexity
coreapi==2.3.3
# via
# -c requirements.txt
# djangorestframework-stubs
coreschema==0.0.4
# via
# -c requirements.txt
# coreapi
decorator==5.1.1
# via ipython
django==3.2.12
# via
# -c requirements.txt
# django-stubs
# django-stubs-ext
django-stubs==1.9.0
# via
# -r dev-requirements.in
# djangorestframework-stubs
django-stubs-ext==0.3.1
# via django-stubs
djangorestframework-stubs==1.4.0
# via -r dev-requirements.in
eradicate==2.0.0
# via flake8-eradicate
executing==0.8.2
# via stack-data
faker==8.16.0
# via mixer
flake8==3.9.2
# via
# flake8-absolute-import
# flake8-bugbear
# flake8-commas
# flake8-django
# flake8-eradicate
# flake8-isort
# flake8-multiline-containers
# flake8-mutable
# flake8-pep3101
# flake8-print
# flake8-printf-formatting
# flake8-pytest
# flake8-quotes
# flake8-simplify
# flake8-use-fstring
# flake8-walrus
flake8-absolute-import==1.0.0.1
# via -r dev-requirements.in
flake8-bugbear==21.11.29
Expand Down Expand Up @@ -56,10 +115,10 @@ flake8-print==4.0.0
# via -r dev-requirements.in
flake8-printf-formatting==1.1.2
# via -r dev-requirements.in
flake8-pytest-style==1.6.0
# via -r dev-requirements.in
flake8-pytest==1.3
# via -r dev-requirements.in
flake8-pytest-style==1.6.0
# via -r dev-requirements.in
flake8-quotes==3.3.1
# via -r dev-requirements.in
flake8-simplify==0.18.0
Expand All @@ -72,28 +131,14 @@ flake8-variables-names==0.0.4
# via -r dev-requirements.in
flake8-walrus==1.1.0
# via -r dev-requirements.in
flake8==3.9.2
# via
# flake8-absolute-import
# flake8-bugbear
# flake8-commas
# flake8-django
# flake8-eradicate
# flake8-isort
# flake8-multiline-containers
# flake8-mutable
# flake8-pep3101
# flake8-print
# flake8-printf-formatting
# flake8-pytest
# flake8-quotes
# flake8-simplify
# flake8-use-fstring
# flake8-walrus
freezegun==1.1.0
# via
# -r dev-requirements.in
# pytest-freezegun
idna==3.3
# via
# -c requirements.txt
# requests
importlib-metadata==4.11.1
# via pytest-randomly
iniconfig==1.1.1
Expand All @@ -102,32 +147,59 @@ ipython==8.0.1
# via -r dev-requirements.in
isort==5.10.1
# via flake8-isort
itypes==1.2.0
# via
# -c requirements.txt
# coreapi
jedi==0.18.1
# via
# -r dev-requirements.in
# ipython
jinja2==3.0.3
# via
# -c requirements.txt
# coreschema
markupsafe==2.1.0
# via
# -c requirements.txt
# jinja2
matplotlib-inline==0.1.3
# via ipython
mccabe==0.7.0
mccabe==0.6.1
# via flake8
mixer==7.2.1
# via -r dev-requirements.in
mypy==0.931
# via
# -r dev-requirements.in
# django-stubs
# djangorestframework-stubs
mypy-extensions==0.4.3
# via
# black
# mypy
packaging==21.3
# via
# -c requirements.txt
# pytest
parso==0.8.3
# via jedi
pathspec==0.9.0
# via black
pexpect==4.8.0
# via ipython
pickleshare==0.7.5
# via ipython
platformdirs==2.5.1
# via black
pluggy==1.0.0
# via pytest
prompt-toolkit==3.0.28
# via ipython
ptyprocess==0.7.0
# via pexpect
pure-eval==0.2.2
# via stack-data
py==1.11.0
# via pytest
pycodestyle==2.7.0
Expand All @@ -143,6 +215,14 @@ pyparsing==2.4.7
# via
# -c requirements.txt
# packaging
pytest==7.0.1
# via
# pytest-deadfixtures
# pytest-django
# pytest-env
# pytest-freezegun
# pytest-mock
# pytest-randomly
pytest-deadfixtures==2.2.1
# via -r dev-requirements.in
pytest-django==4.5.2
Expand All @@ -155,35 +235,70 @@ pytest-mock==3.7.0
# via -r dev-requirements.in
pytest-randomly==3.11.0
# via -r dev-requirements.in
pytest==7.0.1
# via
# pytest-deadfixtures
# pytest-django
# pytest-env
# pytest-freezegun
# pytest-mock
# pytest-randomly
python-dateutil==2.8.2
# via
# faker
# freezegun
pytz==2021.3
# via
# -c requirements.txt
# django
requests==2.27.1
# via
# -c requirements.txt
# coreapi
# djangorestframework-stubs
six==1.16.0
# via
# -c requirements.txt
# asttokens
# flake8-print
# python-dateutil
sqlparse==0.4.2
# via
# -c requirements.txt
# django
stack-data==0.2.0
# via ipython
testfixtures==6.18.3
# via flake8-isort
text-unidecode==1.3
# via faker
toml==0.10.2
# via pytest
# via django-stubs
tomli==2.0.1
# via
# black
# mypy
# pytest
traitlets==5.1.1
# via
# ipython
# matplotlib-inline
types-freezegun==1.1.6
# via -r dev-requirements.in
types-pillow==9.0.6
# via -r dev-requirements.in
types-pytz==2021.3.5
# via django-stubs
types-pyyaml==6.0.4
# via django-stubs
typing-extensions==3.10.0.2
# via flake8-pie
# via
# black
# django-stubs
# django-stubs-ext
# djangorestframework-stubs
# flake8-pie
# mypy
uritemplate==3.0.1
# via
# -c requirements.txt
# coreapi
urllib3==1.26.8
# via
# -c requirements.txt
# requests
wcwidth==0.2.5
# via prompt-toolkit
zipp==3.7.0
Expand Down
10 changes: 8 additions & 2 deletions {{cookiecutter.project_slug}}/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile
# This file is autogenerated by pip-compile with python 3.9
# To update, run:
#
# pip-compile requirements.in
Expand All @@ -26,6 +26,8 @@ coreschema==0.0.4
# drf-yasg
cryptography==3.4.8
# via pyjwt
deprecated==1.2.13
# via redis
django==3.2.12
# via
# -r requirements.in
Expand Down Expand Up @@ -76,7 +78,9 @@ jinja2==3.0.3
markupsafe==2.1.0
# via jinja2
packaging==21.3
# via drf-yasg
# via
# drf-yasg
# redis
pillow==9.0.1
# via -r requirements.in
pycparser==2.21
Expand Down Expand Up @@ -117,6 +121,8 @@ urllib3==1.26.8
# sentry-sdk
whitenoise==5.3.0
# via -r requirements.in
wrapt==1.13.3
# via deprecated

# The following packages are considered to be unsafe in a requirements file:
# setuptools
4 changes: 3 additions & 1 deletion {{cookiecutter.project_slug}}/src/a12n/utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
from rest_framework_jwt.settings import api_settings

from users.models import User

def get_jwt(user) -> str:

def get_jwt(user: User) -> str:
"""Make JWT for given user"""
jwt_payload_handler = api_settings.JWT_PAYLOAD_HANDLER
jwt_encode_handler = api_settings.JWT_ENCODE_HANDLER
Expand Down
4 changes: 2 additions & 2 deletions {{cookiecutter.project_slug}}/src/app/admin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
from app.admin.model_admin import ModelAdmin

__all__ = [
admin,
ModelAdmin,
'admin',
'ModelAdmin',
]
Loading

0 comments on commit 7916908

Please sign in to comment.