Skip to content
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
14 changes: 7 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
name: Test

# note: when updating the matrix, make sure the `workflow_dispatch` and `generate-matrix` entries match

on:
workflow_dispatch:
inputs:
Expand All @@ -15,13 +17,12 @@ on:
python_version:
type: choice
description: Python version to test with
default: '3.12'
default: '3.13'
options:
- 'all'
- '3.9'
- '3.10'
- '3.11'
- '3.12'
- '3.13t'
- '3.13'
- 'pypy3.9'
- 'pypy3.10'
test_specification:
Expand Down Expand Up @@ -57,9 +58,8 @@ jobs:
- windows-latest
PYTHON_VERSION: |
- '3.9'
- '3.10'
- '3.11'
- '3.12'
- '3.13t'
- '3.13'
- 'pypy3.9'
- 'pypy3.10'
steps:
Expand Down
2 changes: 1 addition & 1 deletion Contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@ a PR, but generally stick to conforming to the suggested linter rules.
2. Update `Changelog.md` to reflect the new changes.
3. Check out the commit you want to make a release from.
4. Run `git tag <version>` e.g. `git tag v0.1.0`.
5. Run `git push origin <version>` e.g. `git tag v0.1.0`.
5. Run `git push origin <version>` e.g. `git push origin v0.1.0`.
- This will trigger the 'release' github action which will upload to PyPi.
13 changes: 12 additions & 1 deletion tests/test_import_hook/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import shutil
import subprocess
import sys
import sysconfig
import tempfile
import time
from collections.abc import Iterator
Expand All @@ -22,7 +23,10 @@

# the CI does not have enough space to keep the outputs.
# When running locally you may set this to False for debugging
CLEAR_WORKSPACE = False
CLEAR_WORKSPACE = True

# https://docs.python.org/3/howto/free-threading-python.html#identifying-free-threaded-python
IS_FREE_THREADED = sysconfig.get_config_var("Py_GIL_DISABLED")

MATURIN_DIR = (script_dir / "../maturin").resolve()
TEST_CRATES_DIR = MATURIN_DIR / "test-crates"
Expand All @@ -33,6 +37,13 @@
"pyo3-bin", # not imported as a python module (subprocess only)
"workspace-inverted-order", # this directory is not a maturin package, only the subdirectory
}
# these test-crates do not work with free-threaded python
# (to verify: run `maturin develop` to install them into an appropriate virtualenv and try to run the
# corresponding `check_installed.py` script)
if IS_FREE_THREADED:
IGNORED_TEST_CRATES |= {
"pyo3-ffi-pure",
}


IMPORT_HOOK_HEADER = """
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use pyo3::prelude::*;
#[pyfunction]
fn get_num() -> usize { 10 }

#[pymodule]
#[pymodule(gil_used = false)]
fn my_script(m: &Bound<'_, PyModule>) -> PyResult<()> {
m.add_function(wrap_pyfunction!(get_num, m)?)?;
Ok(())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ fn get_num() -> usize { 20 }
#[pyfunction]
fn get_other_num() -> usize { 100 }

#[pymodule]
#[pymodule(gil_used = false)]
fn my_script(m: &Bound<'_, PyModule>) -> PyResult<()> {
m.add_function(wrap_pyfunction!(get_num, m)?)?;
m.add_function(wrap_pyfunction!(get_other_num, m)?)?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ fn get_num() -> usize {
}
}

#[pymodule]
#[pymodule(gil_used = false)]
fn my_script(m: &Bound<'_, PyModule>) -> PyResult<()> {
m.add_function(wrap_pyfunction!(get_num, m)?)?;
Ok(())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ fn register_child_module(py: Python<'_>, parent_module: &Bound<'_, PyModule>) ->
Ok(())
}

#[pymodule]
#[pymodule(gil_used = false)]
fn my_module(py: Python, m: &Bound<'_, PyModule>) -> PyResult<()> {
m.add_function(wrap_pyfunction!(get_num, m)?)?;
m.add_function(wrap_pyfunction!(get_global_num, m)?)?;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use pyo3::prelude::*;

#[pymodule]
#[pymodule(gil_used = false)]
fn blank_project(_m: &Bound<'_, PyModule>) -> PyResult<()> {
Ok(())
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fn get_num() -> usize {
}
}

#[pymodule]
#[pymodule(gil_used = false)]
fn my_project(m: &Bound<'_, PyModule>) -> PyResult<()> {
m.add_wrapped(wrap_pyfunction!(get_num))?;
Ok(())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ fn register_child_module(py: Python<'_>, parent_module: &Bound<'_, PyModule>) ->
Ok(())
}

#[pymodule]
#[pymodule(gil_used = false)]
fn my_project(py: Python, m: &Bound<'_, PyModule>) -> PyResult<()> {
m.add_wrapped(wrap_pyfunction!(get_num))?;
m.add_wrapped(wrap_pyfunction!(get_global_num))?;
Expand Down
Loading