From 6fb4108c88d83d7eee7a519565eadb70a0be8878 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Ram=C3=ADrez-Mondrag=C3=B3n?= Date: Wed, 16 Oct 2024 23:30:47 -0600 Subject: [PATCH] Use default latest Python for extra sessions --- .github/workflows/test.yml | 22 ++++++++++++---------- noxfile.py | 17 ++++++++--------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 29432a002..07bd1ffb3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -37,11 +37,10 @@ env: jobs: tests: - name: "Test on ${{ matrix.python-version }} (${{ matrix.session }}) / ${{ matrix.os }} / SQLAlchemy: ${{ matrix.sqlalchemy }}" + name: "Test on ${{ matrix.python-version || '3.x' }} (${{ matrix.session }}) / ${{ matrix.os }} / SQLAlchemy: ${{ matrix.sqlalchemy }}" runs-on: ${{ matrix.os }} continue-on-error: true env: - NOXPYTHON: ${{ matrix.python-version }} NOXSESSION: ${{ matrix.session }} strategy: fail-fast: false @@ -57,10 +56,10 @@ jobs: - "3.13" sqlalchemy: ["2"] include: - - { session: tests, python-version: "3.13", os: "ubuntu-latest", sqlalchemy: "1" } - - { session: doctest, python-version: "3.13", os: "ubuntu-latest", sqlalchemy: "2" } - - { session: mypy, python-version: "3.12", os: "ubuntu-latest", sqlalchemy: "2" } - - { session: deps, python-version: "3.12", os: "ubuntu-latest", sqlalchemy: "2" } + - { session: tests, os: "ubuntu-latest", sqlalchemy: "1" } + - { session: doctest, os: "ubuntu-latest", sqlalchemy: "2" } + - { session: mypy, os: "ubuntu-latest", sqlalchemy: "2" } + - { session: deps, os: "ubuntu-latest", sqlalchemy: "2" } steps: - uses: actions/checkout@v4 @@ -68,8 +67,9 @@ jobs: fetch-depth: 0 - uses: actions/setup-python@v5 + id: setup-python with: - python-version: ${{ matrix.python-version }} + python-version: ${{ matrix.python-version || '3.x' }} allow-prereleases: true - name: Upgrade pip @@ -94,6 +94,7 @@ jobs: - name: Run Nox env: + NOXFORCEPYTHON: ${{ steps.setup-python.outputs.python-version }} SQLALCHEMY_VERSION: ${{ matrix.sqlalchemy }} PIP_PRE: "1" UV_PRERELEASE: allow @@ -112,7 +113,6 @@ jobs: runs-on: ubuntu-latest if: ${{ !github.event.pull_request.head.repo.fork }} env: - NOXPYTHON: "3.12" NOXSESSION: tests SAMPLE_TAP_GITLAB_AUTH_TOKEN: ${{ secrets.SAMPLE_TAP_GITLAB_AUTH_TOKEN }} SAMPLE_TAP_GITLAB_GROUP_IDS: ${{ secrets.SAMPLE_TAP_GITLAB_GROUP_IDS }} @@ -125,8 +125,9 @@ jobs: fetch-depth: 0 - uses: actions/setup-python@v5 + id: setup-python with: - python-version: ${{ env.NOXPYTHON }} + python-version: 3.x - name: Upgrade pip env: @@ -144,6 +145,7 @@ jobs: - name: Run Nox env: + NOXPYTHON: ${{ steps.setup-python.outputs.python-version }} PIP_PRE: "1" UV_PRERELEASE: allow run: | @@ -159,7 +161,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: - python-version: '3.x' + python-version: 3.x - name: Upgrade pip env: diff --git a/noxfile.py b/noxfile.py index 3a94fe9fa..99f87c9eb 100644 --- a/noxfile.py +++ b/noxfile.py @@ -32,7 +32,6 @@ "3.9", "3.8", ] -main_python_version = "3.12" locations = "singer_sdk", "tests", "noxfile.py", "docs/conf.py" nox.options.sessions = ( "mypy", @@ -47,7 +46,7 @@ typing_dependencies = poetry_config["group"]["typing"]["dependencies"].keys() -@nox.session(python=main_python_version) +@nox.session() def mypy(session: nox.Session) -> None: """Check types with mypy.""" args = session.posargs or ["singer_sdk"] @@ -98,7 +97,7 @@ def tests(session: nox.Session) -> None: session.notify("coverage", posargs=[]) -@nox.session(python=main_python_version) +@nox.session() def benches(session: nox.Session) -> None: """Run benchmarks.""" session.install(".[jwt,s3]") @@ -114,7 +113,7 @@ def benches(session: nox.Session) -> None: ) -@nox.session(name="deps", python=main_python_version) +@nox.session(name="deps") def dependencies(session: nox.Session) -> None: """Check issues with dependencies.""" session.install(".[s3,testing]") @@ -122,7 +121,7 @@ def dependencies(session: nox.Session) -> None: session.run("deptry", "singer_sdk", *session.posargs) -@nox.session(python=main_python_version) +@nox.session() def update_snapshots(session: nox.Session) -> None: """Update pytest snapshots.""" args = session.posargs or ["-m", "snapshot"] @@ -147,7 +146,7 @@ def doctest(session: nox.Session) -> None: session.run("pytest", "--xdoctest", *args) -@nox.session(python=main_python_version) +@nox.session() def coverage(session: nox.Session) -> None: """Generate coverage report.""" args = session.posargs or ["report", "-m"] @@ -160,7 +159,7 @@ def coverage(session: nox.Session) -> None: session.run("coverage", *args) -@nox.session(name="docs", python=main_python_version) +@nox.session(name="docs") def docs(session: nox.Session) -> None: """Build the documentation.""" args = session.posargs or ["docs", "build", "-W"] @@ -176,7 +175,7 @@ def docs(session: nox.Session) -> None: session.run("sphinx-build", *args) -@nox.session(name="docs-serve", python=main_python_version) +@nox.session(name="docs-serve") def docs_serve(session: nox.Session) -> None: """Build the documentation.""" args = session.posargs or [ @@ -199,7 +198,7 @@ def docs_serve(session: nox.Session) -> None: @nox.parametrize("replay_file_path", COOKIECUTTER_REPLAY_FILES) -@nox.session(python=main_python_version) +@nox.session() def test_cookiecutter(session: nox.Session, replay_file_path: str) -> None: """Uses the tap template to build an empty cookiecutter.