Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop python 3.8 support #12875

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
2 changes: 1 addition & 1 deletion .github/workflows/prepare-release-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.8"
python-version: "3.x"

- name: Install dependencies
run: |
Expand Down
103 changes: 59 additions & 44 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,25 +54,24 @@ jobs:
fail-fast: false
matrix:
name: [
"windows-py38",
"windows-py38-pluggy",
"windows-py39",
"windows-py39-unittestextras",
"windows-py39-pluggy",
Pierre-Sassoulas marked this conversation as resolved.
Show resolved Hide resolved
"windows-py39-xdist",
"windows-py310",
"windows-py311",
"windows-py312",
"windows-py313",

"ubuntu-py38",
"ubuntu-py38-pluggy",
Pierre-Sassoulas marked this conversation as resolved.
Show resolved Hide resolved
"ubuntu-py38-freeze",
"ubuntu-py39",
"ubuntu-py310",
"ubuntu-py39-lsof-numpy-pexpect",
"ubuntu-py39-pluggy",
"ubuntu-py39-freeze",
"ubuntu-py39-xdist",
"ubuntu-py310-xdist",
"ubuntu-py311",
"ubuntu-py312",
"ubuntu-py313",
"ubuntu-pypy3",
"ubuntu-py313-pexpect",
"ubuntu-pypy3-xdist",

"macos-py38",
"macos-py39",
"macos-py310",
"macos-py312",
Expand All @@ -83,106 +82,122 @@ jobs:
]

include:
- name: "windows-py38"
python: "3.8"
- name: "windows-py39-unittestextras"
python: "3.9"
os: windows-latest
tox_env: "py38-unittestextras"
Pierre-Sassoulas marked this conversation as resolved.
Show resolved Hide resolved
tox_env: "py39-unittestextras"
use_coverage: true
- name: "windows-py38-pluggy"
python: "3.8"

- name: "windows-py39-pluggy"
python: "3.9"
os: windows-latest
tox_env: "py38-pluggymain-pylib-xdist"
- name: "windows-py39"
tox_env: "py39-pluggymain-pylib-xdist"

- name: "windows-py39-xdist"
python: "3.9"
os: windows-latest
tox_env: "py39-xdist"

- name: "windows-py310"
python: "3.10"
os: windows-latest
tox_env: "py310-xdist"

- name: "windows-py311"
python: "3.11"
os: windows-latest
tox_env: "py311"

- name: "windows-py312"
python: "3.12"
os: windows-latest
tox_env: "py312"

- name: "windows-py313"
python: "3.13-dev"
python: "3.13"
os: windows-latest
tox_env: "py313"

- name: "ubuntu-py38"
python: "3.8"

- name: "ubuntu-py39-lsof-numpy-pexpect"
python: "3.9"
os: ubuntu-latest
tox_env: "py38-lsof-numpy-pexpect"
Pierre-Sassoulas marked this conversation as resolved.
Show resolved Hide resolved
use_coverage: true
- name: "ubuntu-py38-pluggy"
python: "3.8"
tox_env: "py39-lsof-numpy-pexpect"

- name: "ubuntu-py39-pluggy"
python: "3.9"
os: ubuntu-latest
tox_env: "py38-pluggymain-pylib-xdist"
- name: "ubuntu-py38-freeze"
python: "3.8"
tox_env: "py39-pluggymain-pylib-xdist"

- name: "ubuntu-py39-freeze"
python: "3.9"
os: ubuntu-latest
tox_env: "py38-freeze"
- name: "ubuntu-py39"
tox_env: "py39-freeze"

- name: "ubuntu-py39-xdist"
python: "3.9"
os: ubuntu-latest
tox_env: "py39-xdist"
- name: "ubuntu-py310"

- name: "ubuntu-py310-xdist"
python: "3.10"
os: ubuntu-latest
tox_env: "py310-xdist"

- name: "ubuntu-py311"
python: "3.11"
os: ubuntu-latest
tox_env: "py311"
use_coverage: true

- name: "ubuntu-py312"
python: "3.12"
os: ubuntu-latest
tox_env: "py312"
use_coverage: true
- name: "ubuntu-py313"
python: "3.13-dev"

- name: "ubuntu-py313-pexpect"
python: "3.13"
os: ubuntu-latest
tox_env: "py313-pexpect"
use_coverage: true
- name: "ubuntu-pypy3"

- name: "ubuntu-pypy3-xdist"
python: "pypy-3.9"
os: ubuntu-latest
tox_env: "pypy3-xdist"

- name: "macos-py38"
python: "3.8"
os: macos-latest
tox_env: "py38-xdist"

- name: "macos-py39"
python: "3.9"
os: macos-latest
tox_env: "py39-xdist"
use_coverage: true

- name: "macos-py310"
python: "3.10"
os: macos-latest
tox_env: "py310-xdist"

- name: "macos-py312"
python: "3.12"
os: macos-latest
tox_env: "py312-xdist"

- name: "macos-py313"
python: "3.13-dev"
python: "3.13"
os: macos-latest
tox_env: "py313-xdist"


- name: "plugins"
python: "3.12"
os: ubuntu-latest
tox_env: "plugins"


- name: "doctesting"
python: "3.8"
python: "3.9"
os: ubuntu-latest
tox_env: "doctesting"
use_coverage: true
Expand All @@ -192,12 +207,12 @@ jobs:
contains(
fromJSON(
'[
"windows-py38-pluggy",
"windows-py39-pluggy",
"windows-py313",
"ubuntu-py38-pluggy",
"ubuntu-py38-freeze",
"ubuntu-py39-pluggy",
"ubuntu-py39-freeze",
"ubuntu-py313",
"macos-py38",
"macos-py39",
"macos-py313"
]'
),
Expand Down
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ repos:
rev: v3.19.0
hooks:
- id: pyupgrade
args:
- "--py39-plus"
# Manual because ruff does what pyupgrade does and the two are not out of sync
# often enough to make launching pyupgrade everytime worth it
stages: [manual]
Pierre-Sassoulas marked this conversation as resolved.
Show resolved Hide resolved
- repo: local
hooks:
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ Here is a simple overview, with pytest-specific bits:

#. Run all the tests

You need to have Python 3.8 or later available in your system. Now
You need to have Python 3.9 or later available in your system. Now
running tests is as simple as issuing this command::

$ tox -e linting,py39
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ Features
- Can run `unittest <https://docs.pytest.org/en/stable/how-to/unittest.html>`_ (or trial)
test suites out of the box

- Python 3.8+ or PyPy3
- Python 3.9+ or PyPy3

- Rich plugin architecture, with over 1300+ `external plugins <https://docs.pytest.org/en/latest/reference/plugin_list.html>`_ and thriving community

Expand Down
1 change: 1 addition & 0 deletions changelog/12874.breaking.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
We dropped support for Python 3.8 following its end of life (2024-10-07).
1 change: 1 addition & 0 deletions doc/en/backwards-compatibility.rst
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ Released pytest versions support all Python versions that are actively maintaine
============== ===================
pytest version min. Python version
============== ===================
8.4+ 3.9+
8.0+ 3.8+
7.1+ 3.7+
6.2 - 7.0 3.6+
Expand Down
8 changes: 3 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ authors = [
{ name = "Florian Bruhin" },
{ name = "Others (See AUTHORS)" },
]
requires-python = ">=3.8"
requires-python = ">=3.9"
classifiers = [
"Development Status :: 6 - Mature",
"Intended Audience :: Developers",
Expand All @@ -33,7 +33,6 @@ classifiers = [
"Operating System :: POSIX",
"Operating System :: Unix",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
Expand Down Expand Up @@ -85,7 +84,7 @@ write_to = "src/_pytest/_version.py"

[tool.black]
target-version = [
'py38',
'py39',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Side note, according to https://black.readthedocs.io/en/stable/usage_and_configuration/the_basics.html#t-target-version, we don't need to configure this because black also looks at requires-python. It also says we're actually supposed to list all supported versions, oh well.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

e2f17e0

Feel like I could have removed the option too there. I'm not sure if this option is useful since the example they gave in python 3.5. (Also black is only used in doc for blacken-docs afair)

]

[tool.ruff]
Expand Down Expand Up @@ -230,7 +229,6 @@ disable = [
"deprecated-argument",
"deprecated-attribute",
"deprecated-class",
"deprecated-typing-alias",
"disallowed-name", # foo / bar are used often in tests
"duplicate-code",
"else-if-used", # not activated by default, PLR5501 disabled in ruff
Expand Down Expand Up @@ -508,7 +506,7 @@ files = [
mypy_path = [
"src",
]
python_version = "3.8"
python_version = "3.9"
check_untyped_defs = true
disallow_any_generics = true
disallow_untyped_defs = true
Expand Down
2 changes: 1 addition & 1 deletion scripts/generate-gh-release-notes.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@

from __future__ import annotations

from collections.abc import Sequence
from pathlib import Path
import re
import sys
from typing import Sequence

import pypandoc

Expand Down
4 changes: 2 additions & 2 deletions scripts/update-plugin-list.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# mypy: disallow-untyped-defs
from __future__ import annotations

from collections.abc import Iterable
from collections.abc import Iterator
import datetime
import pathlib
import re
from textwrap import dedent
from textwrap import indent
from typing import Any
from typing import Iterable
from typing import Iterator
from typing import TypedDict

import packaging.version
Expand Down
17 changes: 7 additions & 10 deletions src/_pytest/_code/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
from __future__ import annotations

import ast
from collections.abc import Callable
from collections.abc import Iterable
from collections.abc import Mapping
from collections.abc import Sequence
import dataclasses
import inspect
from inspect import CO_VARARGS
Expand All @@ -10,28 +14,21 @@
import os
from pathlib import Path
import re
from re import Pattern
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to ignore if it's a hassle: to me match: re.Pattern would be clearer than match: Pattern, so I'd drop the from re import Pattern and use it qualified instead. Same for re.Match.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import sys
import traceback
from traceback import format_exception_only
from types import CodeType
from types import FrameType
from types import TracebackType
from typing import Any
from typing import Callable
from typing import ClassVar
from typing import Final
from typing import final
from typing import Generic
from typing import Iterable
from typing import List
from typing import Literal
from typing import Mapping
from typing import overload
from typing import Pattern
from typing import Sequence
from typing import SupportsIndex
from typing import Tuple
from typing import Type
from typing import TypeVar
from typing import Union

Expand All @@ -56,7 +53,7 @@

TracebackStyle = Literal["long", "short", "line", "no", "native", "value", "auto"]

EXCEPTION_OR_MORE = Union[Type[BaseException], Tuple[Type[BaseException], ...]]
EXCEPTION_OR_MORE = Union[type[BaseException], tuple[type[BaseException], ...]]


class Code:
Expand Down Expand Up @@ -320,7 +317,7 @@ def name(self) -> str:
return self.frame.code.raw.co_name


class Traceback(List[TracebackEntry]):
class Traceback(list[TracebackEntry]):
"""Traceback objects encapsulate and offer higher level access to Traceback entries."""

def __init__(
Expand Down
4 changes: 2 additions & 2 deletions src/_pytest/_code/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@

import ast
from bisect import bisect_right
from collections.abc import Iterable
from collections.abc import Iterator
import inspect
import textwrap
import tokenize
import types
from typing import Iterable
from typing import Iterator
from typing import overload
import warnings

Expand Down
Loading