From 1ded34c015020005e0ce1f24d04ee2fee47793a6 Mon Sep 17 00:00:00 2001 From: tlento Date: Wed, 14 Feb 2024 16:57:11 -0800 Subject: [PATCH 1/3] Add Python 3.12 support metadata to classifiers The supported Python version list published to PyPi did not include 3.12. Now it does. --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 70a8a86d..fbf6877e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,6 +17,7 @@ classifiers = [ "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", ] From b2d4c1ebbc63a4e2efb0f7f4a635f24209090647 Mon Sep 17 00:00:00 2001 From: tlento Date: Wed, 14 Feb 2024 17:17:43 -0800 Subject: [PATCH 2/3] Allow customization of python version in env helper We have a composite GitHub action for installing Python and Hatch, but it is pegged to Python 3.9 whereas we'd typically want to either test our minimum version (currently 3.8) or a matrix of supported versions. This parameterizes the action so we can pass in the version we would like to test, and updates existing callers accordingly. --- .github/actions/setup-python-env/action.yml | 8 ++++++-- .github/workflows/ci-pre-commit.yaml | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/actions/setup-python-env/action.yml b/.github/actions/setup-python-env/action.yml index eb0cac0b..9564d433 100644 --- a/.github/actions/setup-python-env/action.yml +++ b/.github/actions/setup-python-env/action.yml @@ -1,13 +1,17 @@ name: Setup Python env description: Install Python & Hatch +inputs: + python-version: + description: Python version number to install + required: true runs: using: "composite" steps: - - name: Set up Python 3.9 + - name: Set up Python ${{ inputs.python-version }} uses: actions/setup-python@v4 with: - python-version: "3.9" + python-version: ${{ inputs.python-version }} - name: Install Hatch shell: bash diff --git a/.github/workflows/ci-pre-commit.yaml b/.github/workflows/ci-pre-commit.yaml index bfd95a99..5cc2c325 100644 --- a/.github/workflows/ci-pre-commit.yaml +++ b/.github/workflows/ci-pre-commit.yaml @@ -16,6 +16,8 @@ jobs: steps: - uses: actions/checkout@v3 - uses: ./.github/actions/setup-python-env + with: + python-version: "3.9" # This step is necessary so long as we're allowing Pydantic 1 and Pydantic 2 via shimming - name: Force Pydantic 1 run: hatch run dev-env:pip install "pydantic~=1.10" From a49f043f0cda8741b64638792985a2807fe46986 Mon Sep 17 00:00:00 2001 From: tlento Date: Thu, 15 Feb 2024 11:08:36 -0800 Subject: [PATCH 3/3] Update actions to use a version matrix with the composite setup The composite action for setting up a python env with an interpreter and hatch install now allows parameterized configuration, meaning we can use a python version matrix across all of our actions. This commit moves the pytest action to use the env setup helper, and updates the other actions to run a test matrix against our endpoint versions (currently 3.8 and 3.12) under the assumption that things working on the endpoints will also work in the middle. While we could test all versions, in practice the actions with this smaller test surface wouldn't really benefit from this, and any developer running into problems there should be able to fix and test version-specific problems independently. --- .github/workflows/ci-pre-commit.yaml | 8 ++++++-- .github/workflows/ci-pytest.yaml | 7 ++----- .github/workflows/ci-schema-consistency.yaml | 7 +++++-- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci-pre-commit.yaml b/.github/workflows/ci-pre-commit.yaml index 5cc2c325..21313eb8 100644 --- a/.github/workflows/ci-pre-commit.yaml +++ b/.github/workflows/ci-pre-commit.yaml @@ -12,12 +12,16 @@ on: jobs: pre-commit: name: Run Pre-commit Hooks + strategy: + matrix: + python-version: ["3.8", "3.12"] runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: ./.github/actions/setup-python-env + - name: Setup Python ${{ matrix.python-version }} env + uses: ./.github/actions/setup-python-env with: - python-version: "3.9" + python-version: ${{ matrix.python-version }} # This step is necessary so long as we're allowing Pydantic 1 and Pydantic 2 via shimming - name: Force Pydantic 1 run: hatch run dev-env:pip install "pydantic~=1.10" diff --git a/.github/workflows/ci-pytest.yaml b/.github/workflows/ci-pytest.yaml index 6eb2cd10..658df1b3 100644 --- a/.github/workflows/ci-pytest.yaml +++ b/.github/workflows/ci-pytest.yaml @@ -20,13 +20,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + - name: Set up Python ${{ matrix.python-version }} env + uses: ./.github/actions/setup-python-env with: python-version: ${{ matrix.python-version }} - - name: Install Hatch - shell: bash - run: pip3 install hatch - name: Set pydantic Version ~= ${{ matrix.pydantic-version }} run: hatch run dev-env:pip install "pydantic~=${{ matrix.pydantic-version }}" - name: Run Python Tests diff --git a/.github/workflows/ci-schema-consistency.yaml b/.github/workflows/ci-schema-consistency.yaml index 06eb05e1..52b5931d 100644 --- a/.github/workflows/ci-schema-consistency.yaml +++ b/.github/workflows/ci-schema-consistency.yaml @@ -15,15 +15,18 @@ on: jobs: json-schema-consistency-check: name: Schema Consistency Check + strategy: + matrix: + python-version: ["3.8", "3.12"] runs-on: ubuntu-latest steps: - name: Check-out the repo uses: actions/checkout@v3 - - name: Set up Python 3.9 + - name: Set up Python ${{ matrix.python-version }} env uses: ./.github/actions/setup-python-env with: - python-version: "3.9" + python-version: ${{ matrix.python-version }} - name: Generate JSON Schema run: make json_schema