-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add MyPy type checking and a GitHub Action to automatically check this.
- Loading branch information
Showing
3 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
name: Run mypy | ||
on: | ||
pull_request: | ||
push: | ||
branches: ["main", "v[0-9]*"] | ||
tags: ["v[0-9]*"] | ||
workflow_dispatch: | ||
jobs: | ||
mypy: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: apt update | ||
run: sudo apt update | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
- name: Install Python dependencies | ||
run: | | ||
python -m pip install --upgrade pip wheel | ||
pip install -r requirements-dev.txt | ||
- name: MyPy | ||
run: mypy . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
[mypy] | ||
plugins = mypy_django_plugin.main | ||
# TODO: Check all code in the future | ||
check_untyped_defs = False | ||
disallow_any_generics = False | ||
disallow_incomplete_defs = False | ||
disallow_subclassing_any = False | ||
disallow_untyped_calls = False | ||
disallow_untyped_defs = False | ||
ignore_missing_imports = True | ||
no_implicit_optional = True | ||
no_implicit_reexport = True | ||
strict = True | ||
warn_return_any = False | ||
# TODO: Remove this exception in the future | ||
disable_error_code = var-annotated | ||
|
||
[mypy.plugins.django-stubs] | ||
django_settings_module = "tests.test_settings.settings_5_0" | ||
|
||
# TODO: Type check tests in the future | ||
[mypy-tests.*] | ||
ignore_errors = True | ||
|
||
[mypy-docs.*] | ||
ignore_errors = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
# Requirements for developing (not just using) the package | ||
|
||
django-stubs | ||
hatch | ||
mypy | ||
pre-commit | ||
requests | ||
tox<4 | ||
types-requests |