Skip to content

Commit

Permalink
Switched to mypy for type checking.
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverandrich committed Mar 4, 2024
1 parent 69f19c1 commit 2d962cd
Show file tree
Hide file tree
Showing 8 changed files with 171 additions and 91 deletions.
8 changes: 5 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@ repos:
hooks:
- id: ruff

- repo: https://github.com/RobertCraigie/pyright-python
rev: v1.1.332
- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v1.7.1"
hooks:
- id: pyright
- id: mypy
additional_dependencies:
- django-stubs==4.2.7

- repo: https://github.com/rtts/djhtml
rev: 3.0.6
Expand Down
119 changes: 106 additions & 13 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 12 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ werkzeug = { version = "^3.0.0", optional = true }
"django-extensions" = ["django-extensions", "werkzeug"]

[tool.poetry.group.dev.dependencies]
django-types = ">=0.17,<0.20"
mkdocs-material = "^9.3.1"
coverage = { extras = ["toml"], version = "^7.3.2" }
pytest = ">=7.4.2,<9.0.0"
pytest-django = "^4.5.2"
pytest-cov = "^4.1.0"
pytest-mock = "^3.12.0"
tox = "^4.11.4"
django-stubs = { extras = ["compatible-mypy"], version = "^4.2.7" }

[build-system]
requires = ["poetry-core"]
Expand All @@ -70,12 +70,17 @@ exclude = '''
)/
'''

# Pyright
[tool.pyright]
pythonVersion = "3.8"
typeCheckingMode = "strict"
venvPath = ".venv"
venv = "."
# mypy
[tool.mypy]
mypy_path = "src/"
python_version = "3.8"
strict = true
namespace_packages = false
warn_unreachable = true

[[tool.mypy.overrides]]
module = "tests.*"
allow_untyped_defs = true

# Ruff
[tool.ruff]
Expand Down
9 changes: 8 additions & 1 deletion src/django_tailwind_cli/management/commands/tailwind.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def add_arguments(self, parser: CommandParser) -> None:
"runserver",
help="Start the Django development server and the Tailwind CLI in watch mode.",
)

runserver_parser.add_argument(
"--ipv6",
"-6",
Expand All @@ -62,6 +63,12 @@ def add_arguments(self, parser: CommandParser) -> None:
dest="no_threading",
help="Tells Django to NOT use threading.",
)
runserver_parser.add_argument(
"--nostatic",
action="store_true",
dest="no_reloader",
help="Tells Django to NOT use the auto-reloader.",
)
runserver_parser.add_argument(
"--noreload",
action="store_true",
Expand Down Expand Up @@ -262,7 +269,7 @@ def runserver(**kwargs: Any) -> None: # pragma: no cover
watch_process.terminate()
debugserver_process.terminate()

def list_templates(self):
def list_templates(self) -> None:
template_files: List[str] = []
app_template_dirs = get_app_template_dirs("templates")
for app_template_dir in app_template_dirs:
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@


@pytest.fixture
def config() -> Config:
def config():
return Config()
Loading

0 comments on commit 2d962cd

Please sign in to comment.