Skip to content
Merged
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
3 changes: 2 additions & 1 deletion docs/source/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ them in reverse chronological order.
## Unreleased

- {pull}`70` drops support for Python 3.9 and adds support for Python 3.14.
- {pull}`73` removes tox in favor of uv + just.
- {pull}`71` switches typing from mypy to ty.
- {pull}`72` updates the pre-commit hooks.
- {pull}`73` removes tox in favor of uv + just.

## 1.8.0 - 2024-12-24

Expand Down
2 changes: 1 addition & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ test-cov:

# Run type checking
typing:
uv run --extra typing --extra test mypy
uv run --extra typing --extra test ty check hooks/ tests/

# Run linting and formatting
lint:
Expand Down
20 changes: 5 additions & 15 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ docs = [
"sphinxext-opengraph",
]
test = ["pytest", "pytest-cookies", "pytest-cov"]
typing = ["mypy"]
typing = ["ty>=0.0.7"]

[project.readme]
file = "README.md"
Expand All @@ -52,21 +52,11 @@ Documentation = "https://cookiecutter-pytask-project.readthedocs.io/en/latest"
Github = "https://github.com/pytask-dev/cookiecutter-pytask-project"
Tracker = "https://github.com/pytask-dev/cookiecutter-pytask-project/issues"

[tool.mypy]
files = ["hooks", "tests"]
exclude = "{{cookiecutter.project_slug}}"
check_untyped_defs = true
disallow_any_generics = true
disallow_incomplete_defs = true
disallow_untyped_defs = true
no_implicit_optional = true
warn_redundant_casts = true
warn_unused_ignores = true
[tool.ty.rules]
unused-ignore-comment = "error"

[[tool.mypy.overrides]]
module = "tests.*"
disallow_untyped_defs = false
ignore_errors = true
[tool.ty.terminal]
error-on-warning = true

[tool.ruff]
fix = true
Expand Down
2 changes: 1 addition & 1 deletion tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"""This module is necessary to configure mypy's behavior for the tests."""
"""Mark tests as a package for type checking."""
8 changes: 4 additions & 4 deletions tests/test_cookie.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,20 +90,20 @@ def test_check_pixi_and_run_all_checks(cookies):
check=True,
)

# Install pre-commit.
# Install prek.
subprocess.run(
("pixi", "global", "install", "pre-commit"),
("pixi", "global", "install", "prek"),
cwd=result.project_path,
check=True,
)
# Check linting, but not on the first try since formatters fix stuff.
subprocess.run(
("pixi", "run", "pre-commit", "run", "--all-files"),
("pixi", "run", "prek", "run", "--all-files"),
cwd=result.project_path,
check=False,
)
subprocess.run(
("pixi", "run", "pre-commit", "run", "--all-files"),
("pixi", "run", "prek", "run", "--all-files"),
cwd=result.project_path,
check=True,
)
Expand Down
24 changes: 7 additions & 17 deletions {{cookiecutter.project_slug}}/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ pytest-cov = "*"
pytest-xdist = "*"

[tool.pixi.feature.typing.tasks]
typing = "mypy"
typing = "ty check src/ tests/"

[tool.pixi.feature.typing.dependencies]
mypy = "*"
ty = ">=0.0.7"

[tool.pixi.feature.dev.tasks]
nb = "jupyter lab --no-browser"
Expand All @@ -87,21 +87,11 @@ docs = { features = ["docs"], solve-group = "default" }
repro = { features = [], solve-group = "default" }
typing = { features = ["typing"], solve-group = "default" }

[tool.mypy]
files = ["src", "tests"]
check_untyped_defs = true
disallow_any_generics = true
disallow_incomplete_defs = true
disallow_untyped_defs = true
no_implicit_optional = true
warn_redundant_casts = true
warn_unused_ignores = true
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "tests.*"
ignore_errors = true
disallow_untyped_defs = false
[tool.ty.rules]
unused-ignore-comment = "error"

[tool.ty.terminal]
error-on-warning = true

[tool.pytask.ini_options]
paths = ["src/{{ cookiecutter.project_slug }}"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# when the project is installed with ``pip install -e .``. Do not put it into version
# control!
try:
from ._version import version as __version__
from ._version import version as __version__ # ty: ignore[unresolved-import]
except ImportError:
__version__ = "unknown"

Expand Down
2 changes: 1 addition & 1 deletion {{cookiecutter.project_slug}}/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"""Is module is necessary to configure mypy's behavior for the tests."""
"""Mark tests as a package for type checking."""