Repository: wntrblm/nox

Issue:
[GHA] nox uses Python 3.11 for sessions with no Python version specified, despite `python-versions` being set to `3.13`
### Current Behavior

If I use the GHA with
```
      - name: Setup nox
        uses: wntrblm/nox@2025.02.09
        with:
          python-versions: "3.13"
```
and then run a session that has no specific Python version, like
```
@nox.session
def lint(session: nox.Session):
    ...
```
then nox runs the session with Python 3.11 instead of 3.13.

Example: https://github.com/ansible-community/antsibull-docs-parser/actions/runs/13891427869/job/38863981140
1. "Setup nox" shows that `python-versions` is `3.13`;
2. "Set up nox environments" shows that a venv is created with Python version 3.11.

### Expected Behavior

I would expect that the session runs with Python 3.13.

### Steps To Reproduce

See above.

### Environment

```Markdown
- OS: Ubuntu 24.04
- Python: 3.11/3.12/3.13 (the action first installs 3.12, then installs 3.13 and 3.11)
- Nox: latest
```

### Anything else?

_No response_

Discussion:
@henryiii: We always inject 3.11 to make sure we can install nox. You can use `nox -P 3.13` to enforce a specific version of Python.@felixfontein: Ah, `-P` (`--force-python`) is a great idea, now I feel stupid I didn't think of that myself :) Thank you!

To sum up: for single and specific Python version runs in CI, set both `python-versions` to the version you want, and provide the same version via `--force-python` to nox.@henryiii: We've updated this to 3.13, will be in the next release.

Solution patch:
diff --git a/.github/action_helper.py b/.github/action_helper.py
index d2a6fce..e068547 100644
--- a/.github/action_helper.py
+++ b/.github/action_helper.py
@@ -33,7 +33,7 @@ def filter_version(version: str) -> str:
     return ".".join(version_parts[:2])
 
 
-def setup_action(input_: str) -> None:
+def setup_action(input_: str, *, self_version: str = "3.12") -> None:
     versions = [version.strip() for version in input_.split(",") if version.strip()]
 
     pypy_versions = [version for version in versions if version.startswith("pypy")]
@@ -60,15 +60,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.11 last to ease nox set-up
-    if "3.11" in cpython_versions_filtered:
-        index = cpython_versions_filtered.index("3.11")
+    # we want to install our own self version last to ease nox set-up
+    if self_version in cpython_versions_filtered:
+        index = cpython_versions_filtered.index(self_version)
         index = versions.index(cpython_versions[index])
         cpython_nox = versions.pop(index)
         versions.append(cpython_nox)
     else:
         # add this to install nox
-        versions.append("3.11")
+        versions.append(self_version)
 
     print(f"interpreters={json.dumps(versions)}")
 
diff --git a/action.yml b/action.yml
index e26e1fa..d1eb0c0 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.8, 3.9, 3.10, 3.11, 3.12, 3.13"
+    default: "3.9, 3.10, 3.11, 3.12, 3.13"
 branding:
   icon: package
   color: blue
@@ -15,7 +15,7 @@ runs:
     - uses: actions/setup-python@v5
       id: localpython
       with:
-        python-version: "3.8 - 3.12"
+        python-version: "3.9 - 3.13"
         update-environment: false
 
     - name: "Validate input"
diff --git a/docs/usage.rst b/docs/usage.rst
index ab9daea..18fc0f7 100644
--- a/docs/usage.rst
+++ b/docs/usage.rst
@@ -156,11 +156,6 @@ Note that using this option does not change the backend for sessions where ``ven
    as ``uv pip`` is used to install programs instead. If you need to manually
    interact with pip, you should install it with ``session.install("pip")``.
 
-   Also, uv tries very hard to cache, so you might want
-   ``--reinstall-package=<package>`` in your pip install command for the local
-   package, or preferably set ``tool.uv.reinstall-package`` in your
-   pyproject.toml/uv.toml.
-
 Backends that could be missing (``uv``, ``conda``, ``mamba``, and ``micromamba``) can have a fallback using ``|``, such as ``uv|virtualenv`` or ``micromamba|mamba|conda``. This will use the first item that is available on the users system.
 
 If you need to check to see which backend was selected, you can access it via
diff --git a/noxfile.py b/noxfile.py
index 81dda9e..6dc05cf 100644
--- a/noxfile.py
+++ b/noxfile.py
@@ -177,7 +177,7 @@ def _check_python_version(session: nox.Session) -> None:
 )
 def github_actions_default_tests(session: nox.Session) -> None:
     """Check default versions installed by the nox GHA Action"""
-    assert sys.version_info[:2] == (3, 11)
+    assert sys.version_info[:2] == (3, 12)
     _check_python_version(session)
 
 


Test patch:
diff --git a/tests/test_action_helper.py b/tests/test_action_helper.py
index 9995e9f..7237798 100644
--- a/tests/test_action_helper.py
+++ b/tests/test_action_helper.py
@@ -48,17 +48,18 @@ VALID_VERSION_LISTS = {
         "3.9",
         "3.10",
         "3.11",
+        "3.12",
     ],
-    "": ["3.11"],
-    "~3.12.0-0": ["~3.12.0-0", "3.11"],
-    "3.11.4": ["3.11.4"],
-    "3.9-dev,pypy3.9-nightly": ["pypy3.9-nightly", "3.9-dev", "3.11"],
-    "3.11, 3.10, 3.9, 3.8": ["3.10", "3.9", "3.8", "3.11"],
+    "": ["3.12"],
+    "~3.12.0-0": ["~3.12.0-0"],
+    "3.11.4": ["3.11.4", "3.12"],
+    "3.9-dev,pypy3.9-nightly": ["pypy3.9-nightly", "3.9-dev", "3.12"],
+    "3.12, 3.11, 3.10, 3.9": ["3.11", "3.10", "3.9", "3.12"],
     ",".join(f"3.{minor}" for minor in range(20)): [
         f"3.{minor}"
-        for i, minor in enumerate(minor_ for minor_ in range(20) if minor_ != 11)
+        for i, minor in enumerate(minor_ for minor_ in range(20) if minor_ != 12)
     ]
-    + ["3.11"],
+    + ["3.12"],
 }