Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 {6..12}; 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
Expand Down
6 changes: 3 additions & 3 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 1 addition & 6 deletions stripe/_http_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

this is more correct than the inline dict, which the typechecking on 3.13 caught!

if not isinstance(proxy, dict): # pyright: ignore[reportUnnecessaryIsInstance]
raise ValueError(
"Proxy(ies) must be specified as either a string "
Expand Down Expand Up @@ -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"]
Expand Down
Loading