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

Support multiple target versions #2519

Closed
JonathanPlasse opened this issue Feb 3, 2023 · 7 comments
Closed

Support multiple target versions #2519

JonathanPlasse opened this issue Feb 3, 2023 · 7 comments
Labels
question Asking for support or clarification

Comments

@JonathanPlasse
Copy link
Contributor

JonathanPlasse commented Feb 3, 2023

  • To implement RFE: infer target-version from project metadata #2039 we need to support multiple target versions.
  • We should use the minimum target version for pyupgrade.
  • For isort known standard library, we should check that the module is present for all target version
@JonathanPlasse JonathanPlasse changed the title Support multiple target version Support multiple target versions Feb 3, 2023
@charliermarsh
Copy link
Member

What's the difference in practice between supporting a minimum version, and a range of versions?

@charliermarsh charliermarsh added the question Asking for support or clarification label Feb 3, 2023
@JonathanPlasse
Copy link
Contributor Author

For isort known standard library, you could have some modules that are removed for later versions.
If you use the minimum version, you would have a false negative for the later versions if you use a dropped module.

@charliermarsh
Copy link
Member

I guess I'm not sure what should happen if you specify that your minimum version is 3.7, and you import tomllib.

@JonathanPlasse
Copy link
Contributor Author

It should report this as an error as it is not available in the Python 3.7 standard library.

@stinodego
Copy link
Contributor

stinodego commented Feb 26, 2023

I know that black is actually trying to get rid of target ranges and wants to switch to a single minimum target version.

I don't think supporting target ranges is worthwhile.

This is not true - you can infer a minimum target version from the requires-python specifier. That's how I initially implemented it for black, before I learned more about how their target versions work.

@charliermarsh
Copy link
Member

Yeah I'd like to only support a minimum target version until convinced otherwise (i.e., until that's proven insufficient).

@charliermarsh
Copy link
Member

Closing for now as I'm okay with current behavior (only supporting minimums).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Asking for support or clarification
Projects
None yet
Development

No branches or pull requests

3 participants