From dfc61227f710d628ee3110f13c03cdae1a54b517 Mon Sep 17 00:00:00 2001 From: David Brownman Date: Fri, 3 Oct 2025 10:42:43 -0700 Subject: [PATCH 1/2] add httpx to optional deps and only ship tests in sdist --- README.md | 2 ++ pyproject.toml | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b24cbd48c..d0b346854 100644 --- a/README.md +++ b/README.md @@ -313,6 +313,8 @@ The default HTTP client uses `requests` for making synchronous requests but you to explicitly initialize your own http client and pass it to StripeClient or set it as the global default. +If you don't already have a dependency on an async-compatible HTTP library, `pip install stripe[async]` will install one for you (new in `v13.0.1`). + ```python # By default, an explicitly initialized HTTPXClient will raise an exception if you # attempt to call a sync method. If you intend to only use async, this is useful to diff --git a/pyproject.toml b/pyproject.toml index 99f55cb8d..37d4c6b66 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,6 +14,11 @@ dependencies = [ "typing_extensions >= 4.5.0; python_version >= '3.7'", "requests >= 2.20; python_version >= '3.0'", ] + +[project.optional-dependencies] +# `pip install stripe[async]` gets you everything + `httpx`, so our async stuff works out of the box +async = ["httpx"] + classifiers = [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", @@ -45,7 +50,8 @@ requires = ["flit_core >=3.11, <4"] build-backend = "flit_core.buildapi" [tool.flit.sdist] -include = ["tests/", "justfile", "examples/", "CHANGELOG.md", "deps/"] +# see: https://github.com/stripe/stripe-python/issues/1616 +include = ["tests/"] [tool.ruff] # same as our black config From 0b3f99a156da8be3fd2967c90448d2c60760ed9f Mon Sep 17 00:00:00 2001 From: David Brownman Date: Fri, 3 Oct 2025 10:50:17 -0700 Subject: [PATCH 2/2] fix toml ordering --- pyproject.toml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 37d4c6b66..bdc5bfcd0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,18 +7,6 @@ authors = [{ name = "Stripe", email = "support@stripe.com" }] license-files = ["LICENSE"] keywords = ["stripe", "api", "payments"] requires-python = ">=3.7" -dependencies = [ - "typing_extensions <= 4.2.0, > 3.7.2; python_version < '3.7'", - # The best typing support comes from 4.5.0+ but we can support down to - # 3.7.2 without throwing exceptions. - "typing_extensions >= 4.5.0; python_version >= '3.7'", - "requests >= 2.20; python_version >= '3.0'", -] - -[project.optional-dependencies] -# `pip install stripe[async]` gets you everything + `httpx`, so our async stuff works out of the box -async = ["httpx"] - classifiers = [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", @@ -38,6 +26,18 @@ classifiers = [ "Topic :: Software Development :: Libraries :: Python Modules", ] +dependencies = [ + "typing_extensions <= 4.2.0, > 3.7.2; python_version < '3.7'", + # The best typing support comes from 4.5.0+ but we can support down to + # 3.7.2 without throwing exceptions. + "typing_extensions >= 4.5.0; python_version >= '3.7'", + "requests >= 2.20; python_version >= '3.0'", +] + +[project.optional-dependencies] +# `pip install stripe[async]` gets you everything + `httpx`, so our async stuff works out of the box +async = ["httpx"] + [project.urls] homepage = "https://stripe.com/" source = "https://github.com/stripe/stripe-python"