Skip to content

Commit 4e0f89b

Browse files
Merge pull request #1439 from stripe/latest-codegen-beta
Update generated code for beta
2 parents 46741a7 + be43bda commit 4e0f89b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1139
-216
lines changed

.github/workflows/ci.yml

+45-53
Original file line numberDiff line numberDiff line change
@@ -19,41 +19,47 @@ on:
1919

2020
jobs:
2121
lint:
22-
name: Lint & Mypy
23-
runs-on: ubuntu-latest
22+
name: Static Checks
23+
runs-on: "ubuntu-24.04"
2424
steps:
25+
- uses: extractions/setup-just@v2
2526
- uses: actions/checkout@v3
2627
- name: Set up Python 3
2728
uses: actions/setup-python@v4
2829
with:
2930
python-version: "3.10"
30-
- name: mypy
31-
run: make mypy
32-
- name: lint
33-
run: make lint
34-
- name: fmtcheck
35-
run: make fmtcheck
31+
- name: check examples w/ mypy (against [email protected])
32+
run: just typecheck-examples
33+
# skip deps on all these since mypy installed everything
34+
- name: check linting
35+
run: just --no-deps lint
36+
- name: check formatting
37+
run: just --no-deps format-check
38+
# pyright depends on node, which it handles and installs for itself as needed
39+
# we _could_ run setup-node to make it available for it if we're having reliability problems
40+
- name: check types (all Python versions)
41+
run: |
42+
set -eox
43+
44+
for minor in {6..12}; do
45+
just --no-deps typecheck $minor
46+
done
3647
3748
build:
3849
name: Build
39-
runs-on: ubuntu-latest
50+
runs-on: "ubuntu-24.04"
4051
steps:
52+
- uses: extractions/setup-just@v2
4153
- uses: actions/checkout@v3
4254

4355
- name: Set up Python 3
4456
uses: actions/setup-python@v4
4557
with:
4658
python-version: "3.10"
4759

