From ed6002c52d8ba0462435bc8f97f2751b5d792d95 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Wed, 26 Oct 2022 21:51:38 -0400 Subject: [PATCH 1/2] chore: move to 3.11 final Signed-off-by: Henry Schreiner --- .github/action_helper.py | 10 +++++----- .github/workflows/action.yml | 2 +- .github/workflows/ci.yml | 8 ++++---- action.yml | 4 ++-- docs/tutorial.rst | 2 +- docs/usage.rst | 6 +++--- tests/test_action_helper.py | 30 ++++++++++++++++-------------- tests/test_main.py | 4 ++-- 8 files changed, 34 insertions(+), 32 deletions(-) diff --git a/.github/action_helper.py b/.github/action_helper.py index bf467942..59f66e49 100644 --- a/.github/action_helper.py +++ b/.github/action_helper.py @@ -14,7 +14,7 @@ def filter_version(version: str) -> str: else: version_ = version - # remove extra specifier e.g. "3.11-dev" => "3.11" + # remove extra specifier e.g. "3.12-dev" => "3.12" version_ = version_.split("-")[0] version_parts = version_.split(".") @@ -52,15 +52,15 @@ def setup_action(input_: str) -> None: # other interpreters also define pythonX.Y symlinks. versions = pypy_versions + cpython_versions - # we want to install python 3.10 last to ease nox set-up - if "3.10" in cpython_versions_filtered: - index = cpython_versions_filtered.index("3.10") + # we want to install python 3.11 last to ease nox set-up + if "3.11" in cpython_versions_filtered: + index = cpython_versions_filtered.index("3.11") index = versions.index(cpython_versions[index]) cpython_310 = versions.pop(index) versions.append(cpython_310) else: # add this to install nox - versions.append("3.10") + versions.append("3.11") if len(versions) > 20: raise ValueError(f"too many interpreters to install: {len(versions)} > 20") diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml index de9aec87..957a53b8 100644 --- a/.github/workflows/action.yml +++ b/.github/workflows/action.yml @@ -26,5 +26,5 @@ jobs: - uses: actions/checkout@v3 - uses: ./ with: - python-versions: "2.7.18, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 3.10, 3.11-dev, pypy-2.7, pypy-3.7, pypy-3.8, pypy-3.9-v7.3.9" + python-versions: "2.7.18, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 3.10, 3.11, pypy-2.7, pypy-3.7, pypy-3.8, pypy-3.9-v7.3.9" - run: nox --non-interactive --error-on-missing-interpreter --session github_actions_all_tests diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1ab9834c..4538eefe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest, macos-latest] - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11-dev"] + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} @@ -18,7 +18,7 @@ jobs: python-version: ${{ matrix.python-version }} - name: Set up Miniconda uses: conda-incubator/setup-miniconda@v2 - if: matrix.python-version != '3.11-dev' + if: matrix.python-version != '3.11' with: auto-update-conda: true python-version: ${{ matrix.python-version }} @@ -27,9 +27,9 @@ jobs: python -m pip install --disable-pip-version-check . - name: Run tests on ${{ matrix.os }} run: nox --non-interactive --error-on-missing-interpreter --session "tests-${{ matrix.python-version }}" -- --full-trace - if: matrix.python-version != '3.11-dev' + if: matrix.python-version != '3.11' - name: Run tests on ${{ matrix.os }} - if: matrix.python-version == '3.11-dev' + if: matrix.python-version == '3.11' run: nox --non-interactive --error-on-missing-interpreter --session "tests-3.11" -- --full-trace lint: runs-on: ubuntu-latest diff --git a/action.yml b/action.yml index 70ef2959..5997f5ae 100644 --- a/action.yml +++ b/action.yml @@ -4,7 +4,7 @@ inputs: python-versions: description: "comma-separated list of python versions to install" required: false - default: "3.7, 3.8, 3.9, 3.10, pypy-3.7, pypy-3.8, pypy-3.9" + default: "3.7, 3.8, 3.9, 3.10, 3.11, pypy-3.7, pypy-3.8, pypy-3.9" branding: icon: package color: blue @@ -15,7 +15,7 @@ runs: - uses: actions/setup-python@v4 id: localpython with: - python-version: "3.7 - 3.10" + python-version: "3.7 - 3.11" update-environment: false - name: "Validate input" diff --git a/docs/tutorial.rst b/docs/tutorial.rst index cb3163eb..0b7c460e 100644 --- a/docs/tutorial.rst +++ b/docs/tutorial.rst @@ -47,7 +47,7 @@ If you want to run ``nox`` within `GitHub Actions`_, you can use the ``wntrblm/n # this uses version 2022.8.7 but any Nox tag will work here - uses: wntrblm/nox@2022.8.7 with: - python-versions: "2.7, 3.5, 3.11-dev, pypy-3.9" + python-versions: "2.7, 3.5, 3.11, pypy-3.9" .. _pip: https://pip.readthedocs.org .. _user site: https://packaging.python.org/tutorials/installing-packages/#installing-to-the-user-site diff --git a/docs/usage.rst b/docs/usage.rst index 4276fa74..2a77b283 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -186,17 +186,17 @@ In addition to Nox supporting executing single sessions, it also supports runnin .. code-block:: console - nox --extra-pythons 3.8 3.9 + nox --extra-pythons 3.8 3.9 3.10 This will, in addition to specified Python versions in the Noxfile, also create sessions for the specified versions. This option can be combined with ``--python`` to replace, instead of appending, the Python interpreter for a given session:: - nox --python 3.10 --extra-python 3.10 -s lint + nox --python 3.11 --extra-python 3.11 -s lint Instead of passing both options, you can use the ``--force-python`` shorthand:: - nox --force-python 3.10 -s lint + nox --force-python 3.11 -s lint Also, you can specify ``python`` in place of a specific version. This will run the session using the ``python`` specified for the current ``PATH``:: diff --git a/tests/test_action_helper.py b/tests/test_action_helper.py index 07451cc1..c6ffbe77 100644 --- a/tests/test_action_helper.py +++ b/tests/test_action_helper.py @@ -13,7 +13,7 @@ "2.7.18": "2.7", "3.9-dev": "3.9", "3.10": "3.10", - "3.11.0.beta1": "3.11", + "3.11": "3.11", "pypy-3.7": "3.7", "pypy-3.8-v7.3.9": "3.8", "pypy-3.9": "3.9", @@ -42,8 +42,8 @@ def test_filter_version_invalid_minor(): VALID_VERSION_LISTS = { - "3.7, 3.8, 3.9, 3.10, pypy-3.7, pypy-3.8, pypy-3.9": [ - "::set-output name=interpreter_count::7", + "3.7, 3.8, 3.9, 3.10, 3.11, pypy-3.7, pypy-3.8, pypy-3.9": [ + "::set-output name=interpreter_count::8", "::set-output name=interpreter_0::pypy-3.7", "::set-output name=interpreter_1::pypy-3.8", "::set-output name=interpreter_2::pypy-3.9", @@ -51,35 +51,37 @@ def test_filter_version_invalid_minor(): "::set-output name=interpreter_4::3.8", "::set-output name=interpreter_5::3.9", "::set-output name=interpreter_6::3.10", + "::set-output name=interpreter_7::3.11", ], "": [ "::set-output name=interpreter_count::1", - "::set-output name=interpreter_0::3.10", + "::set-output name=interpreter_0::3.11", ], - "3.10.4": [ + "3.11.4": [ "::set-output name=interpreter_count::1", - "::set-output name=interpreter_0::3.10.4", + "::set-output name=interpreter_0::3.11.4", ], "3.9-dev,pypy3.9-nightly": [ "::set-output name=interpreter_count::3", "::set-output name=interpreter_0::pypy3.9-nightly", "::set-output name=interpreter_1::3.9-dev", - "::set-output name=interpreter_2::3.10", + "::set-output name=interpreter_2::3.11", ], - "3.10, 3.9, 3.8": [ - "::set-output name=interpreter_count::3", - "::set-output name=interpreter_0::3.9", - "::set-output name=interpreter_1::3.8", - "::set-output name=interpreter_2::3.10", + "3.11, 3.10, 3.9, 3.8": [ + "::set-output name=interpreter_count::4", + "::set-output name=interpreter_0::3.10", + "::set-output name=interpreter_1::3.9", + "::set-output name=interpreter_2::3.8", + "::set-output name=interpreter_3::3.11", ], ",".join(f"3.{minor}" for minor in range(20)): [ "::set-output name=interpreter_count::20" ] + [ f"::set-output name=interpreter_{i}::3.{minor}" - for i, minor in enumerate(minor_ for minor_ in range(20) if minor_ != 10) + for i, minor in enumerate(minor_ for minor_ in range(20) if minor_ != 11) ] - + ["::set-output name=interpreter_19::3.10"], + + ["::set-output name=interpreter_19::3.11"], } diff --git a/tests/test_main.py b/tests/test_main.py index 7c3ce2b8..c1ebc132 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -658,12 +658,12 @@ def test_main_color_conflict(capsys, monkeypatch): def test_main_force_python(monkeypatch): - monkeypatch.setattr(sys, "argv", ["nox", "--force-python=3.10"]) + monkeypatch.setattr(sys, "argv", ["nox", "--force-python=3.11"]) with mock.patch("nox.workflow.execute", return_value=0) as execute: with mock.patch.object(sys, "exit"): nox.__main__.main() config = execute.call_args[1]["global_config"] - assert config.pythons == config.extra_pythons == ["3.10"] + assert config.pythons == config.extra_pythons == ["3.11"] def test_main_reuse_existing_virtualenvs_no_install(monkeypatch): From cfe1282ae7c672113768aaebb0ef20d1711ec31b Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Mon, 31 Oct 2022 11:36:04 -0400 Subject: [PATCH 2/2] ci: remove unneeded if --- .github/workflows/ci.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4538eefe..c1e90000 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,10 +27,7 @@ jobs: python -m pip install --disable-pip-version-check . - name: Run tests on ${{ matrix.os }} run: nox --non-interactive --error-on-missing-interpreter --session "tests-${{ matrix.python-version }}" -- --full-trace - if: matrix.python-version != '3.11' - - name: Run tests on ${{ matrix.os }} - if: matrix.python-version == '3.11' - run: nox --non-interactive --error-on-missing-interpreter --session "tests-3.11" -- --full-trace + lint: runs-on: ubuntu-latest steps: