Skip to content

Commit

Permalink
feat: type hinting more code with mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
bradenmacdonald committed Jul 18, 2023
1 parent 3555e28 commit f485794
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 2 deletions.
14 changes: 13 additions & 1 deletion mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,16 @@ follow_imports = silent
ignore_missing_imports = True
allow_untyped_globals = True
exclude = tests
files = openedx/core/djangoapps/content/learning_sequences/,openedx/core/types
plugins =
mypy_django_plugin.main,
mypy_drf_plugin.main
files =
openedx/core/djangoapps/content/learning_sequences/,
openedx/core/djangoapps/content_staging,
openedx/core/djangoapps/content_libraries,
openedx/core/djangoapps/xblock,
openedx/core/types

[mypy.plugins.django-stubs]
# content_staging only works with CMS; others work with either, so we run mypy with CMS settings.
django_settings_module = "cms.envs.test"
5 changes: 5 additions & 0 deletions requirements/constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,8 @@ djangorestframework<3.15.0

# tests failing with greater version. Fix this in separate ticket.
pillow<10.0.0

# The version of django-stubs we can use depends on which Django release we're using
# 1.16.0 works with Django 3.2 through 4.1
django-stubs==1.16.0
djangorestframework-stubs==3.14.0 # Pinned to match django-stubs. Remove this when we can remove the above pin.
2 changes: 2 additions & 0 deletions requirements/edx/development.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

click # Used for perf_tests utilities in modulestore
django-debug-toolbar # A set of panels that display debug information about the current request/response
django-stubs # Typing stubs for Django, so it works with mypy
djangorestframework-stubs # Typing stubs for DRF
mypy # static type checking
pywatchman # More efficient checking for runserver reload trigger events
vulture # Detects possible dead/unused code, used in scripts/find-dead-code.sh
23 changes: 22 additions & 1 deletion requirements/edx/development.txt
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,8 @@ django==3.2.20
# django-splash
# django-statici18n
# django-storages
# django-stubs
# django-stubs-ext
# django-user-tasks
# djangorestframework
# drf-jwt
Expand Down Expand Up @@ -576,6 +578,13 @@ django-storages==1.9.1
# -r requirements/edx/doc.txt
# -r requirements/edx/testing.txt
# edxval
django-stubs==1.16.0
# via
# -c requirements/edx/../constraints.txt
# -r requirements/edx/development.in
# djangorestframework-stubs
django-stubs-ext==4.2.2
# via django-stubs
django-user-tasks==3.0.0
# via
# -r requirements/edx/doc.txt
Expand Down Expand Up @@ -618,6 +627,10 @@ djangorestframework==3.14.0
# openedx-blockstore
# ora2
# super-csv
djangorestframework-stubs==3.14.0
# via
# -c requirements/edx/../constraints.txt
# -r requirements/edx/development.in
djangorestframework-xml==2.0.0
# via
# -r requirements/edx/doc.txt
Expand Down Expand Up @@ -1226,7 +1239,10 @@ multidict==6.0.4
# aiohttp
# yarl
mypy==1.4.1
# via -r requirements/edx/development.in
# via
# -r requirements/edx/development.in
# django-stubs
# djangorestframework-stubs
mypy-extensions==1.0.0
# via mypy
mysqlclient==2.2.0
Expand Down Expand Up @@ -1721,6 +1737,7 @@ requests==2.31.0
# analytics-python
# coreapi
# django-oauth-toolkit
# djangorestframework-stubs
# edx-bulk-grades
# edx-drf-extensions
# edx-enterprise
Expand Down Expand Up @@ -2012,6 +2029,7 @@ tomli==2.0.1
# -r requirements/edx/testing.txt
# build
# coverage
# django-stubs
# import-linter
# mypy
# pip-tools
Expand Down Expand Up @@ -2043,6 +2061,9 @@ typing-extensions==4.7.1
# asgiref
# astroid
# django-countries
# django-stubs
# django-stubs-ext
# djangorestframework-stubs
# faker
# fastapi
# grimp
Expand Down

0 comments on commit f485794

Please sign in to comment.