Skip to content

Commit a6e1a4e

Browse files
authored
chore: drop Python 3.7 (#822)
* chore: drop Python 3.7 Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> * docs: modernize some docs versions Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> --------- Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
1 parent eabad94 commit a6e1a4e

15 files changed

Lines changed: 46 additions & 97 deletions

.github/workflows/ci.yml

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
fail-fast: false
2121
matrix:
2222
os: [ubuntu-20.04, windows-latest, macos-13]
23-
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
23+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
2424
include:
2525
- os: macos-14
2626
python-version: "3.12"
@@ -32,7 +32,6 @@ jobs:
3232
python-version: ${{ matrix.python-version }}
3333
- name: Setup uv
3434
uses: yezz123/setup-uv@v4
35-
if: matrix.python-version != '3.7'
3635
- name: Set up Miniconda
3736
uses: conda-incubator/setup-miniconda@v3
3837
with:
@@ -41,16 +40,11 @@ jobs:
4140
miniforge-variant: Mambaforge
4241
use-mamba: true
4342
- name: Install Nox-under-test (uv)
44-
if: matrix.python-version != '3.7'
4543
run: uv pip install --system .
46-
- name: Install Nox-under-test (pip)
47-
if: matrix.python-version == '3.7'
48-
run: python -m pip install --disable-pip-version-check .
4944
- name: Run tests on ${{ matrix.os }} (tox <4)
5045
run: nox --non-interactive --error-on-missing-interpreter --session "tests(python='${{ matrix.python-version }}', tox_version='<4')" -- --full-trace
5146
- name: Run tox-to-nox tests on ${{ matrix.os }} (tox latest)
5247
run: nox --non-interactive --error-on-missing-interpreter --session "tests(python='${{ matrix.python-version }}', tox_version='latest')" -- tests/test_tox_to_nox.py --full-trace
53-
if: matrix.python-version != '3.7'
5448
- name: Save coverage report
5549
uses: actions/upload-artifact@v4
5650
with:
@@ -62,10 +56,10 @@ jobs:
6256
runs-on: ubuntu-latest
6357
steps:
6458
- uses: actions/checkout@v4
65-
- name: Set up Python 3.11
59+
- name: Set up Python 3.12
6660
uses: actions/setup-python@v5
6761
with:
68-
python-version: "3.11"
62+
python-version: "3.12"
6963
- name: Setup uv
7064
uses: yezz123/setup-uv@v4
7165
- name: Install Nox-under-test
@@ -84,10 +78,10 @@ jobs:
8478
runs-on: ubuntu-latest
8579
steps:
8680
- uses: actions/checkout@v4
87-
- name: Set up Python 3.9
81+
- name: Set up Python 3.12
8882
uses: actions/setup-python@v5
8983
with:
90-
python-version: 3.9
84+
python-version: "3.12"
9185
- name: Install Nox-under-test
9286
run: python -m pip install --disable-pip-version-check .
9387
- name: Lint
@@ -96,10 +90,10 @@ jobs:
9690
runs-on: ubuntu-latest
9791
steps:
9892
- uses: actions/checkout@v4
99-
- name: Set up Python 3.9
93+
- name: Set up Python 3.12
10094
uses: actions/setup-python@v5
10195
with:
102-
python-version: 3.9
96+
python-version: "3.12"
10397
- name: Setup uv
10498
uses: yezz123/setup-uv@v4
10599
- name: Install Nox-under-test

CONTRIBUTING.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,11 @@ To just check for lint errors, run:
4242

4343
To run against a particular Python version:
4444

45-
nox --session tests-3.6
46-
nox --session tests-3.7
4745
nox --session tests-3.8
4846
nox --session tests-3.9
47+
nox --session tests-3.10
48+
nox --session tests-3.11
49+
nox --session tests-3.12
4950

5051
When you send a pull request the CI will handle running everything, but it is
5152
recommended to test as much as possible locally before pushing.

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ runs:
1515
- uses: actions/setup-python@v5
1616
id: localpython
1717
with:
18-
python-version: "3.7 - 3.12"
18+
python-version: "3.8 - 3.12"
1919
update-environment: false
2020

2121
- name: "Validate input"

docs/conf.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,7 @@
1515

1616
import os
1717
import sys
18-
19-
if sys.version_info >= (3, 8):
20-
from importlib import metadata
21-
else:
22-
import importlib_metadata as metadata
18+
from importlib import metadata
2319

2420
# If extensions (or modules to document with autodoc) are in another directory,
2521
# add these directories to sys.path here. If the directory is relative to the

docs/config.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -368,11 +368,11 @@ These two examples are equivalent:
368368
.. code-block:: python
369369
370370
@nox.session
371-
@nox.parametrize("python", ["3.6", "3.7", "3.8"])
371+
@nox.parametrize("python", ["3.10", "3.11", "3.12"])
372372
def tests(session):
373373
...
374374
375-
@nox.session(python=["3.6", "3.7", "3.8"])
375+
@nox.session(python=["3.10", "3.11", "3.12"])
376376
def tests(session):
377377
...
378378
@@ -388,9 +388,9 @@ Pythons:
388388
"python,dependency",
389389
[
390390
(python, dependency)
391-
for python in ("3.6", "3.7", "3.8")
391+
for python in ("3.10", "3.11", "3.12")
392392
for dependency in ("1.0", "2.0")
393-
if (python, dependency) != ("3.6", "2.0")
393+
if (python, dependency) != ("3.10", "2.0")
394394
],
395395
)
396396
def tests(session, dependency):

