Skip to content

Commit b7de292

Browse files
committed
Add mypy no-incremental option as a comment
This option avoids using a cache. It is slower but prevents some issues with `mypy` giving different results on different runs (typically complaining about some `type: ignore[issue]` not being used but when removing it complaining about an `issue` again. It is included so it has more visibility to users in the hope that they can spend less time debugging if they hit this `mypy` issue. Signed-off-by: Leandro Lucarella <[email protected]>
1 parent 26be104 commit b7de292

File tree

8 files changed

+44
-0
lines changed

8 files changed

+44
-0
lines changed

RELEASE_NOTES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,6 @@ This release replaces [`darglint`](https://github.com/terrencepreilly/darglint)
8484

8585
The output of `pip freeze` is printed to be able to more easily debug different behaviours between GitHub workflow runs and local runs.
8686

87+
- `mypy`: Add a commented out `no-incremental` option, which makes the run slower but prevents some issues with `mypy` giving different results on different runs.
88+
8789
- See the general new features section.

cookiecutter/{{cookiecutter.github_repo_name}}/pyproject.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,12 @@ testpaths = ["pytests"]
172172
[tool.mypy]
173173
explicit_package_bases = true
174174
namespace_packages = true
175+
# This option disables mypy cache, and it is sometimes useful to enable it if
176+
# you are getting weird intermittent error, or error in the CI but not locally
177+
# (or vice versa). In particular errors saying that type: ignore is not
178+
# used but getting the original ignored error when removing the type: ignore.
179+
# See for example: https://github.com/python/mypy/issues/2960
180+
#no_incremental = true
175181
packages = ["{{cookiecutter.python_package}}"]
176182
strict = true
177183
{%- if cookiecutter.type != "api" %}

pyproject.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,12 @@ disable = [
156156
[tool.mypy]
157157
explicit_package_bases = true
158158
namespace_packages = true
159+
# This option disables mypy cache, and it is sometimes useful to enable it if
160+
# you are getting weird intermittent error, or error in the CI but not locally
161+
# (or vice versa). In particular errors saying that type: ignore is not
162+
# used but getting the original ignored error when removing the type: ignore.
163+
# See for example: https://github.com/python/mypy/issues/2960
164+
#no_incremental = true
159165
packages = ["frequenz.repo.config"]
160166
strict = true
161167

tests_golden/integration/test_cookiecutter_generation/actor/frequenz-actor-test/pyproject.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,12 @@ required_plugins = ["pytest-asyncio", "pytest-mock"]
142142
[tool.mypy]
143143
explicit_package_bases = true
144144
namespace_packages = true
145+
# This option disables mypy cache, and it is sometimes useful to enable it if
146+
# you are getting weird intermittent error, or error in the CI but not locally
147+
# (or vice versa). In particular errors saying that type: ignore is not
148+
# used but getting the original ignored error when removing the type: ignore.
149+
# See for example: https://github.com/python/mypy/issues/2960
150+
#no_incremental = true
145151
packages = ["frequenz.actor.test"]
146152
strict = true
147153

tests_golden/integration/test_cookiecutter_generation/api/frequenz-api-test/pyproject.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,12 @@ testpaths = ["pytests"]
135135
[tool.mypy]
136136
explicit_package_bases = true
137137
namespace_packages = true
138+
# This option disables mypy cache, and it is sometimes useful to enable it if
139+
# you are getting weird intermittent error, or error in the CI but not locally
140+
# (or vice versa). In particular errors saying that type: ignore is not
141+
# used but getting the original ignored error when removing the type: ignore.
142+
# See for example: https://github.com/python/mypy/issues/2960
143+
#no_incremental = true
138144
packages = ["frequenz.api.test"]
139145
strict = true
140146

tests_golden/integration/test_cookiecutter_generation/app/frequenz-app-test/pyproject.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,12 @@ required_plugins = ["pytest-asyncio", "pytest-mock"]
141141
[tool.mypy]
142142
explicit_package_bases = true
143143
namespace_packages = true
144+
# This option disables mypy cache, and it is sometimes useful to enable it if
145+
# you are getting weird intermittent error, or error in the CI but not locally
146+
# (or vice versa). In particular errors saying that type: ignore is not
147+
# used but getting the original ignored error when removing the type: ignore.
148+
# See for example: https://github.com/python/mypy/issues/2960
149+
#no_incremental = true
144150
packages = ["frequenz.app.test"]
145151
strict = true
146152

tests_golden/integration/test_cookiecutter_generation/lib/frequenz-test-python/pyproject.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,12 @@ required_plugins = ["pytest-asyncio", "pytest-mock"]
138138
[tool.mypy]
139139
explicit_package_bases = true
140140
namespace_packages = true
141+
# This option disables mypy cache, and it is sometimes useful to enable it if
142+
# you are getting weird intermittent error, or error in the CI but not locally
143+
# (or vice versa). In particular errors saying that type: ignore is not
144+
# used but getting the original ignored error when removing the type: ignore.
145+
# See for example: https://github.com/python/mypy/issues/2960
146+
#no_incremental = true
141147
packages = ["frequenz.test"]
142148
strict = true
143149

tests_golden/integration/test_cookiecutter_generation/model/frequenz-model-test/pyproject.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,12 @@ required_plugins = ["pytest-asyncio", "pytest-mock"]
142142
[tool.mypy]
143143
explicit_package_bases = true
144144
namespace_packages = true
145+
# This option disables mypy cache, and it is sometimes useful to enable it if
146+
# you are getting weird intermittent error, or error in the CI but not locally
147+
# (or vice versa). In particular errors saying that type: ignore is not
148+
# used but getting the original ignored error when removing the type: ignore.
149+
# See for example: https://github.com/python/mypy/issues/2960
150+
#no_incremental = true
145151
packages = ["frequenz.model.test"]
146152
strict = true
147153

0 commit comments

Comments
 (0)