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

Provide an easy way to opt out of changes to default options #17989

Open
JukkaL opened this issue Oct 18, 2024 · 2 comments
Open

Provide an easy way to opt out of changes to default options #17989

JukkaL opened this issue Oct 18, 2024 · 2 comments
Labels
feature topic-configuration Configuration files and flags

Comments

@JukkaL
Copy link
Collaborator

JukkaL commented Oct 18, 2024

We are planning to change the defaults of some options in mypy 2.0, and it's likely that we'll have more such changes in mypy 3.0 and so on. Some of these require work from many users, for example if we enable a check by default that generates lots of errors (even if they are mostly correct).

Here are some things we might want to change the future:

  • Enable various optional error codes by default
  • Check bodies of untyped defs by default
  • Enable flags that improve conformance to standards but that break backward compatibility
  • Changes to checks enabled by --strict

I think we could provide a way to freeze options to the current level, so that users wouldn't need to touch their config files (or fix issues) on each major feature release. For example, --defaults=1.x could tell mypy to use the defaults mypy versions 1.x use. This could also be set in the config file.

This would make it easier for us to make changes to defaults, and easier for users to adopt these changes at their own pace, while still getting access to new Python versions and new mypy features.

@JukkaL JukkaL added the feature label Oct 18, 2024
@TeamSpen210
Copy link
Contributor

Maybe this could be described as a minimum mypy version, intended to be set in the config file. mypy would refuse to run if it's older than the specified version, or if mypy dropped support for that version of defaults later on.

@JukkaL
Copy link
Collaborator Author

JukkaL commented Oct 18, 2024

Maybe this could be described as a minimum mypy version

This wouldn't properly address this use case. The feature proposed here would be used to preserve compatibility across major feature releases only, and literally the only possible values would likely be 1.x, 2.x and so on (not e.g. 2.4). And backward compatible changes are possible within minor feature releases (e.g. stub changes), as long as the impact is small enough.

But we could refuse to target the defaults of an old version if we drop support for certain defaults. Usually the goal would be to support the legacy flags indefinitely, or at least over several major releases.

@cdce8p cdce8p added the topic-configuration Configuration files and flags label Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature topic-configuration Configuration files and flags
Projects
None yet
Development

No branches or pull requests

3 participants