Skip to content

Commit

Permalink
Configure mypy to run with tox
Browse files Browse the repository at this point in the history
  • Loading branch information
mvandenburgh committed Aug 15, 2022
1 parent ccb0f94 commit feb21e5
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 12 deletions.
9 changes: 0 additions & 9 deletions mypy.ini

This file was deleted.

22 changes: 22 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,25 @@ line_length = 100
force_sort_within_sections = true
# Combines "as" imports on the same line
combine_as_imports = true

[tool.mypy]
ignore_missing_imports = true
show_error_codes = true
disable_error_code = ["attr-defined", "var-annotated"]
follow_imports = "skip" # Don't follow imports into other files. This should be removed once all type errors have been resolved.
exclude = [
"^dandiapi/api/admin.py",
"^dandiapi/api/mail.py",
"^dandiapi/api/tests/",
"^dandiapi/api/management/",
"^dandiapi/api/migrations/",
"^dandiapi/api/models/",
"^dandiapi/api/tasks/",
"^dandiapi/api/views/",
]

# Re-enable these when https://github.com/typeddjango/django-stubs/issues/417 is fixed.
# plugins = ["mypy_django_plugin.main", "mypy_drf_plugin.main"]

# [tool.django-stubs]
# django_settings_module = "dandiapi.settings"
7 changes: 4 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[tox]
envlist =
lint,
type,
test,
check-migrations,

Expand All @@ -19,14 +20,14 @@ commands =
flake8 --config=tox.ini {posargs:.}

[testenv:type]
skipsdist = true
skip_install = true
deps =
mypy
django-stubs
djangorestframework-stubs
extras =
dev
commands =
mypy {posargs:.}
mypy {posargs:dandiapi/}

[testenv:format]
skipsdist = true
Expand Down

0 comments on commit feb21e5

Please sign in to comment.