8000 Feature request: Enum Constants · Issue #689 · stripe/stripe-python · GitHub
[go: up one dir, main page]

Skip to content

Feature request: Enum Constants #689

New issue

Have a question about this project? Sign up for a free Gi 8000 tHub 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

Closed
richardm-stripe opened this issue Oct 30, 2020 · 3 comments
Closed

Feature request: Enum Constants #689

richardm-stripe opened this issue Oct 30, 2020 · 3 comments
Labels

Comments

@richardm-stripe
Copy link
Contributor
richardm-stripe commented Oct 30, 2020

It may be useful to provide constant definitions for the enum values in the API, as we do for stripe-php. See #688 for an example of what this might look like.

There are some downsides to this. In particular this would result in more breaking changes to stripe-python whenever an enum's values changed/were renamed. If we generated the enum values, stripe-python would only ever include the latest enum values for a particular field in the API (even though the API does support old enum values), and I worry this would discourage users from upgrading.

Adding the enums also represents a perpetual increase in the work required to maintain the library and keep it up
to date, and this trades off against us being able to make other improvements to the library.

It also seems that this would be less useful in a world where we shipped MyPy types, which is something that we are considering.

In any case, we aren't planning on adding this for the time being, but we'll keep the github issue open as a place for users to share their thoughts (and thumbs).

@jleclanche
Copy link
Contributor

I would very much like to see you have something like this: https://github.com/dj-stripe/dj-stripe/blob/master/djstripe/enums.py

Uh oh!

There was an error while loading. Please reload this page.

@richardm-stripe
Copy link
Contributor Author

Hello, I am closing this issue as "not planned". As of v7.1.0 last October, we have type annotations that include enums. This isn't quite the same thing as enum constants -- but it provides a lot of the benefit, i.e. IDE autocomplete, preventing you from typo-ing the enum value, letting you see the available options. The names for enum constants can get quite unwieldy especially when they inside some deeply nested property.

We are pretty confident in this decision, but feel free to continue discussing and detailing your use cases if you believe this is a mistake.

@richardm-stripe richardm-stripe closed this as not planned Won't fix, can't repro, duplicate, stale Jan 25, 2024
@jleclanche
Copy link
Contributor

Thank you @richardm-stripe, I think it's a good alternative.

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

No branches or pull requests

2 participants
0