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

generate StrEnum for python 3.11+ #4090

Closed
wants to merge 4 commits into from

Conversation

jochs
Copy link
Contributor

@jochs jochs commented Jul 22, 2024

(str, Enum) mixins have undergone a breaking change in python 3.11 - see python/cpython#100458

This PR adds poetry core to the dependencies to allow for version constraint parsing, and lists an explicit set of python minor versions to allow.

The target version is the lowest version that satisfies the constraint.

Also I don't have a good way to generate the lockfiles with poetry 1.7, so if somebody could regenerate them for me that'd be appreciated

@jochs jochs requested a review from dsinghvi as a code owner July 22, 2024 02:21
name=self._get_class_name(),
extends=[
# If using python 3.11+, generate classes with StrEnum instead of (str, Enum)
if sys.version_info >= (3, 11):
Copy link
Member

Choose a reason for hiding this comment

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

@jochs I think we'll want to discriminate based on this config

Copy link
Contributor Author

Choose a reason for hiding this comment

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

why? that already sets up the pyproject.toml -- does that not determine the env that the generator runs in? Happy to plumb it but it doesn't quite feel right to me since that config is a version string for a solver, not true version info

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ugh I see that's just for the generated project... will this even work if the generator is running via 3.9? I'm not sure how the reference imports work (if it's just straight up string concat or not) but StrEnum isn't in the stdlib until 3.11 so if it relies on the presence of the thing we're kinda SOL

@jochs jochs force-pushed the jow/python-3.11-enum-compat branch from 8982460 to 8905822 Compare July 23, 2024 13:53
@jochs jochs requested a review from armandobelardo as a code owner July 23, 2024 14:21
@jochs jochs force-pushed the jow/python-3.11-enum-compat branch from ebb3f1d to 5a6bfc6 Compare July 23, 2024 14:23
@jochs jochs force-pushed the jow/python-3.11-enum-compat branch from 5a6bfc6 to 6b40950 Compare July 23, 2024 14:24
@jochs jochs force-pushed the jow/python-3.11-enum-compat branch from 94b1877 to 005bf26 Compare July 23, 2024 14:27
@dsinghvi dsinghvi force-pushed the main branch 11 times, most recently from 4eb9f86 to 9180bd7 Compare August 19, 2024 02:16
@dsinghvi dsinghvi closed this Sep 8, 2024
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