Skip to content

Commit

Permalink
Add backwards compatibility modules
Browse files Browse the repository at this point in the history
  • Loading branch information
pakrym-stripe committed Dec 7, 2023
1 parent 0c7ad96 commit 3d25e4f
Show file tree
Hide file tree
Showing 9 changed files with 162 additions and 0 deletions.
15 changes: 15 additions & 0 deletions stripe/api_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# -*- coding: utf-8 -*-
from typing_extensions import TYPE_CHECKING
from warnings import warn

warn(
"""
The stripe.api_version package is deprecated and will become internal in the future.
""",
DeprecationWarning,
)

if not TYPE_CHECKING:
from stripe._api_version import ( # noqa
_ApiVersion,
)
20 changes: 20 additions & 0 deletions stripe/app_info.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
from typing_extensions import TYPE_CHECKING
from warnings import warn

warn(
"""
The stripe.app_info package is deprecated, please change your
imports to import from stripe directly.
From:
from stripe.app_info import AppInfo
To:
from stripe import AppInfo
""",
DeprecationWarning,
)

if not TYPE_CHECKING:
from stripe._app_info import ( # noqa
AppInfo,
)
19 changes: 19 additions & 0 deletions stripe/http_client.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
from typing_extensions import TYPE_CHECKING
from warnings import warn

warn(
"""
The stripe.http_client package is deprecated, please change your
imports to import from stripe directly.
From:
from stripe.http_client import HTTPClient
To:
from stripe import HTTPClient
""",
DeprecationWarning,
stacklevel=2,
)

if not TYPE_CHECKING:
from stripe._http_client import * # noqa
15 changes: 15 additions & 0 deletions stripe/multipart_data_generator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# -*- coding: utf-8 -*-
from typing_extensions import TYPE_CHECKING
from warnings import warn

warn(
"""
The stripe.multipart_data_generator package is deprecated and will become internal in the future.
""",
DeprecationWarning,
)

if not TYPE_CHECKING:
from stripe._multipart_data_generator import ( # noqa
MultipartDataGenerator,
)
21 changes: 21 additions & 0 deletions stripe/oauth.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
from typing_extensions import TYPE_CHECKING
from warnings import warn

warn(
"""
The stripe.oauth package is deprecated, please change your
imports to import from stripe directly.
From:
from stripe.oauth import OAuth
To:
from stripe import OAuth
""",
DeprecationWarning,
stacklevel=2,
)

if not TYPE_CHECKING:
from stripe._oauth import ( # noqa
OAuth,
)
15 changes: 15 additions & 0 deletions stripe/request_metrics.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# -*- coding: utf-8 -*-
from typing_extensions import TYPE_CHECKING
from warnings import warn

warn(
"""
The stripe.request_metrics package is deprecated and will become internal in the future.
""",
DeprecationWarning,
)

if not TYPE_CHECKING:
from stripe._request_metrics import ( # noqa
RequestMetrics,
)
19 changes: 19 additions & 0 deletions stripe/util.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
from typing_extensions import TYPE_CHECKING
from warnings import warn

warn(
"""
The stripe.util package is deprecated, please change your
imports to import from stripe directly.
From:
from stripe.util import convert_to_stripe_object
To:
from stripe import convert_to_stripe_object
""",
DeprecationWarning,
stacklevel=2,
)

if not TYPE_CHECKING:
from stripe._util import * # noqa
16 changes: 16 additions & 0 deletions stripe/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
from typing_extensions import TYPE_CHECKING
from warnings import warn

warn(
"""
The stripe.version package is deprecated and will become internal in the future.
Pleasse access the version via stripe.VERSION.
""",
DeprecationWarning,
)

if not TYPE_CHECKING:
from stripe._version import ( # noqa
VERSION,
)
22 changes: 22 additions & 0 deletions stripe/webhook.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
from typing_extensions import TYPE_CHECKING
from warnings import warn

warn(
"""
The stripe.webhook package is deprecated, please change your
imports to import from stripe directly.
From:
from stripe.webhook import Webhook
To:
from stripe import Webhook
""",
DeprecationWarning,
stacklevel=2,
)

if not TYPE_CHECKING:
from stripe._webhook import ( # noqa
Webhook,
WebhookSignature,
)

0 comments on commit 3d25e4f

Please sign in to comment.