From 16569f98b2c4b1d734acf3c774c95fdf8036ce76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Ram=C3=ADrez-Mondrag=C3=B3n?= Date: Wed, 9 Oct 2024 13:10:41 -0600 Subject: [PATCH 1/2] chore: Stop using `nox-poetry` --- .github/workflows/api-changes.yml | 1 - .github/workflows/constraints.txt | 1 - .github/workflows/cookiecutter-e2e.yml | 1 - .github/workflows/test.yml | 3 -- docs/CONTRIBUTING.md | 1 - noxfile.py | 66 ++++++++++---------------- 6 files changed, 24 insertions(+), 49 deletions(-) diff --git a/.github/workflows/api-changes.yml b/.github/workflows/api-changes.yml index c758517c4..9cbae5843 100644 --- a/.github/workflows/api-changes.yml +++ b/.github/workflows/api-changes.yml @@ -38,7 +38,6 @@ jobs: run: | python -Im pip install -U pip pipx install griffe nox - pipx inject nox nox-poetry pipx list - name: Set REF diff --git a/.github/workflows/constraints.txt b/.github/workflows/constraints.txt index faa4f7f92..087b04576 100644 --- a/.github/workflows/constraints.txt +++ b/.github/workflows/constraints.txt @@ -5,4 +5,3 @@ poetry-plugin-export==1.8.0 poetry-dynamic-versioning==1.4.1 pre-commit==4.0.0 nox==2024.4.15 -nox-poetry==1.0.3 diff --git a/.github/workflows/cookiecutter-e2e.yml b/.github/workflows/cookiecutter-e2e.yml index 051d21d95..11ba9d524 100644 --- a/.github/workflows/cookiecutter-e2e.yml +++ b/.github/workflows/cookiecutter-e2e.yml @@ -67,7 +67,6 @@ jobs: PIP_CONSTRAINT: ${{ github.workspace }}/.github/workflows/constraints.txt run: | pipx install nox - pipx inject nox nox-poetry nox --version - name: Run Nox diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1613ebc5e..6d0cb924f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -87,7 +87,6 @@ jobs: PIP_CONSTRAINT: ${{ github.workspace }}/.github/workflows/constraints.txt run: | pipx install 'nox[uv]' - pipx inject nox nox-poetry nox --version - uses: actions/cache@v4 @@ -152,7 +151,6 @@ jobs: PIP_CONSTRAINT: ${{ github.workspace }}/.github/workflows/constraints.txt run: | pipx install 'nox[uv]' - pipx inject nox nox-poetry nox --version - name: Run Nox @@ -198,7 +196,6 @@ jobs: PIP_CONSTRAINT: ${{ github.workspace }}/.github/workflows/constraints.txt run: | pipx install 'nox[uv]' - pipx inject nox nox-poetry nox --version - run: nox --install-only diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index d147d775a..29a5eee82 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -30,7 +30,6 @@ With `pipx` installed, you globally add the required tools: pipx install poetry pipx install pre-commit pipx install nox -pipx inject nox nox-poetry ``` Now you can use Poetry to install package dependencies: diff --git a/noxfile.py b/noxfile.py index a07c953ab..8e7cb5ad0 100644 --- a/noxfile.py +++ b/noxfile.py @@ -7,19 +7,9 @@ import sys import tempfile from pathlib import Path -from textwrap import dedent import nox -try: - from nox_poetry import Session, session -except ImportError: - message = f"""\ - Nox failed to import the 'nox-poetry' package. - Please install it using the following command: - {sys.executable} -m pip install nox-poetry""" - raise SystemExit(dedent(message)) from None - nox.needs_version = ">=2024.4.15" nox.options.default_venv_backend = "uv|virtualenv" @@ -49,8 +39,8 @@ typing_dependencies = poetry_config["group"]["typing"]["dependencies"].keys() -@session(python=main_python_version) -def mypy(session: Session) -> None: +@nox.session(python=main_python_version) +def mypy(session: nox.Session) -> None: """Check types with mypy.""" args = session.posargs or ["singer_sdk"] session.install(".[faker,jwt,parquet,s3,testing]") @@ -60,19 +50,15 @@ def mypy(session: Session) -> None: session.run("mypy", f"--python-executable={sys.executable}", "noxfile.py") -@session(python=python_versions) -def tests(session: Session) -> None: +@nox.session(python=python_versions) +def tests(session: nox.Session) -> None: """Execute pytest tests and compute coverage.""" session.install(".[faker,jwt,parquet,s3]") session.install(*test_dependencies) sqlalchemy_version = os.environ.get("SQLALCHEMY_VERSION") if sqlalchemy_version: - # Bypass nox-poetry use of --constraint so we can install a version of - # SQLAlchemy that doesn't match what's in poetry.lock. - session.poetry.session.install( # type: ignore[attr-defined] - f"sqlalchemy=={sqlalchemy_version}.*", - ) + session.install(f"sqlalchemy=={sqlalchemy_version}.*") env = {"COVERAGE_CORE": "sysmon"} if session.python == "3.12" else {} @@ -93,18 +79,14 @@ def tests(session: Session) -> None: session.notify("coverage", posargs=[]) -@session(python=main_python_version) -def benches(session: Session) -> None: +@nox.session(python=main_python_version) +def benches(session: nox.Session) -> None: """Run benchmarks.""" session.install(".[jwt,s3]") session.install(*test_dependencies) sqlalchemy_version = os.environ.get("SQLALCHEMY_VERSION") if sqlalchemy_version: - # Bypass nox-poetry use of --constraint so we can install a version of - # SQLAlchemy that doesn't match what's in poetry.lock. - session.poetry.session.install( # type: ignore[attr-defined] - f"sqlalchemy=={sqlalchemy_version}", - ) + session.install(f"sqlalchemy=={sqlalchemy_version}") session.run( "pytest", "--benchmark-only", @@ -113,16 +95,16 @@ def benches(session: Session) -> None: ) -@session(name="deps", python=python_versions) -def dependencies(session: Session) -> None: +@nox.session(name="deps", python=python_versions) +def dependencies(session: nox.Session) -> None: """Check issues with dependencies.""" session.install(".[s3,testing]") session.install("deptry") session.run("deptry", "singer_sdk", *session.posargs) -@session(python=main_python_version) -def update_snapshots(session: Session) -> None: +@nox.session(python=main_python_version) +def update_snapshots(session: nox.Session) -> None: """Update pytest snapshots.""" args = session.posargs or ["-m", "snapshot"] @@ -131,8 +113,8 @@ def update_snapshots(session: Session) -> None: session.run("pytest", "--snapshot-update", *args) -@session(python=python_versions) -def doctest(session: Session) -> None: +@nox.session(python=python_versions) +def doctest(session: nox.Session) -> None: """Run examples with xdoctest.""" if session.posargs: args = [package, *session.posargs] @@ -146,8 +128,8 @@ def doctest(session: Session) -> None: session.run("pytest", "--xdoctest", *args) -@session(python=main_python_version) -def coverage(session: Session) -> None: +@nox.session(python=main_python_version) +def coverage(session: nox.Session) -> None: """Generate coverage report.""" args = session.posargs or ["report", "-m"] @@ -159,8 +141,8 @@ def coverage(session: Session) -> None: session.run("coverage", *args) -@session(name="docs", python=main_python_version) -def docs(session: Session) -> None: +@nox.session(name="docs", python=main_python_version) +def docs(session: nox.Session) -> None: """Build the documentation.""" args = session.posargs or ["docs", "build", "-W"] if not session.posargs and "FORCE_COLOR" in os.environ: @@ -175,8 +157,8 @@ def docs(session: Session) -> None: session.run("sphinx-build", *args) -@session(name="docs-serve", python=main_python_version) -def docs_serve(session: Session) -> None: +@nox.session(name="docs-serve", python=main_python_version) +def docs_serve(session: nox.Session) -> None: """Build the documentation.""" args = session.posargs or [ "--open-browser", @@ -198,8 +180,8 @@ def docs_serve(session: Session) -> None: @nox.parametrize("replay_file_path", COOKIECUTTER_REPLAY_FILES) -@session(python=main_python_version) -def test_cookiecutter(session: Session, replay_file_path: str) -> None: +@nox.session(python=main_python_version) +def test_cookiecutter(session: nox.Session, replay_file_path: str) -> None: """Uses the tap template to build an empty cookiecutter. Runs the lint task on the created test project. @@ -261,8 +243,8 @@ def test_cookiecutter(session: Session, replay_file_path: str) -> None: session.run("pre-commit", "run", "--all-files", external=True) -@session(name="version-bump") -def version_bump(session: Session) -> None: +@nox.session(name="version-bump") +def version_bump(session: nox.Session) -> None: """Run commitizen.""" session.install( "commitizen", From 6bfc27ef3178000c64e7b213988f3fdb0822d463 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Ram=C3=ADrez-Mondrag=C3=B3n?= Date: Wed, 9 Oct 2024 13:15:44 -0600 Subject: [PATCH 2/2] Avoid unnecessarily installing Poetry --- .github/workflows/constraints.txt | 2 -- .github/workflows/cookiecutter-e2e.yml | 2 -- .github/workflows/test.yml | 30 -------------------------- 3 files changed, 34 deletions(-) diff --git a/.github/workflows/constraints.txt b/.github/workflows/constraints.txt index 087b04576..3ed7c243a 100644 --- a/.github/workflows/constraints.txt +++ b/.github/workflows/constraints.txt @@ -1,7 +1,5 @@ griffe==1.3.2 pip==24.2 poetry==1.8.3 -poetry-plugin-export==1.8.0 -poetry-dynamic-versioning==1.4.1 pre-commit==4.0.0 nox==2024.4.15 diff --git a/.github/workflows/cookiecutter-e2e.yml b/.github/workflows/cookiecutter-e2e.yml index 11ba9d524..ef2d5e4d5 100644 --- a/.github/workflows/cookiecutter-e2e.yml +++ b/.github/workflows/cookiecutter-e2e.yml @@ -46,9 +46,7 @@ jobs: PIP_CONSTRAINT: ${{ github.workspace }}/.github/workflows/constraints.txt run: | pipx install poetry - pipx inject poetry poetry-plugin-export poetry --version - poetry self show plugins - uses: actions/setup-python@v5 with: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6d0cb924f..89ab95710 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -61,16 +61,6 @@ jobs: with: fetch-depth: 0 - - name: Install Poetry - env: - PIP_CONSTRAINT: ${{ github.workspace }}/.github/workflows/constraints.txt - run: | - pipx install poetry - pipx inject poetry poetry-plugin-export - pipx inject poetry poetry-dynamic-versioning[plugin] - poetry --version - poetry self show plugins - - uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} @@ -125,16 +115,6 @@ jobs: with: fetch-depth: 0 - - name: Install Poetry - env: - PIP_CONSTRAINT: ${{ github.workspace }}/.github/workflows/constraints.txt - run: | - pipx install poetry - pipx inject poetry poetry-plugin-export - pipx inject poetry poetry-dynamic-versioning[plugin] - poetry --version - poetry self show plugins - - uses: actions/setup-python@v5 with: python-version: ${{ env.NOXPYTHON }} @@ -165,16 +145,6 @@ jobs: NOXSESSION: coverage steps: - uses: actions/checkout@v4 - - - name: Install Poetry - env: - PIP_CONSTRAINT: ${{ github.workspace }}/.github/workflows/constraints.txt - run: | - pipx install poetry - pipx inject poetry poetry-plugin-export - poetry --version - poetry self show plugins - - uses: actions/setup-python@v5 with: python-version: '3.12'