Skip to content

Freethreading - module markers + CI #275

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 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
20 changes: 11 additions & 9 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ jobs:
version: "0.4.x"

- name: Install Python versions
run: uv python install 3.9 3.10 3.11 3.12 3.13 pypy3.10
run: uv python install 3.9 3.10 3.11 3.12 3.13 pypy3.10 3.13t

- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
# As of Nov 2024, it was necessary to manually specify -i 3.13 to get
# maturin to find the executable. --find-interpreter did not find it.
args: --release --out dist -i 3.9 -i 3.10 -i 3.11 -i 3.12 -i 3.13 -i pypy3.10 --manifest-path ${{ matrix.module }}/Cargo.toml
args: --release --out dist -i 3.9 -i 3.10 -i 3.11 -i 3.12 -i 3.13 -i pypy3.10 -i 3.13t --manifest-path ${{ matrix.module }}/Cargo.toml
sccache: "true"
manylinux: ${{ matrix.platform.manylinux }}

Expand Down Expand Up @@ -101,13 +101,13 @@ jobs:
version: "0.4.x"

- name: Install Python versions
run: uv python install 3.9 3.10 3.11 3.12 3.13 pypy3.10
run: uv python install 3.9 3.10 3.11 3.12 3.13 pypy3.10 3.13t

- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist -i 3.9 -i 3.10 -i 3.11 -i 3.12 -i 3.13 -i pypy3.10 --manifest-path ${{ matrix.module }}/Cargo.toml
args: --release --out dist -i 3.9 -i 3.10 -i 3.11 -i 3.12 -i 3.13 -i pypy3.10 -i 3.13t --manifest-path ${{ matrix.module }}/Cargo.toml
sccache: "true"
manylinux: musllinux_1_2
- name: Upload wheels
Expand All @@ -130,15 +130,17 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
- uses: Quansight-Labs/setup-python@v5
with:
python-version: 3.13
python-version: |
3.13t
3.13

- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist -i 3.9 -i 3.10 -i 3.11 -i 3.12 -i 3.13 --manifest-path ${{ matrix.module }}/Cargo.toml
args: --release --out dist -i 3.9 -i 3.10 -i 3.11 -i 3.12 -i 3.13 -i 3.13t --manifest-path ${{ matrix.module }}/Cargo.toml
sccache: "true"
- name: Upload wheels
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -169,13 +171,13 @@ jobs:
version: "0.4.x"

- name: Install Python versions
run: uv python install 3.9 3.10 3.11 3.12 3.13 pypy3.10
run: uv python install 3.9 3.10 3.11 3.12 3.13 pypy3.10 3.13t

- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist -i 3.9 -i 3.10 -i 3.11 -i 3.12 -i 3.13 -i pypy3.10 --manifest-path ${{ matrix.module }}/Cargo.toml
args: --release --out dist -i 3.9 -i 3.10 -i 3.11 -i 3.12 -i 3.13 -i pypy3.10 -i 3.13t --manifest-path ${{ matrix.module }}/Cargo.toml
sccache: "true"
- name: Upload wheels
uses: actions/upload-artifact@v4
Expand Down
6 changes: 3 additions & 3 deletions Cargo.lock

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

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ arrow-select = "54"
bytes = "1.7.0"
half = "2"
indexmap = "2"
numpy = "0.23"
# numpy = "0.23"
numpy = { git = "https://github.com/PyO3/rust-numpy.git", rev = "8dd4f8e2934126a8323b8c8f00e69b0182b8ecee" }
object_store = "0.11"
parquet = "54"
pyo3 = { version = "0.23", features = ["macros", "indexmap"] }
Expand Down
2 changes: 1 addition & 1 deletion arro3-compute/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fn check_debug_build(py: Python) -> PyResult<()> {
Ok(())
}

#[pymodule]
#[pymodule(gil_used = false)]
fn _compute(py: Python, m: &Bound<PyModule>) -> PyResult<()> {
check_debug_build(py)?;

Expand Down
2 changes: 1 addition & 1 deletion arro3-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ fn check_debug_build(py: Python) -> PyResult<()> {
}

/// A Python module implemented in Rust.
#[pymodule]
#[pymodule(gil_used = false)]
fn _core(py: Python, m: &Bound<PyModule>) -> PyResult<()> {
check_debug_build(py)?;

Expand Down
2 changes: 1 addition & 1 deletion arro3-io/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ fn check_debug_build(py: Python) -> PyResult<()> {
Ok(())
}

#[pymodule]
#[pymodule(gil_used = false)]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this will always be true for the IO module. E.g. I might want to allow a Python HTTP library like aiohttp to be used for making the parquet file reads

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, if unmodified (as in, rust locking structures cfg-gated on Py_GIL_DISABLED) - there isn't code that allows that quite yet, right?

I should definitely take a crack at pytest-freethread in general before this is merged (at the very least CI for a single test in pyo3-arrow or core).

Thinking about it, pretty much all users of the freethreading build at the moment are other library maintainers porting their package to freethreading - this is probably a rare instance (especially given the main dependant is geoarrow.rust.io) where hard concurrency errors are preferred over RuntimeWarning .

fn _io(py: Python, m: &Bound<PyModule>) -> PyResult<()> {
check_debug_build(py)?;

Expand Down
Loading
Loading