From 1fe7d2192975bec2de6ef1a9a09ec3af04435a07 Mon Sep 17 00:00:00 2001 From: David Brownman Date: Fri, 22 May 2026 14:35:51 -0700 Subject: [PATCH 1/2] bump typecheck range in CI --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4f99a88e5..068233a85 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,7 +46,7 @@ jobs: run: | set -eox - for minor in {6..12}; do + for minor in {9..14}; do just --no-deps typecheck $minor done From 1fd5e5bb78eca7edd7801ae3b719d3c4c6e8a3f6 Mon Sep 17 00:00:00 2001 From: David Brownman Date: Tue, 26 May 2026 17:37:41 -0700 Subject: [PATCH 2/2] fix typechecking --- .github/workflows/ci.yml | 16 +++++++--------- justfile | 6 +++--- stripe/_http_client.py | 7 +------ 3 files changed, 11 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 068233a85..f2d78f82c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,8 +32,8 @@ jobs: - name: Set up Python 3 uses: actions/setup-python@v4 with: - python-version: "3.10" - - name: check examples w/ mypy (against python@3.10) + python-version: "3.13" + - name: check examples w/ mypy (against python@3.13) run: just typecheck-examples # skip deps on all these since mypy installed everything - name: check linting @@ -42,13 +42,11 @@ jobs: run: just --no-deps format-check # pyright depends on node, which it handles and installs for itself as needed # we _could_ run setup-node to make it available for it if we're having reliability problems - - name: check types (all Python versions) - run: | - set -eox - - for minor in {9..14}; do - just --no-deps typecheck $minor - done + - name: check types + # only check against a modern version- unit tests will catch syntax errors on older versions + # this isn't user facing, this is just checking that our code is internally consistent + # e.g. a bug here wouldn't cause user CI to fail since the issue is internal to our codebase + run: just --no-deps typecheck build: name: Build diff --git a/justfile b/justfile index 24ae601b1..330172ff0 100644 --- a/justfile +++ b/justfile @@ -27,10 +27,10 @@ test-one test_name: install-test-deps lint: install-dev-deps python -m flake8 --show-source stripe tests -# verify types. optional argument to test as of a specific minor python version (e.g. `8` to test `python 3.8`); otherwise uses current version -typecheck minor_py_version="": install-test-deps install-dev-deps +# verify types using current python version +typecheck: install-test-deps install-dev-deps # suppress version update warnings - PYRIGHT_PYTHON_IGNORE_WARNINGS=1 pyright {{ if minor_py_version == "" { "" } else { "--pythonversion 3." + minor_py_version } }} + PYRIGHT_PYTHON_IGNORE_WARNINGS=1 pyright # ⭐ format all code format: install-dev-deps diff --git a/stripe/_http_client.py b/stripe/_http_client.py index 4fb246523..b09b4984f 100644 --- a/stripe/_http_client.py +++ b/stripe/_http_client.py @@ -149,7 +149,7 @@ def __init__( self._verify_ssl_certs = verify_ssl_certs if proxy: if isinstance(proxy, str): - proxy = {"http": proxy, "https": proxy} + proxy = HTTPClient._Proxy(http=proxy, https=proxy) if not isinstance(proxy, dict): # pyright: ignore[reportUnnecessaryIsInstance] raise ValueError( "Proxy(ies) must be specified as either a string " @@ -899,11 +899,6 @@ def close(self): pass -class _Proxy(TypedDict): - http: Optional["ParseResult"] - https: Optional["ParseResult"] - - class PycurlClient(HTTPClient): class _ParsedProxy(TypedDict, total=False): http: Optional["ParseResult"]