Skip to content

Commit 6bd8a21

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 ae57c49 commit 6bd8a21

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
@@ -34,6 +34,8 @@
3434

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

37+
- `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.
38+
3739
- See the general new features section.
3840

3941
## Bug Fixes

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

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

pyproject.toml

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

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
@@ -146,6 +146,12 @@ required_plugins = ["pytest-asyncio", "pytest-mock"]
146146
[tool.mypy]
147147
explicit_package_bases = true
148148
namespace_packages = true
149+
# This option disables mypy cache, and it is sometimes useful to enable it if
150+
# you are getting weird intermittent error, or error in the CI but not locally
151+
# (or vice versa). In particular errors saying that type: ignore is not
152+
# used but getting the original ignored error when removing the type: ignore.
153+
# See for example: https://github.com/python/mypy/issues/2960
154+
#no_incremental = true
149155
packages = ["frequenz.actor.test"]
150156
strict = true
151157

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
@@ -139,6 +139,12 @@ testpaths = ["pytests"]
139139
[tool.mypy]
140140
explicit_package_bases = true
141141
namespace_packages = true
142+
# This option disables mypy cache, and it is sometimes useful to enable it if
143+
# you are getting weird intermittent error, or error in the CI but not locally
144+
# (or vice versa). In particular errors saying that type: ignore is not
145+
# used but getting the original ignored error when removing the type: ignore.
146+
# See for example: https://github.com/python/mypy/issues/2960
147+
#no_incremental = true
142148
packages = ["frequenz.api.test"]
143149
strict = true
144150

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
@@ -145,6 +145,12 @@ required_plugins = ["pytest-asyncio", "pytest-mock"]
145145
[tool.mypy]
146146
explicit_package_bases = true
147147
namespace_packages = true
148+
# This option disables mypy cache, and it is sometimes useful to enable it if
149+
# you are getting weird intermittent error, or error in the CI but not locally
150+
# (or vice versa). In particular errors saying that type: ignore is not
151+
# used but getting the original ignored error when removing the type: ignore.
152+
# See for example: https://github.com/python/mypy/issues/2960
153+
#no_incremental = true
148154
packages = ["frequenz.app.test"]
149155
strict = true
150156

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
@@ -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.test"]
146152
strict = true
147153

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
@@ -146,6 +146,12 @@ required_plugins = ["pytest-asyncio", "pytest-mock"]
146146
[tool.mypy]
147147
explicit_package_bases = true
148148
namespace_packages = true
149+
# This option disables mypy cache, and it is sometimes useful to enable it if
150+
# you are getting weird intermittent error, or error in the CI but not locally
151+
# (or vice versa). In particular errors saying that type: ignore is not
152+
# used but getting the original ignored error when removing the type: ignore.
153+
# See for example: https://github.com/python/mypy/issues/2960
154+
#no_incremental = true
149155
packages = ["frequenz.model.test"]
150156
strict = true
151157

0 commit comments

Comments
 (0)