KEMBAR78
Move mypy version upper bound to a [compatible-mypy] extra by andersk · Pull Request #979 · typeddjango/django-stubs · GitHub
Skip to content

Conversation

@andersk
Copy link
Contributor

@andersk andersk commented Jun 3, 2022

Due to a bug in mypy 0.940 (#870), we made two changes in #871:

  • pinned mypy==0.931 in requirements.txt (for running our tests);
  • bounded mypy<0.940 in setup.py (for downstream users).

After the mypy bug was quickly fixed upstream in 0.941, our setup.py bound has been repeatedly raised but not removed (#886, #939, #973). The only changes in those commits have been to the precise wording of error messages expected in our tests. Those wording changes don’t impact compatibility for downstream users, so it should be safe to go back to allowing them to upgrade mypy independently.

Since mypy doesn’t yet guarantee backwards compatibility in the plugin API (although in practice it has rarely been an issue), add a django-stubs[compatible-mypy] extra for users who prefer a known-good version of mypy even if it’s a little out of date.

@sobolevn
Copy link
Member

sobolevn commented Jun 3, 2022

Since mypy does not provide any kind of backward-compat, I think it is safe to leave this bound.

🤔

@andersk
Copy link
Contributor Author

andersk commented Jun 3, 2022

They don’t guarantee plugin compatibility at this time, but they are making some effort—for example, python/mypy#11932. Plugin compatibility isn’t what motivated this upper bound in the first place, and doesn’t seem to be a frequent problem in practice.

Meanwhile, for a project that’s interested in using django-stubs, I’d be more comfortable knowing that it won’t unnecessarily hold back other dependencies (as it currently would, since #973 hasn’t been released). I already pin all transitive dependencies with a lock file that I regularly update on my terms, so I can always decide to hold back mypy myself if something doesn’t work.

Would you be more comfortable moving the upper bound to an extra, perhaps django-stubs[compatible-mypy]?

@sobolevn
Copy link
Member

sobolevn commented Jun 3, 2022

Hm, I like the django-stubs[compatible-mypy] idea!
I always miss good extra deps opportunities 😆

@andersk andersk changed the title Remove mypy version upper bound in setup.py Move mypy version upper bound to a [compatible-mypy] extra Jun 3, 2022
@andersk
Copy link
Contributor Author

andersk commented Jun 3, 2022

Cool, updated as such.

Due to a bug in mypy 0.940 (typeddjango#870), we made two changes in typeddjango#871:

• pinned mypy==0.931 in requirements.txt (for running our tests);
• bounded mypy<0.940 in setup.py (for downstream users).

After the mypy bug was quickly fixed upstream in 0.941, our setup.py
bound has been repeatedly raised but not removed (typeddjango#886, typeddjango#939, typeddjango#973).
The only changes in those commits have been to the precise wording of
error messages expected in our tests.  Those wording changes don’t
impact compatibility for downstream users, so it should be safe to go
back to allowing them to upgrade mypy independently.

Since mypy doesn’t yet guarantee backwards compatibility in the plugin
API (although in practice it has rarely been an issue), add a
django-stubs[compatible-mypy] extra for users who prefer a known-good
version of mypy even if it’s a little out of date.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

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

Thank you!

@sobolevn sobolevn merged commit 24a3b22 into typeddjango:master Jun 4, 2022
@andersk andersk deleted the mypy-bound branch June 4, 2022 22:07
@andersk andersk mentioned this pull request Jun 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants