Skip to content

chore(deps-dev): update mypy requirement from !=1.20.2,<1.21,>=1.0.0 to >=2.0.0,<2.4 - #1238

Open
dependabot[bot] wants to merge 5 commits into
mainfrom
dependabot/pip/main/mypy-neq-1.20.2-and-gte-2.3.0-and-lt-2.4
Open

chore(deps-dev): update mypy requirement from !=1.20.2,<1.21,>=1.0.0 to >=2.0.0,<2.4#1238
dependabot[bot] wants to merge 5 commits into
mainfrom
dependabot/pip/main/mypy-neq-1.20.2-and-gte-2.3.0-and-lt-2.4

Conversation

@dependabot

@dependabot dependabot Bot commented on behalf of github Jul 17, 2026

Copy link
Copy Markdown
Contributor

Updates the requirements on mypy to permit the latest version.

Changelog

Sourced from mypy's changelog.

Mypy Release Notes

Next Release

Packaging changes

Mypy 2.3

We've just uploaded mypy 2.3.0 to the Python Package Index (PyPI). Mypy is a static type checker for Python. This release includes new features, performance improvements and bug fixes. You can install it as follows:

python3 -m pip install -U mypy

You can read the full documentation for this release on Read the Docs.

The Upcoming Switch to the New Native Parser

We are planning to enable the new native parser (--native-parser) by default soon. We recommend that you test the native parser in your projects and report any issues in the mypy issue tracker.

Mypyc Free-threading Memory Safety

Free-threaded Python builds that don't have the GIL require additional synchronization primitives or lock-free algorithms to ensure memory safety when there are race conditions (for example, when a thread reads a list item while another thread writes the same list item concurrently). This release greatly improves memory safety of free threading.

