From 6ea19cac0447b3594cca29793fe0d308c3585a6a Mon Sep 17 00:00:00 2001 From: Giovanni Barillari Date: Fri, 13 Oct 2023 14:51:26 +0200 Subject: [PATCH] Add Python 3.12 support, drop Python 3.7 support (#248) * Add Python 3.12 support, drop Python 3.7 support * Bump pytest * test: use specific path for premission denied --- .github/workflows/ci.yml | 20 ++++++++++++-- Cargo.lock | 58 ++++++++++++++++++++++++++++----------- Cargo.toml | 2 +- README.md | 4 +-- pyproject.toml | 4 +-- requirements/testing.txt | 10 ++----- tests/test_rust_notify.py | 7 +++-- 7 files changed, 72 insertions(+), 33 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6f91cdae..13779b9d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,13 +17,14 @@ jobs: os: [ubuntu, macos, windows] rust-version: [stable, '1.56.0'] python-version: - - '3.7' - '3.8' - '3.9' - '3.10' - '3.11' + - '3.12' - 'pypy3.8' - 'pypy3.9' + - 'pypy3.10' exclude: - rust-version: '1.56.0' os: macos @@ -60,7 +61,16 @@ jobs: - run: pip install -e . - run: pip freeze + - if: matrix.os == 'ubuntu' + run: | + mkdir -p ${{ github.workspace }}/protected + touch ${{ github.workspace }}/protected/test + sudo chown -R root:root ${{ github.workspace }}/protected + sudo chmod 700 ${{ github.workspace }}/protected + - run: make test + env: + WATCHFILES_TEST_PERMISSION_DENIED_PATH: ${{ github.workspace }}/protected - run: coverage xml @@ -147,6 +157,10 @@ jobs: ls: dir target: i686 python-architecture: x86 + - os: windows + ls: dir + target: aarch64 + interpreter: 3.11 3.12 - os: ubuntu platform: linux target: i686 @@ -200,7 +214,7 @@ jobs: with: target: ${{ matrix.target }} manylinux: ${{ matrix.manylinux || 'auto' }} - args: --release --out dist + args: --release --out dist --interpreter ${{ matrix.interpreter || '3.8 3.9 3.10 3.11 3.12' }} - name: build pypy wheels if: ${{ matrix.pypy }} @@ -208,7 +222,7 @@ jobs: with: target: ${{ matrix.target }} manylinux: ${{ matrix.manylinux || 'auto' }} - args: --release --out dist --interpreter pypy3.8 pypy3.9 + args: --release --out dist --interpreter pypy3.8 pypy3.9 pypy3.10 - run: ${{ matrix.ls || 'ls -lh' }} dist/ diff --git a/Cargo.lock b/Cargo.lock index f3015459..b61bf83f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -14,6 +14,15 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "cc" +version = "1.0.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +dependencies = [ + "libc", +] + [[package]] name = "cfg-if" version = "1.0.0" @@ -60,11 +69,17 @@ dependencies = [ "libc", ] +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + [[package]] name = "indoc" -version = "1.0.9" +version = "2.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa799dd5ed20a7e349f3b4639aa80d74549c81716d9ec4f994c9b5815598306" +checksum = "1e186cfbae8084e513daff4240b4797e342f988cecda4fb6c939150f96315fd8" [[package]] name = "inotify" @@ -210,9 +225,9 @@ dependencies = [ [[package]] name = "pyo3" -version = "0.19.2" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e681a6cfdc4adcc93b4d3cf993749a4552018ee0a9b65fc0ccfad74352c72a38" +checksum = "04e8453b658fe480c3e70c8ed4e3d3ec33eb74988bd186561b0cc66b85c3bc4b" dependencies = [ "cfg-if", "indoc", @@ -227,19 +242,20 @@ dependencies = [ [[package]] name = "pyo3-build-config" -version = "0.19.2" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "076c73d0bc438f7a4ef6fdd0c3bb4732149136abd952b110ac93e4edb13a6ba5" +checksum = "a96fe70b176a89cff78f2fa7b3c930081e163d5379b4dcdf993e3ae29ca662e5" dependencies = [ "once_cell", + "python3-dll-a", "target-lexicon", ] [[package]] name = "pyo3-ffi" -version = "0.19.2" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e53cee42e77ebe256066ba8aa77eff722b3bb91f3419177cf4cd0f304d3284d9" +checksum = "214929900fd25e6604661ed9cf349727c8920d47deff196c4e28165a6ef2a96b" dependencies = [ "libc", "pyo3-build-config", @@ -247,9 +263,9 @@ dependencies = [ [[package]] name = "pyo3-macros" -version = "0.19.2" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfeb4c99597e136528c6dd7d5e3de5434d1ceaf487436a3f03b2d56b6fc9efd1" +checksum = "dac53072f717aa1bfa4db832b39de8c875b7c7af4f4a6fe93cdbf9264cf8383b" dependencies = [ "proc-macro2", "pyo3-macros-backend", @@ -259,15 +275,25 @@ dependencies = [ [[package]] name = "pyo3-macros-backend" -version = "0.19.2" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "947dc12175c254889edc0c02e399476c2f652b4b9ebd123aa655c224de259536" +checksum = "7774b5a8282bd4f25f803b1f0d945120be959a36c72e08e7cd031c792fdfd424" dependencies = [ + "heck", "proc-macro2", "quote", "syn", ] +[[package]] +name = "python3-dll-a" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5f07cd4412be8fa09a721d40007c483981bbe072cd6a21f2e83e04ec8f8343f" +dependencies = [ + "cc", +] + [[package]] name = "quote" version = "1.0.26" @@ -309,9 +335,9 @@ checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" [[package]] name = "syn" -version = "1.0.109" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +checksum = "79d9531f94112cfc3e4c8f5f02cb2b58f72c97b7efd85f70203cc6d8efda5927" dependencies = [ "proc-macro2", "quote", @@ -332,9 +358,9 @@ checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" [[package]] name = "unindent" -version = "0.1.11" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1766d682d402817b5ac4490b3c3002d91dfa0d22812f341609f97b08757359c" +checksum = "c7de7d73e1754487cb58364ee906a499937a0dfabd86bcb980fa99ec8c8fa2ce" [[package]] name = "walkdir" diff --git a/Cargo.toml b/Cargo.toml index 72cd0316..8a04c470 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,7 +25,7 @@ include = [ [dependencies] crossbeam-channel = "0.5.4" notify = "5.0.0" -pyo3 = {version = "0.19.2", features = ["extension-module", "abi3-py37"]} +pyo3 = {version = "=0.20", features = ["extension-module", "generate-import-lib"]} [lib] name = "_rust_notify" diff --git a/README.md b/README.md index 8b14c000..c511e724 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ see [the migration guide](https://watchfiles.helpmanual.io/migrating/) for more ## Installation -**watchfiles** requires Python 3.7 - 3.10. +**watchfiles** requires Python 3.8 - 3.12. ```bash pip install watchfiles @@ -32,7 +32,7 @@ pip install watchfiles Binaries are available for: * **Linux**: `x86_64`, `aarch64`, `i686`, `armv7l`, `musl-x86_64` & `musl-aarch64` -* **MacOS**: `x86_64` & `arm64` (except python 3.7) +* **MacOS**: `x86_64` & `arm64` * **Windows**: `amd64` & `win32` Otherwise, you can install from source which requires Rust stable to be installed. diff --git a/pyproject.toml b/pyproject.toml index 8f9e2429..aadd56b7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = 'maturin' [project] name = 'watchfiles' -requires-python = '>=3.7' +requires-python = '>=3.8' description = 'Simple, modern and high performance file watching and code reload in python.' authors = [ {name ='Samuel Colvin', email = 's@muelcolvin.com'}, @@ -18,11 +18,11 @@ classifiers = [ 'Programming Language :: Python', 'Programming Language :: Python :: 3', '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', 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', 'Intended Audience :: Developers', 'Intended Audience :: Information Technology', 'Intended Audience :: System Administrators', diff --git a/requirements/testing.txt b/requirements/testing.txt index 2d6b1789..efa7bdcf 100644 --- a/requirements/testing.txt +++ b/requirements/testing.txt @@ -1,11 +1,9 @@ # -# This file is autogenerated by pip-compile with python 3.10 -# To update, run: +# This file is autogenerated by pip-compile with Python 3.10 +# by the following command: # # pip-compile --output-file=requirements/testing.txt requirements/testing.in # -attrs==22.1.0 - # via pytest commonmark==0.9.1 # via rich coverage==6.4.4 @@ -18,13 +16,11 @@ packaging==21.3 # via pytest pluggy==1.0.0 # via pytest -py==1.11.0 - # via pytest pygments==2.15.0 # via rich pyparsing==3.0.9 # via packaging -pytest==7.1.3 +pytest==7.4.2 # via # -r testing.in # pytest-mock diff --git a/tests/test_rust_notify.py b/tests/test_rust_notify.py index 4366cf87..20cd44a0 100644 --- a/tests/test_rust_notify.py +++ b/tests/test_rust_notify.py @@ -1,3 +1,4 @@ +import os import sys from pathlib import Path from typing import TYPE_CHECKING @@ -311,10 +312,12 @@ def test_polling_repr(test_dir: Path): @skip_unless_linux def test_ignore_permission_denied(): - RustNotify(['/'], False, False, 0, True, True) + path = os.getenv('WATCHFILES_TEST_PERMISSION_DENIED_PATH') or '/' + + RustNotify([path], False, False, 0, True, True) with pytest.raises(PermissionError): - RustNotify(['/'], False, False, 0, True, False) + RustNotify([path], False, False, 0, True, False) @pytest.mark.parametrize(