docs/tutorial.rst

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,16 @@ If you want to run ``nox`` within `GitHub Actions`_, you can use the ``wntrblm/n
3535
3636
# setup nox with all active CPython and PyPY versions provided by
3737
# the GitHub Actions environment i.e.
38-
# python-versions: "3.7, 3.8, 3.9, 3.10, pypy-3.7, pypy-3.8, pypy-3.9"
39-
# this uses version 2022.8.7 but any Nox tag will work here
40-
- uses: wntrblm/nox@2022.8.7
38+
# python-versions: "3.8, 3.9, 3.10, 3.11, 3.12, pypy-3.8, pypy-3.9, pypy-3.10"
39+
# Any Nox tag will work here
40+
- uses: wntrblm/nox@2024.04.15
4141
4242
# setup nox only for a given list of python versions
4343
# Limitations:
4444
# - Version specifiers shall be supported by actions/setup-python
45-
# - There can only be one "major.minor" per interpreter i.e. "3.7.0, 3.7.1" is invalid
46-
# this uses version 2022.8.7 but any Nox tag will work here
47-
- uses: wntrblm/nox@2022.8.7
45+
# - There can only be one "major.minor" per interpreter i.e. "3.12.0, 3.12.1" is invalid
46+
# Any Nox tag will work here
47+
- uses: wntrblm/nox@2024.04.15
4848
with:
4949
python-versions: "2.7, 3.5, 3.11, pypy-3.9"
5050
@@ -388,15 +388,15 @@ If you want your session to specifically run against a single version of Python
388388

389389
.. code-block:: python
390390
391-
@nox.session(python="3.7")
391+
@nox.session(python="3.12")
392392
def test(session):
393393
...
394394
395395
If you want your session to run against multiple versions of Python:
396396

397397
.. code-block:: python
398398
399-
@nox.session(python=["2.7", "3.6", "3.7"])
399+
@nox.session(python=["3.10", "3.11", "3.12"])
400400
def test(session):
401401
...
402402
@@ -407,13 +407,13 @@ been expanded into three distinct sessions:
407407
408408
Sessions defined in noxfile.py:
409409
410-
* test-2.7
411-
* test-3.6
412-
* test-3.7
410+
* test-3.10
411+
* test-3.11
412+
* test-3.12
413413
414414
You can run all of the ``test`` sessions using ``nox --sessions test`` or run
415415
an individual one using the full name as displayed in the list, for example,
416-
``nox --sessions test-3.5``. More details on selecting sessions can be found
416+
``nox --sessions test-3.12``. More details on selecting sessions can be found
417417
over in the :doc:`usage` documentation.
418418

419419
You can read more about configuring the virtual environment used by your

docs/usage.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,13 @@ If you have a :ref:`configured session's virtualenv <virtualenv config>`, you ca
7979

8080
.. code-tab:: console CLI options
8181

82-
nox --python 3.8
83-
nox -p 3.7 3.8
82+
nox --python 3.12
83+
nox -p 3.11 3.12
8484

8585
.. code-tab:: console Environment variables
8686

87-
NOXPYTHON=3.8 nox
88-
NOXPYTHON=3.7,3.8 nox
87+
NOXPYTHON=3.12 nox
88+
NOXPYTHON=3.11,3.12 nox
8989

9090
You can also use `pytest-style keywords`_ using ``-k`` or ``--keywords``, and
9191
tags using ``-t`` or ``--tags`` to filter test sessions:
@@ -377,7 +377,7 @@ Would run both ``install`` commands, but skip the ``run`` command:
377377
.. code-block:: console
378378
379379
nox > Running session tests
380-
nox > Creating virtualenv using python3.7 in ./.nox/tests
380+
nox > Creating virtualenv using python3.12 in ./.nox/tests
381381
nox > python -m pip install pytest
382382
nox > python -m pip install .
383383
nox > Skipping pytest run, as --install-only is set.

nox/_options.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,14 @@
2020
import os
2121
import sys
2222
from collections.abc import Iterable
23-
from typing import Any, Callable, Sequence
23+
from typing import Any, Callable, Literal, Sequence
2424

2525
import argcomplete
2626

2727
from nox import _option_set
2828
from nox.tasks import discover_manifest, filter_manifest, load_nox_module
2929
from nox.virtualenv import ALL_VENVS
3030

31-
if sys.version_info < (3, 8):
32-
from typing_extensions import Literal
33-
else:
34-
from typing import Literal
35-
3631
ReuseVenvType = Literal["no", "yes", "never", "always"]
3732

3833
"""All of Nox's configuration options."""

nox/_version.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,11 @@
1616

1717
import ast
1818
import contextlib
19-
import sys
19+
from importlib import metadata
2020

2121
from packaging.specifiers import InvalidSpecifier, SpecifierSet
2222
from packaging.version import InvalidVersion, Version
2323

24-
if sys.version_info >= (3, 8):
25-
from importlib import metadata
26-
else:
27-
import importlib_metadata as metadata
28-
2924

3025
class VersionCheckFailed(Exception):
3126
"""The Nox version does not satisfy what ``nox.needs_version`` specifies."""
@@ -42,10 +37,7 @@ def get_nox_version() -> str:
4237

4338
def _parse_string_constant(node: ast.AST) -> str | None: # pragma: no cover
4439
"""Return the value of a string constant."""
45-
if sys.version_info < (3, 8):
46-
if isinstance(node, ast.Str) and isinstance(node.s, str):
47-
return node.s
48-
elif isinstance(node, ast.Constant) and isinstance(node.value, str):
40+
if isinstance(node, ast.Constant) and isinstance(node.value, str):
4941
return node.value
5042
return None
5143

nox/command.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,11 @@
2020
import subprocess
2121
import sys
2222
from collections.abc import Iterable, Mapping, Sequence
23+
from typing import Literal
2324

2425
from nox.logger import logger
2526
from nox.popen import DEFAULT_INTERRUPT_TIMEOUT, DEFAULT_TERMINATE_TIMEOUT, popen
2627

27-
if sys.version_info < (3, 8):
28-
from typing_extensions import Literal
29-
else:
30-
from typing import Literal
31-
3228
TYPE_CHECKING = False
3329

3430
if TYPE_CHECKING:

0 commit comments

Comments
 (0)