Skip to content

Commit

Permalink
chore: drop Python 3.7
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <[email protected]>
  • Loading branch information
henryiii committed Apr 26, 2024
1 parent 4fec3b4 commit 5d2a433
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 74 deletions.
20 changes: 7 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-20.04, windows-latest, macos-13]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
include:
- os: macos-14
python-version: "3.12"
Expand All @@ -32,7 +32,6 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Setup uv
uses: yezz123/setup-uv@v4
if: matrix.python-version != '3.7'
- name: Set up Miniconda
uses: conda-incubator/setup-miniconda@v3
with:
Expand All @@ -41,16 +40,11 @@ jobs:
miniforge-variant: Mambaforge
use-mamba: true
- name: Install Nox-under-test (uv)
if: matrix.python-version != '3.7'
run: uv pip install --system .
- name: Install Nox-under-test (pip)
if: matrix.python-version == '3.7'
run: python -m pip install --disable-pip-version-check .
- name: Run tests on ${{ matrix.os }} (tox <4)
run: nox --non-interactive --error-on-missing-interpreter --session "tests(python='${{ matrix.python-version }}', tox_version='<4')" -- --full-trace
- name: Run tox-to-nox tests on ${{ matrix.os }} (tox latest)
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
if: matrix.python-version != '3.7'
- name: Save coverage report
uses: actions/upload-artifact@v4
with:
Expand All @@ -62,10 +56,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.11"
python-version: "3.12"
- name: Setup uv
uses: yezz123/setup-uv@v4
- name: Install Nox-under-test
Expand All @@ -84,10 +78,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.9
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: 3.9
python-version: "3.12"
- name: Install Nox-under-test
run: python -m pip install --disable-pip-version-check .
- name: Lint
Expand All @@ -96,10 +90,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.9
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: 3.9
python-version: "3.12"
- name: Setup uv
uses: yezz123/setup-uv@v4
- name: Install Nox-under-test
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ runs:
- uses: actions/setup-python@v5
id: localpython
with:
python-version: "3.7 - 3.12"
python-version: "3.8 - 3.12"
update-environment: false

- name: "Validate input"
Expand Down
6 changes: 1 addition & 5 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@

import os
import sys

if sys.version_info >= (3, 8):
from importlib import metadata
else:
import importlib_metadata as metadata
from importlib import metadata

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
Expand Down
7 changes: 1 addition & 6 deletions nox/_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,14 @@
import os
import sys
from collections.abc import Iterable
from typing import Any, Callable, Sequence
from typing import Any, Callable, Literal, Sequence

import argcomplete

from nox import _option_set
from nox.tasks import discover_manifest, filter_manifest, load_nox_module
from nox.virtualenv import ALL_VENVS

if sys.version_info < (3, 8):
from typing_extensions import Literal
else:
from typing import Literal

ReuseVenvType = Literal["no", "yes", "never", "always"]

"""All of Nox's configuration options."""
Expand Down
12 changes: 2 additions & 10 deletions nox/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,11 @@

import ast
import contextlib
import sys
from importlib import metadata

from packaging.specifiers import InvalidSpecifier, SpecifierSet
from packaging.version import InvalidVersion, Version

if sys.version_info >= (3, 8):
from importlib import metadata
else:
import importlib_metadata as metadata


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

def _parse_string_constant(node: ast.AST) -> str | None: # pragma: no cover
"""Return the value of a string constant."""
if sys.version_info < (3, 8):
if isinstance(node, ast.Str) and isinstance(node.s, str):
return node.s
elif isinstance(node, ast.Constant) and isinstance(node.value, str):
if isinstance(node, ast.Constant) and isinstance(node.value, str):
return node.value
return None

Expand Down
6 changes: 1 addition & 5 deletions nox/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,11 @@
import subprocess
import sys
from collections.abc import Iterable, Mapping, Sequence
from typing import Literal

from nox.logger import logger
from nox.popen import DEFAULT_INTERRUPT_TIMEOUT, DEFAULT_TERMINATE_TIMEOUT, popen

if sys.version_info < (3, 8):
from typing_extensions import Literal
else:
from typing import Literal

TYPE_CHECKING = False

if TYPE_CHECKING:
Expand Down
7 changes: 1 addition & 6 deletions nox/tox_to_nox.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,15 @@
import os
import pkgutil
import re
import sys
from configparser import ConfigParser
from importlib import metadata
from pathlib import Path
from subprocess import check_output
from typing import Any, Iterable

import jinja2
import tox.config

if sys.version_info < (3, 8):
import importlib_metadata as metadata
else:
from importlib import metadata

