Skip to content

Commit e2c2f78

Browse files
⚠️ Drop support for Python 3.7 & 3.8 (#1764)
* tweak supported pythons, remove shimmed deprecated * fix CI
1 parent 95af790 commit e2c2f78

12 files changed

Lines changed: 23 additions & 99 deletions

.github/workflows/ci.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,16 +87,12 @@ jobs:
8787
python_version:
8888
# The last ~5 versions, once we're on schedule
8989
# https://docs.stripe.com/sdks/versioning?lang=python#stripe-sdk-language-version-support-policy
90-
- "3.7"
91-
- "3.8"
9290
- "3.9"
9391
- "3.10"
9492
- "3.11"
9593
- "3.12"
9694
- "3.13"
9795
- "3.14"
98-
- "pypy-3.7"
99-
- "pypy-3.8"
10096
- "pypy-3.9"
10197
- "pypy-3.10"
10298
- "pypy-3.11"
@@ -117,8 +113,7 @@ jobs:
117113
name: Publish
118114
if: >-
119115
((github.event_name == 'workflow_dispatch') || (github.event_name == 'push')) &&
120-
startsWith(github.ref, 'refs/tags/v') &&
121-
endsWith(github.actor, '-stripe')
116+
startsWith(github.ref, 'refs/tags/v')
122117
needs: [build, test, lint]
123118
runs-on: "ubuntu-24.04"
124119
permissions:

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ python -m pip install .
3232

3333
### Requirements
3434

35-
Per our [Language Version Support Policy](https://docs.stripe.com/sdks/versioning?lang=python#stripe-sdk-language-version-support-policy), we currently support **Python 3.7+**.
35+
Per our [Language Version Support Policy](https://docs.stripe.com/sdks/versioning?lang=python#stripe-sdk-language-version-support-policy), we currently support **Python 3.9+**.
3636

37-
Support for Python 3.7 and 3.8 is deprecated and will be removed in an upcoming major version. Read more and see the full schedule in the docs: https://docs.stripe.com/sdks/versioning?lang=python#stripe-sdk-language-version-support-policy
37+
Read more and see the full schedule in the docs: https://docs.stripe.com/sdks/versioning?lang=python#stripe-sdk-language-version-support-policy
3838

3939
#### Extended Support
4040

flake8_stripe/flake8_stripe.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,12 @@ class TypingImportsChecker:
1010
version = "0.1.0"
1111

1212
# Rules:
13-
# * typing_extensions v4.1.1 is the latest that supports Python 3.6
14-
# so don't depend on anything from a more recent version than that.
15-
#
16-
# If we need something newer, maybe we can provide it for users on
17-
# newer versions with a conditional import, but we'll cross that
18-
# bridge when we come to it.
19-
2013
# If a symbol exists in both `typing` and `typing_extensions`, which
2114
# should you use? Prefer `typing_extensions` if the symbol available there.
2215
# in 4.1.1. In typing_extensions 4.7.0, `typing_extensions` started re-exporting
2316
# EVERYTHING from `typing` but this is not the case in v4.1.1.
17+
18+
# now that we're into modern typing_extensions versions, we should probably prefer that over built-in typing _unless_ all of our `typing `needs are present in all supported Python versions. In that case, we could drop `typing_extensions`. See: https://go/j/DEVSDK-3046
2419
allowed_typing_extensions_imports = [
2520
"Literal",
2621
"NoReturn",
@@ -36,6 +31,7 @@ class TypingImportsChecker:
3631
"Awaitable",
3732
"Never",
3833
"override",
34+
"deprecated",
3935
]
4036

4137
allowed_typing_imports = [

pyproject.toml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ description = "Python bindings for the Stripe API"
66
authors = [{ name = "Stripe", email = "support@stripe.com" }]
77
license-files = ["LICENSE"]
88
keywords = ["stripe", "api", "payments"]
9-
requires-python = ">=3.7"
9+
requires-python = ">=3.9"
1010
classifiers = [
1111
"Development Status :: 5 - Production/Stable",
1212
"Intended Audience :: Developers",
@@ -27,11 +27,9 @@ classifiers = [
2727
]
2828

2929
dependencies = [
30-
"typing_extensions <= 4.2.0, > 3.7.2; python_version < '3.7'",
31-
# The best typing support comes from 4.5.0+ but we can support down to
32-
# 3.7.2 without throwing exceptions.
33-
"typing_extensions >= 4.5.0; python_version >= '3.7'",
34-
"requests >= 2.20; python_version >= '3.0'",
30+
# this is the version where everything started getting re-exported, so it's a convenient backstop
31+
"typing_extensions >= 4.7.0",
32+
"requests >= 2.20",
3533
]
3634

3735
[project.optional-dependencies]

stripe/_api_resource.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
from typing_extensions import Literal, Self
1+
from typing_extensions import Literal, Self, deprecated
22

33
from stripe._error import InvalidRequestError
44
from stripe._stripe_object import StripeObject
55
from stripe._request_options import extract_options_from_dict
66
from stripe._api_mode import ApiMode
77
from stripe._base_address import BaseAddress
88
from stripe._api_requestor import _APIRequestor
9-
from stripe import _util
109
from urllib.parse import quote_plus
1110
from typing import (
1211
Any,
@@ -26,7 +25,7 @@ class APIResource(StripeObject, Generic[T]):
2625
OBJECT_NAME: ClassVar[str]
2726

2827
@classmethod
29-
@_util.deprecated(
28+
@deprecated(
3029
"This method is deprecated and will be removed in a future version of stripe-python. Child classes of APIResource should define their own `retrieve` and use APIResource._request directly."
3130
)
3231
def retrieve(cls, id, **params) -> T:

stripe/_custom_method.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
from typing import Optional
22
from stripe import _util
33
from urllib.parse import quote_plus
4+
from typing_extensions import deprecated
45

56

67
# TODO(major): 1704.
7-
@_util.deprecated(
8+
@deprecated(
89
"the custom_method class decorator will be removed in a future version of stripe-python. Define custom methods directly and use StripeObject._static_request within."
910
)
1011
def custom_method(

stripe/_exchange_rate.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22
# File generated from our OpenAPI spec
33
from stripe._list_object import ListObject
44
from stripe._listable_api_resource import ListableAPIResource
5-
from stripe._util import deprecated
65
from typing import ClassVar, Dict
7-
from typing_extensions import Literal, Unpack, TYPE_CHECKING
6+
from typing_extensions import Literal, Unpack, deprecated, TYPE_CHECKING
87

98
if TYPE_CHECKING:
109
from stripe.params._exchange_rate_list_params import ExchangeRateListParams

stripe/_search_result_object.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# pyright: strict
2-
from typing_extensions import Self, Unpack
2+
from typing_extensions import Self, Unpack, deprecated
33
from typing import (
44
Generic,
55
List,
@@ -16,7 +16,6 @@
1616
_APIRequestor, # pyright: ignore[reportPrivateUsage]
1717
)
1818
from stripe._stripe_object import StripeObject
19-
from stripe import _util
2019
import warnings
2120
from stripe._request_options import RequestOptions, extract_options_from_dict
2221
from stripe._any_iterator import AnyIterator
@@ -45,7 +44,7 @@ def _get_url_for_search(self) -> str:
4544
)
4645
return url
4746

48-
@_util.deprecated(
47+
@deprecated(
4948
"This will be removed in a future version of stripe-python. Please call the `search` method on the corresponding resource directly, instead of the generic search on SearchResultObject."
5049
)
5150
def search(self, **params: Mapping[str, Any]) -> Self:

stripe/_stripe_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222
from stripe._api_version import _ApiVersion
2323
from stripe._stripe_object import StripeObject
2424
from stripe._stripe_response import StripeResponse
25-
from stripe._util import _convert_to_stripe_object, get_api_mode, deprecated # noqa: F401
25+
from stripe._util import _convert_to_stripe_object, get_api_mode
2626
from stripe._webhook import Webhook, WebhookSignature
2727
from stripe._event import Event
2828
from stripe.v2.core._event import EventNotification
2929

3030
from typing import Any, Dict, Optional, Union, cast
31-
from typing_extensions import TYPE_CHECKING
31+
from typing_extensions import TYPE_CHECKING, deprecated
3232

3333
if TYPE_CHECKING:
3434
from stripe._stripe_context import StripeContext

stripe/_stripe_object.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import datetime
33
import json
44
from copy import deepcopy
5-
from typing_extensions import TYPE_CHECKING, Type, Literal, Self
5+
from typing_extensions import TYPE_CHECKING, Type, Literal, Self, deprecated
66
from typing import (
77
Any,
88
Dict,
@@ -402,9 +402,7 @@ def _refresh_from(
402402

403403
self._previous = values
404404

405-
@_util.deprecated(
406-
"This will be removed in a future version of stripe-python."
407-
)
405+
@deprecated("This will be removed in a future version of stripe-python.")
408406
def request(
409407
self,
410408
method: Literal["get", "post", "delete"],

0 commit comments

Comments
 (0)