Skip to content

Commit e493e75

Browse files
authored
Bump PyO3 to 0.23, drop Python 3.8 support (#307)
1 parent 6e3c2c8 commit e493e75

File tree

5 files changed

+33
-22
lines changed

5 files changed

+33
-22
lines changed

.github/workflows/ci.yml

+7-3
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,14 @@ jobs:
1717
os: [ubuntu, macos, windows]
1818
rust-version: [stable, '1.72']
1919
python-version:
20-
- '3.8'
2120
- '3.9'
2221
- '3.10'
2322
- '3.11'
2423
- '3.12'
2524
- '3.13'
26-
- 'pypy3.8'
25+
# NOTE: gha setup-python doesn't support 3.13t yet
26+
# (https://github.com/actions/setup-python/pull/973)
27+
# - '3.13t'
2728
- 'pypy3.9'
2829
- 'pypy3.10'
2930
exclude:
@@ -218,7 +219,10 @@ jobs:
218219
with:
219220
target: ${{ matrix.target }}
220221
manylinux: ${{ matrix.manylinux || 'auto' }}
221-
args: --release --out dist --interpreter ${{ matrix.interpreter || '3.8 3.9 3.10 3.11 3.12 3.13' }}
222+
# NOTE: gha setup-python doesn't support 3.13t yet
223+
# (https://github.com/actions/setup-python/pull/973)
224+
# args: --release --out dist --interpreter ${{ matrix.interpreter || '3.9 3.10 3.11 3.12 3.13 3.13t' }}
225+
args: --release --out dist --interpreter ${{ matrix.interpreter || '3.9 3.10 3.11 3.12 3.13' }}
222226

223227
- name: build pypy wheels
224228
if: ${{ matrix.pypy }}

Cargo.lock

+10-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ rust-version = "1.63"
2626
[dependencies]
2727
crossbeam-channel = "0.5.12"
2828
notify = {git = "https://github.com/samuelcolvin/notify.git", branch = "keep-io-error"}
29-
pyo3 = { version = "0.22.2", features = ["extension-module", "generate-import-lib"] }
29+
pyo3 = { version = "=0.23", features = ["extension-module", "generate-import-lib"] }
3030

3131
[lib]
3232
name = "_rust_notify"

pyproject.toml

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = 'maturin'
44

55
[project]
66
name = 'watchfiles'
7-
requires-python = '>=3.8'
7+
requires-python = '>=3.9'
88
description = 'Simple, modern and high performance file watching and code reload in python.'
99
authors = [
1010
{name ='Samuel Colvin', email = 's@muelcolvin.com'},
@@ -18,7 +18,6 @@ classifiers = [
1818
'Programming Language :: Python',
1919
'Programming Language :: Python :: 3',
2020
'Programming Language :: Python :: 3 :: Only',
21-
'Programming Language :: Python :: 3.8',
2221
'Programming Language :: Python :: 3.9',
2322
'Programming Language :: Python :: 3.10',
2423
'Programming Language :: Python :: 3.11',

src/lib.rs

+14-6
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ impl RustNotify {
287287
Ok(_) => (),
288288
Err(_) => {
289289
slf.borrow().clear();
290-
return Ok(intern!(py, "signal").into_py(py));
290+
return Ok(intern!(py, "signal").as_any().to_owned().unbind());
291291
}
292292
};
293293

@@ -302,7 +302,7 @@ impl RustNotify {
302302
eprintln!("stop event set, stopping...");
303303
}
304304
slf.borrow().clear();
305-
return Ok(intern!(py, "stop").into_py(py));
305+
return Ok(intern!(py, "stop").as_any().to_owned().unbind());
306306
}
307307
}
308308

@@ -324,11 +324,19 @@ impl RustNotify {
324324
} else if let Some(max_time) = max_timeout_time {
325325
if SystemTime::now() > max_time {
326326
slf.borrow().clear();
327-
return Ok(intern!(py, "timeout").into_py(py));
327+
return Ok(intern!(py, "timeout").as_any().to_owned().unbind());
328328
}
329329
}
330330
}
331-
let py_changes = slf.borrow().changes.lock().unwrap().to_object(py);
331+
let py_changes = slf
332+
.borrow()
333+
.changes
334+
.lock()
335+
.unwrap()
336+
.to_owned()
337+
.into_pyobject(py)?
338+
.into_any()
339+
.unbind();
332340
slf.borrow().clear();
333341
Ok(py_changes)
334342
}
@@ -357,7 +365,7 @@ impl RustNotify {
357365
}
358366
}
359367

360-
#[pymodule]
368+
#[pymodule(gil_used = false)]
361369
fn _rust_notify(py: Python, m: &Bound<PyModule>) -> PyResult<()> {
362370
let mut version = env!("CARGO_PKG_VERSION").to_string();
363371
// cargo uses "1.0-alpha1" etc. while python uses "1.0.0a1", this is not full compatibility,
@@ -369,7 +377,7 @@ fn _rust_notify(py: Python, m: &Bound<PyModule>) -> PyResult<()> {
369377
m.add("__version__", version)?;
370378
m.add(
371379
"WatchfilesRustInternalError",
372-
py.get_type_bound::<WatchfilesRustInternalError>(),
380+
py.get_type::<WatchfilesRustInternalError>(),
373381
)?;
374382
m.add_class::<RustNotify>()?;
375383
Ok(())

0 commit comments

Comments
 (0)