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

Move resource type exports to stripe.___ #1142

Merged

Conversation

pakrym-stripe
Copy link
Contributor

@pakrym-stripe pakrym-stripe commented Nov 17, 2023

Deprecated modules are highlighted in pycharm and cause type errors in MyPy and Pyright, the warning is logged when importing deprecated module.
image
image

> python -c "import stripe.api_resources.card"
<string>:1: DeprecationWarning:
    The stripe.api_resources package is deprecated, please change your
    imports to import from stripe directly.
    From:
      from stripe.api_resources import ...
    To:
      from stripe import ...

Changelog

  • stripe.error, stripe.stripe_object, stripe.api_requestor, stripe.stripe_response, stripe.request_options, stripe.api_resources.*, stripe.api_resources.abstract.* modules are deprecated. All types are available directly from stripe module now.
    Before:
    from stripe.error import APIError
    # or
    stripe.error.APIError
    After:
    from stripe import APIError
    # or
    stripe.APIError

@pakrym-stripe pakrym-stripe force-pushed the pakrym/Move_resource_type_exports_to_stripe.___ branch 11 times, most recently from 222c0a2 to 6d0c5a0 Compare November 21, 2023 18:22
Copy link
Contributor

@richardm-stripe richardm-stripe left a comment

Choose a reason for hiding this comment

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

Did the best I could spot-checking this and left some small questions. The approach in general looks good, and the import tests and the fact that the existing test suite passes gives me a lot of confidence.

stripe/api_resources/abstract/__init__.py Outdated Show resolved Hide resolved
flake8_stripe/flake8_stripe.py Show resolved Hide resolved
flake8_stripe/flake8_stripe.py Outdated Show resolved Hide resolved
stripe/__init__.py Outdated Show resolved Hide resolved
@pakrym-stripe pakrym-stripe marked this pull request as ready for review November 21, 2023 20:59
stripe/__init__.py Outdated Show resolved Hide resolved
Copy link
Contributor

@anniel-stripe anniel-stripe left a comment

Choose a reason for hiding this comment

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

Aside from the nits and bringing back recipient_transfer.py, this looks great to me! Love the deprecation warnings / tests / linter rules. And thanks for breaking it up into easy-to-review commits ❤️

@pakrym-stripe pakrym-stripe force-pushed the pakrym/Move_resource_type_exports_to_stripe.___ branch from cf8c295 to f1f0ab0 Compare December 5, 2023 16:25
@pakrym-stripe pakrym-stripe force-pushed the pakrym/Move_resource_type_exports_to_stripe.___ branch from f1f0ab0 to 59f7176 Compare December 5, 2023 17:12
@pakrym-stripe pakrym-stripe merged commit b243286 into master Dec 5, 2023
15 checks passed
Comment on lines +149 to +157
def __getattr__(name):
if name == "abstract":
import stripe.api_resources.abstract as _abstract

return _abstract
if name == "api_resources":
import stripe.api_resources as _api_resources

return _api_resources
Copy link
Contributor

Choose a reason for hiding this comment

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

@xavdid-stripe xavdid-stripe deleted the pakrym/Move_resource_type_exports_to_stripe.___ branch May 10, 2024 03:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants