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 3.8 support #3106

Merged
merged 16 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/autodeps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ jobs:
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: "3.8"
python-version: "3.9"

- name: Bump dependencies
run: |
python -m pip install -U pip pre-commit
python -m pip install -r test-requirements.txt
uv pip compile --universal --python-version=3.8 --upgrade test-requirements.in -o test-requirements.txt
uv pip compile --universal --python-version=3.9 --upgrade test-requirements.in -o test-requirements.txt
uv pip compile --universal --python-version=3.11 --upgrade docs-requirements.in -o docs-requirements.txt
pre-commit autoupdate --jobs 0

Expand All @@ -43,7 +43,7 @@ jobs:

- name: uv
run: |
uv pip compile --universal --python-version=3.8 test-requirements.in -o test-requirements.txt
uv pip compile --universal --python-version=3.9 test-requirements.in -o test-requirements.txt
uv pip compile --universal --python-version=3.11 docs-requirements.in -o docs-requirements.txt

- name: Commit changes and create automerge PR
Expand Down
41 changes: 21 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,23 @@ jobs:
strategy:
fail-fast: false
matrix:
python: ['pypy-3.10', '3.8', '3.9', '3.10', '3.11', '3.12']
python: ['pypy-3.10', '3.9', '3.10', '3.11', '3.12', '3.13']
arch: ['x86', 'x64']
lsp: ['']
lsp_extract_file: ['']
extra_name: ['']
include:
- python: '3.8'
- python: '3.9'
arch: 'x64'
lsp: 'https://raw.githubusercontent.com/python-trio/trio-ci-assets/master/komodia-based-vpn-setup.zip'
lsp_extract_file: 'komodia-based-vpn-setup.exe'
extra_name: ', with Komodia LSP'
- python: '3.8'
- python: '3.9'
arch: 'x64'
lsp: 'https://www.proxifier.com/download/legacy/ProxifierSetup342.exe'
lsp_extract_file: ''
extra_name: ', with IFS LSP'
#- python: '3.8'
#- python: '3.9'
# arch: 'x64'
# lsp: 'http://download.pctools.com/mirror/updates/9.0.0.2308-SDavfree-lite_en.exe'
# lsp_extract_file: ''
Expand Down Expand Up @@ -87,16 +87,16 @@ jobs:
strategy:
fail-fast: false
matrix:
python: ['pypy-3.10', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
python: ['pypy-3.10', '3.9', '3.10', '3.11', '3.12', '3.13']
check_formatting: ['0']
no_test_requirements: ['0']
extra_name: ['']
include:
- python: '3.12'
- python: '3.13'
check_formatting: '1'
extra_name: ', check formatting'
# separate test run that doesn't install test-requirements.txt
- python: '3.8'
- python: '3.9'
no_test_requirements: '1'
extra_name: ', no test-requirements'
continue-on-error: >-
Expand Down Expand Up @@ -143,7 +143,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python: ['pypy-3.10', '3.8', '3.9', '3.10', '3.11', '3.12']
python: ['pypy-3.10', '3.9', '3.10', '3.11', '3.12', '3.13']
continue-on-error: >-
${{
(
Expand Down Expand Up @@ -203,7 +203,15 @@ jobs:
strategy:
fail-fast: false
matrix:
python: ['3.8', '3.12']
include:
- python: '3.9' # We support running on cython 2 and 3 for 3.9
cython: '<3' # cython 2
- python: '3.9'
cython: '>=3' # cython 3 (or greater)
- python: '3.11' # 3.11 is the last version Cy2 supports
cython: '<3' # cython 2
- python: '3.13' # We support running cython3 on 3.13
cython: '>=3' # cython 3 (or greater)
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -216,18 +224,11 @@ jobs:
- name: install trio and setuptools
run: python -m pip install --upgrade pip . setuptools

- name: install cython<3
run: python -m pip install "cython<3"
- name: compile pyx file
run: cythonize -i tests/cython/test_cython.pyx
- name: import & run module
run: python -c 'import tests.cython.test_cython'
- name: install cython & compile pyx file
run: |
python -m pip install "cython${{ matrix.cython }}"
cythonize --inplace tests/cython/test_cython.pyx

- name: install cython>=3
run: python -m pip install "cython>=3"
- name: compile pyx file
# different cython version should trigger a re-compile, but --force just in case
run: cythonize --inplace --force tests/cython/test_cython.pyx
- name: import & run module
run: python -c 'import tests.cython.test_cython'

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.8"
python-version: "3.9"
- run: python -m pip install build
- run: python -m build

Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ demonstration of implementing the "Happy Eyeballs" algorithm in an
older library versus Trio.

**Cool, but will it work on my system?** Probably! As long as you have
some kind of Python 3.8-or-better (CPython or `currently maintained versions of
some kind of Python 3.9-or-better (CPython or `currently maintained versions of
PyPy3 <https://doc.pypy.org/en/latest/faq.html#which-python-versions-does-pypy-implement>`__
are both fine), and are using Linux, macOS, Windows, or FreeBSD, then Trio
will work. Other environments might work too, but those
Expand Down
2 changes: 1 addition & 1 deletion check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ fi

# Check pip compile is consistent
echo "::group::Pip Compile - Tests"
uv pip compile --universal --python-version=3.8 test-requirements.in -o test-requirements.txt
uv pip compile --universal --python-version=3.9 test-requirements.in -o test-requirements.txt
echo "::endgroup::"
echo "::group::Pip Compile - Docs"
uv pip compile --universal --python-version=3.11 docs-requirements.in -o docs-requirements.txt
Expand Down
2 changes: 1 addition & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Vital statistics:

* Supported environments: We test on

- Python: 3.8+ (CPython and PyPy)
- Python: 3.9+ (CPython and PyPy)
- Windows, macOS, Linux (glibc and musl), FreeBSD

Other environments might also work; give it a try and see.
Expand Down
2 changes: 1 addition & 1 deletion docs/source/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Okay, ready? Let's get started.
Before you begin
----------------

1. Make sure you're using Python 3.8 or newer.
1. Make sure you're using Python 3.9 or newer.

2. ``python3 -m pip install --upgrade trio`` (or on Windows, maybe
``py -3 -m pip install --upgrade trio`` – `details
Expand Down
1 change: 1 addition & 0 deletions newsfragments/3106.removal.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Drop support for Python 3.8. (`#3104 <https://github.com/python-trio/trio/issues/3104>`__)
8 changes: 3 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ classifiers = [
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"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 All @@ -35,7 +34,7 @@ classifiers = [
"Topic :: System :: Networking",
"Typing :: Typed",
]
requires-python = ">=3.8"
requires-python = ">=3.9"
dependencies = [
# attrs 19.2.0 adds `eq` option to decorators
# attrs 20.1.0 adds @frozen
Expand Down Expand Up @@ -75,7 +74,6 @@ include-package-data = true
version = {attr = "trio._version.__version__"}

[tool.black]
target-version = ['py38']
force-exclude = '''
(
^/docs/source/reference-.*
Expand Down Expand Up @@ -170,7 +168,7 @@ combine-as-imports = true
fixture-parentheses = false

[tool.mypy]
python_version = "3.8"
python_version = "3.9"
files = ["src/trio/", "docs/source/*.py"]

# Be flexible about dependencies that don't have stubs yet (like pytest)
Expand All @@ -195,7 +193,7 @@ disallow_untyped_defs = true
check_untyped_defs = true

[tool.pyright]
pythonVersion = "3.8"
pythonVersion = "3.9"
reportUnnecessaryTypeIgnoreComment = true
typeCheckingMode = "strict"

Expand Down
4 changes: 1 addition & 3 deletions src/trio/_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from typing import (
TYPE_CHECKING,
Generic,
Tuple, # only needed for typechecking on <3.9
)

import attrs
Expand Down Expand Up @@ -93,8 +92,7 @@ def _open_memory_channel(
# it could replace the normal function header
if TYPE_CHECKING:
# written as a class so you can say open_memory_channel[int](5)
# Need to use Tuple instead of tuple due to CI check running on 3.8
class open_memory_channel(Tuple["MemorySendChannel[T]", "MemoryReceiveChannel[T]"]):
class open_memory_channel(tuple["MemorySendChannel[T]", "MemoryReceiveChannel[T]"]):
def __new__( # type: ignore[misc] # "must return a subtype"
cls,
max_buffer_size: int | float, # noqa: PYI041
Expand Down
3 changes: 1 addition & 2 deletions src/trio/_core/_asyncgens.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@

if TYPE_CHECKING:
from types import AsyncGeneratorType
from typing import Set

_WEAK_ASYNC_GEN_SET = weakref.WeakSet[AsyncGeneratorType[object, NoReturn]]
_ASYNC_GEN_SET = Set[AsyncGeneratorType[object, NoReturn]]
_ASYNC_GEN_SET = set[AsyncGeneratorType[object, NoReturn]]
else:
_WEAK_ASYNC_GEN_SET = weakref.WeakSet
_ASYNC_GEN_SET = set
Expand Down
5 changes: 3 additions & 2 deletions src/trio/_core/_entry_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

import threading
from collections import deque
from typing import TYPE_CHECKING, Callable, NoReturn, Tuple
from collections.abc import Callable
from typing import TYPE_CHECKING, NoReturn

import attrs

Expand All @@ -16,7 +17,7 @@
PosArgsT = TypeVarTuple("PosArgsT")

Function = Callable[..., object]
Job = Tuple[Function, Tuple[object, ...]]
Job = tuple[Function, tuple[object, ...]]


@attrs.define
Expand Down
6 changes: 4 additions & 2 deletions src/trio/_core/_generated_io_kqueue.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
from __future__ import annotations

import sys
from typing import TYPE_CHECKING, Callable, ContextManager
from typing import TYPE_CHECKING

from ._ki import LOCALS_KEY_KI_PROTECTION_ENABLED
from ._run import GLOBAL_RUN_CONTEXT

if TYPE_CHECKING:
import select
from collections.abc import Callable
from contextlib import AbstractContextManager

from .. import _core
from .._file_io import _HasFileNo
Expand Down Expand Up @@ -44,7 +46,7 @@ def current_kqueue() -> select.kqueue:
def monitor_kevent(
ident: int,
filter: int,
) -> ContextManager[_core.UnboundedQueue[select.kevent]]:
) -> AbstractContextManager[_core.UnboundedQueue[select.kevent]]:
"""TODO: these are implemented, but are currently more of a sketch than
anything real. See `#26
<https://github.com/python-trio/trio/issues/26>`__.
Expand Down
8 changes: 6 additions & 2 deletions src/trio/_core/_generated_io_windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
from __future__ import annotations

import sys
from typing import TYPE_CHECKING, ContextManager
from typing import TYPE_CHECKING

from ._ki import LOCALS_KEY_KI_PROTECTION_ENABLED
from ._run import GLOBAL_RUN_CONTEXT

if TYPE_CHECKING:
from contextlib import AbstractContextManager

from typing_extensions import Buffer

from .._file_io import _HasFileNo
Expand Down Expand Up @@ -196,7 +198,9 @@ def current_iocp() -> int:
raise RuntimeError("must be called from async context") from None


def monitor_completion_key() -> ContextManager[tuple[int, UnboundedQueue[object]]]:
def monitor_completion_key() -> (
AbstractContextManager[tuple[int, UnboundedQueue[object]]]
):
"""TODO: these are implemented, but are currently more of a sketch than
anything real. See `#26
<https://github.com/python-trio/trio/issues/26>`__ and `#52
Expand Down
7 changes: 5 additions & 2 deletions src/trio/_core/_instrumentation.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from __future__ import annotations

import logging
import types
from typing import Any, Callable, Dict, Sequence, TypeVar
from collections.abc import Callable, Sequence
from typing import Any, TypeVar

from .._abc import Instrument

Expand All @@ -17,7 +20,7 @@ def _public(fn: F) -> F:
return fn


class Instruments(Dict[str, Dict[Instrument, None]]):
class Instruments(dict[str, dict[Instrument, None]]):
"""A collection of `trio.abc.Instrument` organized by hook.

Instrumentation calls are rather expensive, and we don't want a
Expand Down
4 changes: 3 additions & 1 deletion src/trio/_core/_io_kqueue.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import select
import sys
from contextlib import contextmanager
from typing import TYPE_CHECKING, Callable, Iterator, Literal
from typing import TYPE_CHECKING, Literal

import attrs
import outcome
Expand All @@ -14,6 +14,8 @@
from ._wakeup_socketpair import WakeupSocketpair

if TYPE_CHECKING:
from collections.abc import Callable, Iterator

from typing_extensions import TypeAlias

from .._core import Abort, RaiseCancelT, Task, UnboundedQueue
Expand Down
4 changes: 2 additions & 2 deletions src/trio/_core/_io_windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
from typing import (
TYPE_CHECKING,
Any,
Callable,
Iterator,
Literal,
TypeVar,
cast,
Expand Down Expand Up @@ -41,6 +39,8 @@
)

if TYPE_CHECKING:
from collections.abc import Callable, Iterator

from typing_extensions import Buffer, TypeAlias

from .._file_io import _HasFileNo
Expand Down
4 changes: 1 addition & 3 deletions src/trio/_core/_tests/test_guest_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@
import time
import traceback
import warnings
from collections.abc import AsyncGenerator, Awaitable, Callable
from functools import partial
from math import inf
from typing import (
TYPE_CHECKING,
Any,
AsyncGenerator,
Awaitable,
Callable,
NoReturn,
TypeVar,
)
Expand Down
Loading
Loading