Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add type hints #713

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ help: ## display this help message

quality: ## check coding style with pycodestyle and pylint
pycodestyle
mypy
pylint xblock

validate: test
Expand Down
10 changes: 10 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[mypy]
follow_imports = normal
ignore_missing_imports = False
allow_untyped_globals = False
files =
xblock

# Ignore web_fragments typing until it has hints.
[mypy-web_fragments.*]
ignore_missing_imports = True
4 changes: 2 additions & 2 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ fs==2.4.16
# via -r requirements/base.in
lxml==5.1.0
# via -r requirements/base.in
mako==1.3.0
mako==1.3.2
# via -r requirements/base.in
markupsafe==2.1.4
# via
Expand All @@ -24,7 +24,7 @@ pymongo==3.13.0
# via edx-opaque-keys
python-dateutil==2.8.2
# via -r requirements/base.in
pytz==2023.3.post1
pytz==2023.4
# via -r requirements/base.in
pyyaml==6.0.1
# via -r requirements/base.in
Expand Down
2 changes: 1 addition & 1 deletion requirements/ci.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ packaging==23.2
# via
# pyproject-api
# tox
platformdirs==4.1.0
platformdirs==4.2.0
# via
# tox
# virtualenv
Expand Down
57 changes: 46 additions & 11 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ attrs==23.2.0
# via
# -r requirements/test.txt
# hypothesis
boto3==1.34.29
boto3==1.34.31
# via
# -r requirements/test.txt
# fs-s3fs
botocore==1.34.29
botocore==1.34.31
# via
# -r requirements/test.txt
# boto3
Expand Down Expand Up @@ -56,7 +56,7 @@ click-log==0.4.0
# via
# -r requirements/test.txt
# edx-lint
code-annotations==1.5.0
code-annotations==1.6.0
# via
# -r requirements/test.txt
# edx-lint
Expand Down Expand Up @@ -90,7 +90,15 @@ django==2.2.28
# via
# -c https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt
# -r requirements/test.txt
# django-stubs
# django-stubs-ext
# openedx-django-pyfs
django-stubs==4.2.7
# via -r requirements/test.txt
django-stubs-ext==4.2.7
# via
# -r requirements/test.txt
# django-stubs
edx-lint==5.3.6
# via -r requirements/test.txt
edx-opaque-keys==2.5.1
Expand All @@ -115,7 +123,7 @@ fs-s3fs==1.1.1
# via
# -r requirements/test.txt
# openedx-django-pyfs
hypothesis==6.97.1
hypothesis==6.97.3
# via -r requirements/test.txt
importlib-metadata==7.0.1
# via
Expand Down Expand Up @@ -152,7 +160,9 @@ lazy==1.6
# via -r requirements/test.txt
lxml==5.1.0
# via -r requirements/test.txt
mako==1.3.0
lxml-stubs==0.5.1
# via -r requirements/test.txt
mako==1.3.2
# via -r requirements/test.txt
markupsafe==2.1.4
# via
Expand All @@ -165,6 +175,12 @@ mccabe==0.7.0
# pylint
mock==5.1.0
# via -r requirements/test.txt
mypy==1.8.0
# via -r requirements/test.txt
mypy-extensions==1.0.0
# via
# -r requirements/test.txt
# mypy
openedx-django-pyfs==3.4.1
# via -r requirements/test.txt
packaging==23.2
Expand All @@ -184,7 +200,7 @@ pbr==6.0.0
# stevedore
pip-tools==7.3.0
# via -r requirements/pip-tools.txt
platformdirs==4.1.0
platformdirs==4.2.0
# via
# -r requirements/ci.txt
# -r requirements/test.txt
Expand All @@ -200,11 +216,11 @@ pluggy==1.4.0
# tox
pycodestyle==2.11.1
# via -r requirements/test.txt
pydantic==2.5.3
pydantic==2.6.0
# via
# -r requirements/test.txt
# inflect
pydantic-core==2.14.6
pydantic-core==2.16.1
# via
# -r requirements/test.txt
# pydantic
Expand Down Expand Up @@ -252,17 +268,17 @@ pytest==8.0.0
# pytest-django
pytest-cov==4.1.0
# via -r requirements/test.txt
pytest-django==4.7.0
pytest-django==4.8.0
# via -r requirements/test.txt
python-dateutil==2.8.2
# via
# -r requirements/test.txt
# botocore
python-slugify==8.0.2
python-slugify==8.0.3
# via
# -r requirements/test.txt
# code-annotations
pytz==2023.3.post1
pytz==2023.4
# via
# -r requirements/test.txt
# django
Expand Down Expand Up @@ -307,6 +323,8 @@ tomli==2.0.1
# -r requirements/test.txt
# build
# coverage
# django-stubs
# mypy
# pip-tools
# pylint
# pyproject-api
Expand All @@ -321,13 +339,30 @@ tox==4.12.1
# via
# -r requirements/ci.txt
# -r requirements/test.txt
types-python-dateutil==2.8.19.20240106
# via -r requirements/test.txt
types-pytz==2023.4.0.20240130
# via
# -r requirements/test.txt
# django-stubs
types-pyyaml==6.0.12.12
# via
# -r requirements/test.txt
# django-stubs
types-setuptools==69.0.0.20240125
# via -r requirements/test.txt
types-webob==1.8.0.20240128
# via -r requirements/test.txt
typing-extensions==4.9.0
# via
# -r requirements/test.txt
# annotated-types
# astroid
# django-stubs
# django-stubs-ext
# edx-opaque-keys
# inflect
# mypy
# pydantic
# pydantic-core
# pylint
Expand Down
8 changes: 4 additions & 4 deletions requirements/django.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ appdirs==1.4.4
# via
# -r requirements/base.txt
# fs
boto3==1.34.29
boto3==1.34.31
# via fs-s3fs
botocore==1.34.29
botocore==1.34.31
# via
# boto3
# s3transfer
Expand All @@ -36,7 +36,7 @@ lazy==1.6
# via -r requirements/django.in
lxml==5.1.0
# via -r requirements/base.txt
mako==1.3.0
mako==1.3.2
# via -r requirements/base.txt
markupsafe==2.1.4
# via
Expand All @@ -56,7 +56,7 @@ python-dateutil==2.8.2
# via
# -r requirements/base.txt
# botocore
pytz==2023.3.post1
pytz==2023.4
# via
# -r requirements/base.txt
# django
Expand Down
8 changes: 4 additions & 4 deletions requirements/doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ babel==2.14.0
# sphinx
beautifulsoup4==4.12.3
# via pydata-sphinx-theme
boto3==1.34.29
boto3==1.34.31
# via
# -r requirements/django.txt
# fs-s3fs
botocore==1.34.29
botocore==1.34.31
# via
# -r requirements/django.txt
# boto3
Expand Down Expand Up @@ -68,7 +68,7 @@ lazy==1.6
# via -r requirements/django.txt
lxml==5.1.0
# via -r requirements/django.txt
mako==1.3.0
mako==1.3.2
# via -r requirements/django.txt
markupsafe==2.1.4
# via
Expand Down Expand Up @@ -102,7 +102,7 @@ python-dateutil==2.8.2
# via
# -r requirements/django.txt
# botocore
pytz==2023.3.post1
pytz==2023.4
# via
# -r requirements/django.txt
# babel
Expand Down
8 changes: 8 additions & 0 deletions requirements/test.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,21 @@ astroid
coverage
ddt
diff-cover >= 0.2.1
django-stubs
edx_lint
hypothesis
lxml-stubs
mock
mypy
path
pycodestyle
pylint
pytest
pytest-cov
pytest-django
tox
types-python-dateutil
types-pytz
types-PyYAML
types-setuptools
types-WebOb
Loading
Loading