TOX_VERSION = metadata.version("tox")

TOX4 = int(TOX_VERSION.split(".")[0]) >= 4
Expand Down
10 changes: 2 additions & 8 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,13 @@
nox.options.sessions.append("micromamba_tests")


# Because there is a dependency conflict between argcomplete and the latest tox
# (both depend on a different version of importlibmetadata for Py 3.7) pip
# installs tox 3 as the latest one for Py 3.7.
@nox.session
@nox.parametrize(
"python, tox_version",
[
(python, tox_version)
for python in ("3.7", "3.8", "3.9", "3.10", "3.11", "3.12")
for python in ("3.8", "3.9", "3.10", "3.11", "3.12")
for tox_version in ("latest", "<4")
if (python, tox_version) != ("3.7", "latest")
],
)
def tests(session: nox.Session, tox_version: str) -> None:
Expand Down Expand Up @@ -125,7 +121,7 @@ def cover(session: nox.Session) -> None:
session.run("coverage", "erase")


@nox.session(python="3.9")
@nox.session(python="3.12")
def lint(session: nox.Session) -> None:
"""Run pre-commit linting."""
session.install("pre-commit")
Expand Down Expand Up @@ -202,13 +198,11 @@ def github_actions_default_tests(session: nox.Session) -> None:

@nox.session(
python=[
"3.7",
"3.8",
"3.9",
"3.10",
"3.11",
"3.12",
"pypy3.7",
"pypy3.8",
"pypy3.9",
"pypy3.10",
Expand Down
7 changes: 2 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ authors = [
{ name = "Alethea Katherine Flowers" },
{ email = "[email protected]" },
]
requires-python = ">=3.7"
requires-python = ">=3.8"
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
Expand All @@ -31,7 +31,6 @@ classifiers = [
"Operating System :: Unix",
"Programming Language :: Python",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
Expand All @@ -42,10 +41,8 @@ classifiers = [
dependencies = [
"argcomplete<4.0,>=1.9.4",
"colorlog<7.0.0,>=2.6.1",
'importlib-metadata; python_version < "3.8"',
"packaging>=20.9",
'tomli>=1; python_version < "3.11"',
'typing-extensions>=3.7.4; python_version < "3.8"',
"virtualenv>=20.14.1",
]
[project.optional-dependencies]
Expand Down Expand Up @@ -112,7 +109,7 @@ exclude_also = [ "def __dir__()", "if TYPE_CHECKING:", "@overload" ]

[tool.mypy]
files = [ "nox/**/*.py", "noxfile.py" ]
python_version = "3.7"
python_version = "3.8"
strict = true
warn_unreachable = true
enable_error_code = [ "ignore-without-code", "redundant-expr", "truthy-bool" ]
Expand Down
7 changes: 1 addition & 6 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import contextlib
import os
import sys
from importlib import metadata
from pathlib import Path
from unittest import mock

Expand All @@ -28,12 +29,6 @@
import nox.registry
import nox.sessions

if sys.version_info >= (3, 8):
from importlib import metadata
else:
import importlib_metadata as metadata


RESOURCES = os.path.join(os.path.dirname(__file__), "resources")
VERSION = metadata.version("nox")

Expand Down
12 changes: 3 additions & 9 deletions tests/test_virtualenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import subprocess
import sys
import types
from importlib import metadata
from pathlib import Path
from textwrap import dedent
from typing import NamedTuple
Expand All @@ -31,11 +32,6 @@

import nox.virtualenv

if sys.version_info < (3, 8):
import importlib_metadata as metadata
else:
from importlib import metadata

IS_WINDOWS = nox.virtualenv._SYSTEM == "Windows"
HAS_CONDA = shutil.which("conda") is not None
HAS_UV = shutil.which("uv") is not None
Expand Down Expand Up @@ -497,8 +493,7 @@ def test_micromamba_environment(make_one, monkeypatch):
monkeypatch.setattr(nox.command, "run", run)
venv.create()
run.assert_called_once()
# .args requires Python 3.8+
((args,), _) = run.call_args
(args,) = run.call_args.args
assert args[0] == "micromamba"
assert "--channel=conda-forge" in args

Expand All @@ -521,8 +516,7 @@ def test_micromamba_channel_environment(make_one, monkeypatch, params):
venv.venv_params = params
venv.create()
run.assert_called_once()
# .args requires Python 3.8+
((args,), _) = run.call_args
(args,) = run.call_args.args
assert args[0] == "micromamba"
for p in params:
assert p in args
Expand Down

0 comments on commit 5d2a433

Please sign in to comment.