Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatible with mypy 1.12.0 due to "compatible-mypy": ["mypy~=1.11.0"] #2404

Closed
ssbarnea opened this issue Oct 14, 2024 · 4 comments · Fixed by #2408
Closed

Incompatible with mypy 1.12.0 due to "compatible-mypy": ["mypy~=1.11.0"] #2404

ssbarnea opened this issue Oct 14, 2024 · 4 comments · Fixed by #2408
Labels
bug Something isn't working

Comments

@ssbarnea
Copy link

ssbarnea commented Oct 14, 2024

Bug report

It seems that the compatible-mypy is preventing users from using mypy 1.12.0, causing either installations failures or conflicts.

How is that should be

Update it to allow newer version of mypy once it is updated, ideally it should be a range, or just >=.

This problem is also enhanced for mypy users of pre-commit, which would have a configuration like:

  - repo: https://github.com/pre-commit/mirrors-mypy.git
    rev: v1.11.2
    hooks:
      - id: mypy
        additional_dependencies:
          - django-stubs[compatible-mypy]

The mypy release version is updated automatically with new pull-requests, but as you can see the compatible-mypy extra would cause the hook to fail to install with newer versions.

@ssbarnea ssbarnea added the bug Something isn't working label Oct 14, 2024
@sobolevn
Copy link
Member

We don't know yet if mypy@1.12.0 is compatible or not. We haven't test this yet. This is why we are restrictive.

@ssbarnea
Copy link
Author

I see use for such an extra, but while this protects django-stubs own CI, it does not work well for consumers that might want to not be forced to use outdated mypy. The fact that it was not tested with, does not mean it works, but for anyone using that extra, it will work like a time-bomb. They will not be able to install with newer versions, even if compatible.

This can probably be addressed if a minimum required version of mypy is specified somewhere, maybe in another extra.

On many python projects we use a lock which is basically a constraints file. That states what we used for testing and we make use of it on CI but without forcing users to install the same requirements.

Now, I do realize that 1.12 is only 3h old, so pretty hot. Is just that dependabot attempted to bump it very fast this time. Still, the issue is real. Once a new mypy version is released, you cannot install this library with its mypy extra and it will require a new release if proved compatible.

Mypy made 6 'minor' releases in 2023 and 4 in 2024, with current logic any of this would require a new release on django-stubs :p

@sobolevn
Copy link
Member

Here's the new crash for new mypy: #2405

@sobolevn
Copy link
Member

They will not be able to install with newer versions, even if compatible.

This is a valid point. Thanks!

I think that there are two major points here:

  1. People using compatible-mypy are probably expecting mypy to be compatible, so we are extra safe here
  2. People can use manual django-stubs + mypy versions

What we can do better?

  1. Add mypy-latest to the CI (we already have django-stubs in mypy-primer)
  2. Document this better

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging a pull request may close this issue.

2 participants