List operations are now memory-safe on free threaded Python builds, even in the presence of race conditions. This has some performance cost. For list-heavy workloads, using librt.vecs.vec instead of list is often significantly faster, but note that vec is not (and likely won't be) fully memory safe, and the user is expected to avoid race conditions. The newly introduced librt.threading.Lock helps with this. Using variable-length tuples can also be more efficient than lists, since tuples are immutable and don't require expensive synchronization to ensure memory safety.

Instance attribute access is also (mostly) memory safe now on free-threaded builds in the presence of race conditions. We are planning to fix the remaining unsafe cases in a future release.

Full list of changes:

  • Make attribute access memory safe on free-threaded builds (Jukka Lehtosalo, PR 21705)
  • Fix unsafe borrowing of instance attributes with free-threading (Jukka Lehtosalo, PR 21688)
  • Make list get/set item more memory safe on free-threaded builds (Jukka Lehtosalo, PR 21683)
  • Don't borrow list items on free-threaded builds (Jukka Lehtosalo, PR 21679)
  • Make multiple assignment from list memory-safe on free-threaded builds (Jukka Lehtosalo, PR 21684)

... (truncated)

Commits
  • 8aabf84 Drop +dev from version
  • 4d8ad2a Update changelog for 2.3 release (#21728)
  • 2c21546 [mypyc] Update documentation of race conditions under free threading (#21726)
  • a9f62a3 [mypyc] Make attribute access memory safe on free-threaded builds (#21705)
  • 0faa413 Use PYODIDE environment variable for Emscripten cross-compilation detection...
  • 3d75cdb [mypyc] Borrow final attributes more aggressively (#21702)
  • 24c237d [mypyc] Improve documentation of Final (#21713)
  • b5be217 [mypyc] Update free threading Python compatibility docs (#21711)
  • cbcb51a Narrow for frozendict membership check (#21709)
  • af2bc0f Sync typeshed (#21707)
  • Additional commits viewable in compare view

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

@dependabot dependabot Bot added dependencies Pull requests that update a dependency file python Pull requests that update Python code labels Jul 17, 2026
@dependabot
dependabot Bot requested review from behnazh and jenstroeger as code owners July 17, 2026 07:20
@dependabot dependabot Bot added dependencies Pull requests that update a dependency file python Pull requests that update Python code labels Jul 17, 2026
@jenstroeger
jenstroeger force-pushed the dependabot/pip/main/mypy-neq-1.20.2-and-gte-2.3.0-and-lt-2.4 branch 2 times, most recently from f3a51d0 to 2805c1f Compare July 20, 2026 01:28
@jenstroeger

jenstroeger commented Jul 20, 2026

Copy link
Copy Markdown
Owner

@behnazh if we use a SQLite cache for mypy then as of v2.0.0 we get failures like this one (see this failing v2.3.0 run):

Check typing annotations.................................................Failed
- hook id: mypy
- exit code: 2

error: INTERNAL ERROR -- Please try using mypy master on GitHub:
https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 2.3.0
Traceback (most recent call last):
  File "/path/to/python-package-template/.venv/lib/python3.14/site-packages/mypy/__main__.py", line 16, in console_entry
    main()
    ~~~~^^
  File "mypy/main.py", line 154, in main
  File "mypy/main.py", line 244, in run_build
    res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
  File "mypy/build.py", line 385, in build
  File "mypy/build.py", line 1908, in create_metastore
    mds: MetadataStore = SqliteMetadataStore(
  File "mypy/metastore.py", line 200, in __init__
  File "mypy/metastore.py", line 174, in connect_db
    db.execute("PRAGMA journal_mode=WAL")
sqlite3.OperationalError: database is locked

note: use --pdb to drop into pdb
Success: no issues found in 3 source files

This issue has been around since v2.1.0 (run) and v2.2.0 (run),12 but it hasn’t been reported. It seems independent of the new parallel type-checking. I’m not sure what’s going on or whether I should open an issue with mypy — this one seems like an obvious problem that others should also run into?

Anyway, for the time being it seems like disabling the SQLite db (docs, commit 2805c1f, successful run) works; it’s ok to do so because we’re not using the cache anyway due to the incremental = false setting (code).

Footnotes

  1. I think we missed the v2.0.0 run from 6. May which was followed by v2.1.0 on 13. May and our Dependabot interval just didn’t pick it up. Older runs aren’t available anymore, either.

  2. See also issue https://github.com/jenstroeger/python-package-template/pull/1152, which I think had a similar/same problem 🤔

@behnazh

behnazh commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

Anyway, for the time being it seems like disabling the SQLite db (docs, commit 2805c1f, successful run) works

I just tried make check-mypy on this branch, setting no_sqlite_cache to false and it passed:

python --version
Python 3.14.6

@jenstroeger

Copy link
Copy Markdown
Owner

I just tried make check-mypy on this branch, setting no_sqlite_cache to false and it passed:

@behnazh try this:

rm -fr .mypy_cache/
make check-mypy

after removing/commenting out # no_sqlite_cache = true (commit 2805c1f). Or try

make nuke

and start with a completely fresh setup, like it does in CI. I think I forgot to mention that this happens only with a first run when the SQLite db is created.

@behnazh

behnazh commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator
rm -fr .mypy_cache/

Hm, it still passes.

(python-package-template) $ git diff
diff --git a/pyproject.toml b/pyproject.toml
index 87223ad..76d33d4 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -145,7 +145,7 @@ disallow_incomplete_defs = true
 disallow_untyped_decorators = true
 # disable_error_code =
 # allow_redefinition =
-no_sqlite_cache = true
+no_sqlite_cache = false
 
 [[tool.mypy.overrides]]
 module = [
(python-package-template) $ rm -fr .mypy_cache/
(python-package-template) $ make check-mypy
pre-commit run mypy --all-files
Check typing annotations.................................................Passed

@jenstroeger

Copy link
Copy Markdown
Owner

@behnazh interesting because CI for Ubuntu (or are you on your Mac) and Python 3.14 fails (run) 🤔 Does a fresh clone fail when you remove the entire no_sqlite_cache line?

@behnazh

behnazh commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

@behnazh interesting because CI for Ubuntu (or are you on your Mac) and Python 3.14 fails (run) 🤔 Does a fresh clone fail when you remove the entire no_sqlite_cache line?

I'm testing it on a Mac and it passes on a fresh clone.

@jenstroeger

Copy link
Copy Markdown
Owner

CI on Mac with Python 3.14 passes too (run); Python 3.13 does not.

@jenstroeger

Copy link
Copy Markdown
Owner

Opened issue python/mypy#21769.

dependabot Bot and others added 4 commits July 26, 2026 05:19
Updates the requirements on [mypy](https://github.com/python/mypy) to permit the latest version.
- [Changelog](https://github.com/python/mypy/blob/master/CHANGELOG.md)
- [Commits](python/mypy@v1.0.0...v2.3.0)

---
updated-dependencies:
- dependency-name: mypy
  dependency-version: 2.3.0
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
@jenstroeger
jenstroeger force-pushed the dependabot/pip/main/mypy-neq-1.20.2-and-gte-2.3.0-and-lt-2.4 branch from 96aac64 to 2bc6c43 Compare July 26, 2026 12:22
@jenstroeger jenstroeger changed the title chore(deps-dev): update mypy requirement from !=1.20.2,<1.21,>=1.0.0 to !=1.20.2,>=2.3.0,<2.4 chore(deps-dev): update mypy requirement from !=1.20.2,<1.21,>=1.0.0 to >=2.0.0,<2.4 Jul 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file python Pull requests that update Python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants