Skip to content
Open
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
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ repos:
rev: v0.24.4
hooks:
- id: toml-sort-fix
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.20.2
- repo: https://github.com/astral-sh/ty-pre-commit
rev: v0.0.49
hooks:
- id: mypy
- id: ty
args:
- --config-file=pyproject.toml
additional_dependencies:
- pytest
- --group=typechecking
- --isolated
- --no-default-groups
- repo: https://github.com/rbubley/mirrors-prettier
rev: v3.8.3
hooks:
Expand Down
1 change: 1 addition & 0 deletions .prekignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tests/data/

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am using https://github.com/j178/prek in favour of pre-commit locally. I found that running on the top level was running the hooks in tests/data/test_package_generation which was causing bugs.

4 changes: 2 additions & 2 deletions docs/pages/libraries/jupyter-notebooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ more reliably than [black] via [nbQA].
| Name | Short description | 🚦 |
| ---------------- | -------------------------------------------------------------------------------- | :------------------------------------------: |
| `black[jupyter]` | (also `black-jupyter`) [black] with the optional Jupyter extension. | <span class="label label-green">Best</span> |
| [nbQA] | Recommended for all other linters ([ruff], [isort]) and [mypy]. | <span class="label label-green">Best</span> |
| [nbQA] | Recommended for all other linters ([ruff], [isort]) and [ty]. | <span class="label label-green">Best</span> |
| [pre-commit] | Has cell output cleanup hooks (if desired). Also found to work well with [nbQA]. | <span class="label label-green">Best</span> |
| `nbqa black` | [black] via [nbQA]. | <span class="label label-yellow">Good</span> |

Expand All @@ -48,7 +48,7 @@ more reliably than [black] via [nbQA].
[nbQA]: https://nbqa.readthedocs.io/en/latest/index.html
[isort]: https://pycqa.github.io/isort
[ruff]: https://github.com/charliermarsh/ruff
[mypy]: https://mypy.readthedocs.io/en/stable
[ty]: https://docs.astral.sh/ty/
[pre-commit]: https://github.com/kynan/nbstripout
[jupytext]: https://jupytext.readthedocs.io/en/stable/

Expand Down
7 changes: 4 additions & 3 deletions docs/pages/linting.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ for some of these.

### Type checking

| Name | Short description | 🚦 |
| ---------------------------------------------- | ----------------------------------------------------------------------------- | :-----------------------------------------: |
| [mypy](https://mypy.readthedocs.io/en/stable/) | Static type checker, won't fail if no typing but will if typing is incorrect. | <span class="label label-green">Best</span> |
| Name | Short description | 🚦 |
| ---------------------------------------------- | ----------------------------------------------------------------------------- | :------------------------------------------: |
| [ty](https://docs.astral.sh/ty/) | Static type checker, fast and rapidly developing. | <span class="label label-green">Best</span> |
| [mypy](https://mypy.readthedocs.io/en/stable/) | Static type checker, won't fail if no typing but will if typing is incorrect. | <span class="label label-yellow">Good</span> |

### Dependency checking

Expand Down
4 changes: 2 additions & 2 deletions docs/pages/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -403,8 +403,8 @@ The package is set-up to use [pre-commit](https://pre-commit.com/), a framework
There is a `.pre-commit-config.yaml` configuration file which you can take a look at.
With this setup `pre-commit` will run a series of fast linters, checks and formatters on the repository on every commit.

The main tools we recommend are [ruff](https://docs.astral.sh/ruff/), [mypy](https://mypy.readthedocs.io/en/stable/) and [prettier](https://prettier.io/).
These Git hook scripts can installed locally by running
The main tools we recommend are [ruff](https://docs.astral.sh/ruff/), [ty](https://docs.astral.sh/ty/) and [prettier](https://prettier.io/).
These Git hook scripts can be installed locally by running

```sh
pre-commit install
Expand Down
12 changes: 12 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
[dependency-groups]
typechecking = [
"pytest",
"pytest-venv",
]

[tool.pytest.ini_options]
addopts = [
"--color=yes",
Expand Down Expand Up @@ -66,3 +72,9 @@ gh.python = {"3.11" = [
], "3.14" = [
"py314",
]}

[[tool.ty.overrides]]
include = [
"**/src/*/__init__.py",
]
rules.unresolved-import = "ignore"
Comment thread
paddyroddy marked this conversation as resolved.
10 changes: 7 additions & 3 deletions tests/data/test_package_generation/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,14 @@ repos:
rev: v0.24.4
hooks:
- id: toml-sort-fix
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.20.2
- repo: https://github.com/astral-sh/ty-pre-commit
rev: v0.0.49
hooks:
- id: mypy
- id: ty
args:
- --group=typechecking
- --isolated
- --no-default-groups
- repo: https://github.com/rbubley/mirrors-prettier
rev: v3.8.3
hooks:
Expand Down
12 changes: 8 additions & 4 deletions tests/data/test_package_generation/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ requires = [
[dependency-groups]
dev = [
"build",
"mypy",
"pre-commit",
"ruff",
"tox",
"twine",
"ty",
]
docs = [
"mkdocs-include-markdown-plugin",
Expand All @@ -25,6 +25,9 @@ test = [
"pytest",
"pytest-cov",
]
typechecking = [
"pytest",
]

[project]
authors = [
Expand Down Expand Up @@ -67,9 +70,6 @@ paths.source = [
".tox*/*/lib/python*/site-packages",
]

[tool.mypy]
explicit_package_bases = true

[tool.pytest.ini_options]
addopts = [
"--color=yes",
Expand Down Expand Up @@ -148,3 +148,7 @@ gh.python."3.11" = ["py311"]
gh.python."3.12" = ["py312"]
gh.python."3.13" = ["py313"]
gh.python."3.14" = ["py314"]

[tool.ty]
analysis.respect-type-ignore-comments = false
terminal.error-on-warning = true
Comment thread
paddyroddy marked this conversation as resolved.
10 changes: 7 additions & 3 deletions {{cookiecutter.project_slug}}/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,14 @@ repos:
rev: v0.24.4
hooks:
- id: toml-sort-fix
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.20.2
- repo: https://github.com/astral-sh/ty-pre-commit
rev: v0.0.49
hooks:
- id: mypy
- id: ty
args:
- --group=typechecking
- --isolated
- --no-default-groups
- repo: https://github.com/rbubley/mirrors-prettier
rev: v3.8.3
hooks:
Expand Down
12 changes: 8 additions & 4 deletions {{cookiecutter.project_slug}}/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ requires = [
[dependency-groups]
dev = [
"build",
"mypy",
"pre-commit",
"ruff",
"tox",
"twine",
"ty",
]
docs = [
"mkdocs-include-markdown-plugin",
Expand All @@ -25,6 +25,9 @@ test = [
"pytest",
"pytest-cov",
]
typechecking = [
"pytest",
]

[project]
authors = [
Expand Down Expand Up @@ -69,9 +72,6 @@ paths.source = [
".tox*/*/lib/python*/site-packages",
]

[tool.mypy]
explicit_package_bases = true

[tool.pytest.ini_options]
addopts = [
"--color=yes",
Expand Down Expand Up @@ -154,3 +154,7 @@ env.docs = {commands = [
) %}
gh.python."3.{{python_version}}" = ["py3{{python_version}}"]
{%- endfor %}

[tool.ty]
analysis.respect-type-ignore-comments = false
terminal.error-on-warning = true
Comment thread
paddyroddy marked this conversation as resolved.
Loading