From d1f1e49ecdebd6d92f0544434f3ee6d5c837396a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Schoentgen?= Date: Sun, 11 Aug 2024 09:26:55 +0200 Subject: [PATCH] feat!: drop Python 3.8 support --- .cirrus.yml | 16 ++++++++-------- .github/workflows/build-and-publish.yml | 1 - .github/workflows/tests.yml | 8 -------- README.rst | 4 ++-- docs/source/index.rst | 2 +- docs/source/installation.rst | 2 +- pyproject.toml | 2 +- setup.py | 3 +-- src/watchdog/utils/__init__.py | 14 +++----------- tox.ini | 2 +- 10 files changed, 18 insertions(+), 36 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index b305a1ad..186765ff 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -6,16 +6,16 @@ task: image_family: freebsd-12-2 install_script: - - pkg install -y python38 py38-sqlite3 + - pkg install -y python39 py39-sqlite3 # Print the Python version, only to be sure we are running the version we want - - python3.8 -c 'import platform; print("Python", platform.python_version())' + - python3.9 -c 'import platform; print("Python", platform.python_version())' # Check SQLite3 is installed - - python3.8 -c 'import sqlite3; print("SQLite3", sqlite3.version)' + - python3.9 -c 'import sqlite3; print("SQLite3", sqlite3.version)' setup_script: - - python3.8 -m ensurepip - - python3.8 -m pip install -U pip - - python3.8 -m pip install -r requirements-tests.txt + - python3.9 -m ensurepip + - python3.9 -m pip install -U pip + - python3.9 -m pip install -r requirements-tests.txt lint_script: - - python3.8 -m ruff src + - python3.9 -m ruff src tests_script: - - python3.8 -bb -m pytest tests + - python3.9 -bb -m pytest tests diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml index de4371f4..d05f8790 100644 --- a/.github/workflows/build-and-publish.yml +++ b/.github/workflows/build-and-publish.yml @@ -53,7 +53,6 @@ jobs: - name: Build wheels run: python -m cibuildwheel env: - CIBW_SKIP: "cp36-*" # skip 3.6 wheels CIBW_ARCHS_MACOS: "x86_64 universal2 arm64" - name: Artifacts list run: ls -l wheelhouse diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9dd02e0f..6afed287 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -39,13 +39,11 @@ jobs: emoji: 🪟 runs-on: [windows-latest] python: - - "3.8" - "3.9" - "3.10" - "3.11" - "3.12" - "3.13-dev" - - "pypy-3.8" - "pypy-3.9" include: - tox: @@ -67,15 +65,9 @@ jobs: emoji: 🐧 runs-on: [ubuntu-latest] exclude: - - os: - matrix: macos - python: "pypy-3.8" - os: matrix: macos python: "pypy-3.9" - - os: - matrix: windows - python: "pypy-3.8" - os: matrix: windows python: "pypy-3.9" diff --git a/README.rst b/README.rst index 2d6e0dd4..41656cdf 100755 --- a/README.rst +++ b/README.rst @@ -6,7 +6,7 @@ Watchdog Python API and shell utilities to monitor file system events. -Works on 3.8+. +Works on 3.9+. Example API Usage ----------------- @@ -211,7 +211,7 @@ appropriate observer like in the example above, do:: Dependencies ------------ -1. Python 3.8 or above. +1. Python 3.9 or above. 2. XCode_ (only on macOS when installing from sources) 3. PyYAML_ (only for ``watchmedo``) diff --git a/docs/source/index.rst b/docs/source/index.rst index 8365309a..1df5b69d 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -11,7 +11,7 @@ Watchdog Python API library and shell utilities to monitor file system events. -Works on 3.8+. +Works on 3.9+. Directory monitoring made easy with ----------------------------------- diff --git a/docs/source/installation.rst b/docs/source/installation.rst index e1e331d6..a445e553 100644 --- a/docs/source/installation.rst +++ b/docs/source/installation.rst @@ -4,7 +4,7 @@ Installation ============ -|project_name| requires 3.8+ to work. See a list of :ref:`installation-dependencies`. +|project_name| requires 3.9+ to work. See a list of :ref:`installation-dependencies`. Installing from PyPI using pip ------------------------------ diff --git a/pyproject.toml b/pyproject.toml index deed5d76..8a52f2a3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,7 +31,7 @@ addopts = """ [tool.ruff] line-length = 120 indent-width = 4 -target-version = "py38" +target-version = "py39" [tool.ruff.lint] extend-select = ["ALL"] diff --git a/setup.py b/setup.py index d1159e81..923cd532 100644 --- a/setup.py +++ b/setup.py @@ -129,7 +129,6 @@ "Programming Language :: Python", "Programming Language :: Python :: 3", "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", @@ -155,6 +154,6 @@ "watchmedo = watchdog.watchmedo:main [watchmedo]", ] }, - python_requires=">=3.8", + python_requires=">=3.9", zip_safe=False, ) diff --git a/src/watchdog/utils/__init__.py b/src/watchdog/utils/__init__.py index ece812ff..57306cd6 100644 --- a/src/watchdog/utils/__init__.py +++ b/src/watchdog/utils/__init__.py @@ -32,7 +32,9 @@ import sys import threading -from typing import TYPE_CHECKING + +# Using `as` to explicitly re-export this since this is a compatibility layer +from typing import Protocol as Protocol class UnsupportedLibc(Exception): @@ -130,13 +132,3 @@ def load_class(dotted_path): # return klass(*args, **kwargs) raise AttributeError(f"Module {module_name} does not have class attribute {klass_name}") - - -if TYPE_CHECKING or sys.version_info >= (3, 8): - # using `as` to explicitly re-export this since this is a compatibility layer - from typing import Protocol as Protocol -else: - # Provide a dummy Protocol class when not available from stdlib. Should be used - # only for hinting. This could be had from typing_protocol, but not worth adding - # the _first_ dependency just for this. - class Protocol: ... diff --git a/tox.ini b/tox.ini index e74a35be..6bd6a5d3 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] envlist = - py3{8,9,10,11,12,13} + py3{9,10,11,12,13} pypy3 docs types