Skip to content

Commit

Permalink
Add Python 3.12 support, drop Python 3.7 support (#248)
Browse files Browse the repository at this point in the history
* Add Python 3.12 support, drop Python 3.7 support

* Bump pytest

* test: use specific path for premission denied
  • Loading branch information
gi0baro authored Oct 13, 2023
1 parent eb0df3a commit 6ea19ca
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 33 deletions.
20 changes: 17 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -200,15 +214,15 @@ 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 }}
uses: messense/maturin-action@v1
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/

Expand Down
58 changes: 42 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '[email protected]'},
Expand All @@ -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',
Expand Down
10 changes: 3 additions & 7 deletions requirements/testing.txt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
7 changes: 5 additions & 2 deletions tests/test_rust_notify.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import sys
from pathlib import Path
from typing import TYPE_CHECKING
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 6ea19ca

Please sign in to comment.