48-
- name: Install tools
49-
run: make venv
50-
5160
- name: Build and check package
5261
run: |
53-
set -x
54-
source venv/bin/activate
55-
python setup.py clean --all sdist bdist_wheel --universal
56-
python -m twine check dist/*
62+
just build
5763
5864
- name: "Upload Artifact"
5965
uses: actions/upload-artifact@v3
@@ -69,45 +75,30 @@ jobs:
6975
strategy:
7076
fail-fast: false
7177
matrix:
72-
python:
73-
- { version: "3.6" , env: "py36" }
74-
- { version: "3.7" , env: "py37" }
75-
- { version: "3.8" , env: "py38" }
76-
- { version: "3.9" , env: "py39" }
77-
- { version: "3.10" , env: "py310" }
78-
- { version: "3.11" , env: "py311" }
79-
- { version: "3.12" , env: "py312" }
80-
- { version: "pypy-3.7" , env: "py3.7" }
81-
- { version: "pypy-3.8" , env: "py3.8" }
82-
- { version: "pypy-3.9" , env: "py3.9" }
83-
- { version: "pypy-3.10" , env: "py3.10" }
84-
name: Test (${{ matrix.python.version }})
78+
python_version:
79+
- "3.6"
80+
- "3.7"
81+
- "3.8"
82+
- "3.9"
83+
- "3.10"
84+
- "3.11"
85+
- "3.12"
86+
- "pypy-3.7"
87+
- "pypy-3.8"
88+
- "pypy-3.9"
89+
- "pypy-3.10"
90+
name: Test (${{ matrix.python_version }})
8591
steps:
92+
- uses: extractions/setup-just@v2
8693
- uses: actions/checkout@v3
87-
88-
- name: Set up Python ${{ matrix.python.version }} and 3.10
94+
- name: Set up Python ${{ matrix.python_version }}
8995
uses: actions/setup-python@v4
9096
with:
91-
python-version: |
92-
${{ matrix.python.version }}
93-
3.10
94-
97+
python-version: ${{ matrix.python_version }}
9598
- uses: stripe/openapi/actions/stripe-mock@master
9699

97-
- name: Typecheck with pyright
98-
run: PYRIGHT_ARGS="-- --pythonversion ${{ matrix.python.version }}" make pyright
99-
# Skip typecheking in pypy legs
100-
if: ${{ !contains(matrix.python.version, 'pypy') }}
101-
102-
- name: Test with pytest
103-
run: TOX_ARGS="-e ${{ matrix.python.env }}" make ci-test
104-
105-
- name: Calculate and publish coverage
106-
run: make coveralls
107-
if: env.COVERALLS_REPO_TOKEN && matrix.python.version == '3.10'
108-
env:
109-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
110-
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
100+
- name: "run tests"
101+
run: just test
111102

112103
publish:
113104
name: Publish
@@ -116,7 +107,7 @@ jobs:
116107
startsWith(github.ref, 'refs/tags/v') &&
117108
endsWith(github.actor, '-stripe')
118109
needs: [build, test, lint]
119-
runs-on: ubuntu-latest
110+
runs-on: "ubuntu-24.04"
120111
steps:
121112
- uses: actions/checkout@v3
122113
- name: Download all workflow run artifacts
@@ -137,11 +128,12 @@ jobs:
137128
GPG_SIGNING_PRIVKEY: ${{ secrets.GPG_SIGNING_PRIVKEY }}
138129
GPG_SIGNING_PASSPHRASE: ${{ secrets.GPG_SIGNING_PASSPHRASE }}
139130
- name: Install tools
140-
run: make venv
141-
- name: Publish packages to PyPy
131+
run: just install-build-deps
132+
- name: Publish packages to PyPI
133+
# could probably move this into a just recipe too?
142134
run: |
143135
set -ex
144-
source venv/bin/activate
136+
source .venv/bin/activate
145137
export VERSION=$(cat VERSION)
146138
gpg --detach-sign --local-user $GPG_SIGNING_KEYID --pinentry-mode loopback --passphrase $GPG_SIGNING_PASSPHRASE -a dist/stripe-$VERSION.tar.gz
147139
gpg --detach-sign --local-user $GPG_SIGNING_KEYID --pinentry-mode loopback --passphrase $GPG_SIGNING_PASSPHRASE -a dist/stripe-$VERSION-py2.py3-none-any.whl

CONTRIBUTING.md

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
# Contributing
3+
4+
We welcome bug reports, feature requests, and code contributions in a pull request.
5+
6+
For most pull requests, we request that you identify or create an associated issue that has the necessary context. We use these issues to reach agreement on an approach and save the PR author from having to redo work. Fixing typos or documentation issues likely do not need an issue; for any issue that introduces substantial code changes, changes the public interface, or if you aren't sure, please find or [create an issue](https://www.github.com/stripe/stripe-python/issues/new/choose).
7+
8+
## Contributor License Agreement
9+
10+
All contributors must sign the Contributor License Agreement (CLA) before we can accept their contribution. If you have not yet signed the agreement, you will be given an option to do so when you open a pull request. You can then sign by clicking on the badge in the comment from @CLAassistant.
11+
12+
## Generated code
13+
14+
This project has a combination of manually maintained code and code generated from our private code generator. If your contribution involves changes to generated code, please call this out in the issue or pull request as we will likely need to make a change to our code generator before accepting the contribution.
15+
16+
To identify files with purely generated code, look for the comment `File generated from our OpenAPI spec.` at the start of the file. Generated blocks of code within hand-written files will be between comments that say `The beginning of the section generated from our OpenAPI spec` and `The end of the section generated from our OpenAPI spec`.
17+
18+
## Compatibility with supported language and runtime versions
19+
20+
This project supports [many different langauge and runtime versions](README.md#requirements) and we are unable to accept any contribution that does not work on _all_ supported versions. If, after discussing the approach in the associated issue, your change must use an API / feature that isn't available in all supported versions, please call this out explicitly in the issue or pull request so we can help figure out the best way forward.
21+
22+
## Set up your dev environment
23+
24+
Please refer to this project's [README.md](README.md#development) for instructions on how to set up your development environment.
25+

MANIFEST.in

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
include .coveragerc .flake8 CHANGELOG.md LICENSE LONG_DESCRIPTION.rst README.md VERSION pytest.ini tox.ini
1+
# this file specifies what's included in a source distribution (https://packaging.python.org/en/latest/glossary/#term-Source-Distribution-or-sdist)
2+
# see also: https://setuptools.pypa.io/en/latest/userguide/miscellaneous.html
3+
include .flake8 CHANGELOG.md LICENSE LONG_DESCRIPTION.rst README.md VERSION pytest.ini justfile
24
recursive-include tests *.py
35
recursive-include examples *.txt *.py

Makefile

-49
This file was deleted.

OPENAPI_VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v1436
1+
v1454

README.md

+19-15
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
[![pypi](https://img.shields.io/pypi/v/stripe.svg)](https://pypi.python.org/pypi/stripe)
44
[![Build Status](https://github.com/stripe/stripe-python/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/stripe/stripe-python/actions?query=branch%3Amaster)
5-
[![Coverage Status](https://coveralls.io/repos/github/stripe/stripe-python/badge.svg?branch=master)](https://coveralls.io/github/stripe/stripe-python?branch=master)
65

76
The Stripe Python library provides convenient access to the Stripe API from
87
applications written in the Python language. It includes a pre-defined set of
@@ -332,6 +331,8 @@ New features and bug fixes are released on the latest major version of the Strip
332331

333332
## Development
334333

334+
[Contribution guidelines for this project](CONTRIBUTING.md)
335+
335336
The test suite depends on [stripe-mock], so make sure to fetch and run it from a
336337
background terminal ([stripe-mock's README][stripe-mock] also contains
337338
instructions for installing via Homebrew and other methods):
@@ -341,54 +342,57 @@ go install github.com/stripe/stripe-mock@latest
341342
stripe-mock
342343
```
343344
344-
Run the following command to set up the development virtualenv:
345-
346-
```sh
347-
make
348-
```
345+
We use [just](https://github.com/casey/just) for conveniently running development tasks. You can use them directly, or copy the commands out of the `justfile`. To our help docs, run `just`. By default, all commands will use an virtualenv created by your default python version (whatever comes out of `python --version`). We recommend using [mise](https://mise.jdx.dev/lang/python.html) or [pyenv](https://github.com/pyenv/pyenv) to control that version.
349346
350-
Run all tests on all supported Python versions:
347+
Run the following command to set up the development virtualenv:
351348
352349
```sh
353-
make test
350+
just venv
351+
# or: python -m venv venv && venv/bin/python -I -m pip install -e .
354352
```
355353
356-
Run all tests for a specific Python version (modify `-e` according to your Python target):
354+
Run all tests:
357355
358356
```sh
359-
TOX_ARGS="-e py37" make test
357+
just test
358+
# or: venv/bin/pytest
360359
```
361360
362361
Run all tests in a single file:
363362
364363
```sh
365-
TOX_ARGS="-e py37 -- tests/api_resources/abstract/test_updateable_api_resource.py" make test
364+
just test tests/api_resources/abstract/test_updateable_api_resource.py
365+
# or: venv/bin/pytest tests/api_resources/abstract/test_updateable_api_resource.py
366366
```
367367
368368
Run a single test suite:
369369
370370
```sh
371-
TOX_ARGS="-e py37 -- tests/api_resources/abstract/test_updateable_api_resource.py::TestUpdateableAPIResource" make test
371+
just test tests/api_resources/abstract/test_updateable_api_resource.py::TestUpdateableAPIResource
372+
# or: venv/bin/pytest tests/api_resources/abstract/test_updateable_api_resource.py::TestUpdateableAPIResource
372373
```
373374
374375
Run a single test:
375376
376377
```sh
377-
TOX_ARGS="-e py37 -- tests/api_resources/abstract/test_updateable_api_resource.py::TestUpdateableAPIResource::test_save" make test
378+
just test tests/api_resources/abstract/test_updateable_api_resource.py::TestUpdateableAPIResource::test_save
379+
# or: venv/bin/pytest tests/api_resources/abstract/test_updateable_api_resource.py::TestUpdateableAPIResource::test_save
378380
```
379381
380382
Run the linter with:
381383
382384
```sh
383-
make lint
385+
just lint
386+
# or: venv/bin/python -m flake8 --show-source stripe tests setup.py
384387
```
385388
386389
The library uses [Ruff][ruff] for code formatting. Code must be formatted
387390
with Black before PRs are submitted, otherwise CI will fail. Run the formatter
388391
with:
389392
390393
```sh
391-
make fmt
394+
just format
395+
# or: venv/bin/ruff format . --quiet
392396
```
393397
394398
[api-keys]: https://dashboard.stripe.com/account/apikeys

deps/build-requirements.txt

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# packages needed to package & release
2+
3+
twine
4+
setuptools

deps/dev-requirements.txt

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# packages needed to run static analysis (lints, types, etc)
2+
# version requirements: any modern python version (currently 3.10)
3+
4+
# typechecking for all versions
5+
pyright == 1.1.336
6+
# general typechecking
7+
mypy == 1.7.0
8+
# formatting
9+
ruff == 0.4.4
10+
# linting
11+
flake8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# These requirements must be installable on all our supported versions
1+
# packages needed to run unit tests (including extra supported http libraries)
2+
# version requirements: all supported versions (currently 3.6-3.12)
23

34
# This is the last version of httpx compatible with Python 3.6
45
httpx == 0.22.0; python_version == "3.6"
@@ -8,10 +9,7 @@ aiohttp == 3.8.6; python_version <= "3.7"
89
aiohttp == 3.9.4; python_version > "3.7"
910
anyio[trio] == 3.6.2
1011

11-
pytest-cov >= 2.8.1, < 2.11.0
1212
pytest-mock >= 2.0.0
1313
mock >= 4.0; python_version < "3.8"
1414
pytest-xdist >= 1.31.0
1515
pytest >= 6.0.0
16-
coverage >= 4.5.3, < 5
17-
coveralls

0 commit comments

Comments
 (0)