Skip to content

Commit b4445d6

Browse files
Support free-threaded wheel (#31)
* FEAT support nogil wheels
1 parent 8306e04 commit b4445d6

File tree

4 files changed

+1045
-342
lines changed

4 files changed

+1045
-342
lines changed

.github/workflows/ci.yml

Lines changed: 60 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -3,62 +3,61 @@ name: CI
33
on:
44
workflow_call:
55
push:
6-
branches: [ "main" ]
6+
branches: ["main"]
77
pull_request:
8-
branches: [ "main" ]
8+
branches: ["main"]
99

1010
jobs:
1111
test:
1212
runs-on: ubuntu-latest
1313

1414
steps:
15-
- uses: actions/checkout@v4
16-
- uses: prefix-dev/[email protected]
17-
with:
18-
environments: default
19-
cache: true
15+
- uses: actions/checkout@v4
16+
- uses: prefix-dev/[email protected]
17+
with:
18+
environments: default
19+
cache: true
2020

21-
- name: Re-install local
22-
run: |
23-
pixi run rebuild
24-
25-
- name: Lint with ruff
26-
run: |
27-
pixi run lint
28-
- name: Lint with cython-lint
29-
run: |
30-
pixi run cython-lint
31-
- name: Format with black
32-
run: |
33-
pixi run fmt
34-
- name: Type check with mypy
35-
run: |
36-
pixi run type
37-
- name: Test with pytest
38-
run: |
39-
pixi run test
40-
- name: Test with doctest
41-
shell: bash
42-
run: |
43-
pixi run doc
44-
CMD=doctest pixi run doc
45-
- name: Test coverage
46-
shell: bash
47-
run: |
48-
FMT=xml pixi run test-coverage
49-
- name: Upload coverage reports to Codecov
50-
uses: codecov/codecov-action@v5
51-
with:
52-
token: ${{ secrets.CODECOV_TOKEN }}
53-
- name: Build SDist
54-
run: |
55-
pixi run build-sdist
56-
- name: Store artifacts
57-
uses: actions/upload-artifact@v4
58-
with:
59-
name: cibw-sdist
60-
path: dist/*.tar.gz
21+
- name: Re-install local
22+
run: |
23+
pixi run rebuild
6124
25+
- name: Lint with ruff
26+
run: |
27+
pixi run lint
28+
- name: Lint with cython-lint
29+
run: |
30+
pixi run cython-lint
31+
- name: Format with black
32+
run: |
33+
pixi run fmt
34+
- name: Type check with mypy
35+
run: |
36+
pixi run type
37+
- name: Test with pytest
38+
run: |
39+
pixi run test
40+
- name: Test with doctest
41+
shell: bash
42+
run: |
43+
pixi run doc
44+
CMD=doctest pixi run doc
45+
- name: Test coverage
46+
shell: bash
47+
run: |
48+
FMT=xml pixi run test-coverage
49+
- name: Upload coverage reports to Codecov
50+
uses: codecov/codecov-action@v5
51+
with:
52+
token: ${{ secrets.CODECOV_TOKEN }}
53+
- name: Build SDist
54+
run: |
55+
pixi run build-sdist
56+
- name: Store artifacts
57+
uses: actions/upload-artifact@v4
58+
with:
59+
name: cibw-sdist
60+
path: dist/*.tar.gz
6261

6362
build:
6463
strategy:
@@ -68,13 +67,13 @@ jobs:
6867
runs-on: ${{ matrix.os }}
6968
needs: test
7069
steps:
71-
- uses: actions/checkout@v4
72-
- name: Build wheels
73-
uses: pypa/cibuildwheel@v2.21.3
74-
env:
70+
- uses: actions/checkout@v4
71+
- name: Build wheels
72+
uses: pypa/cibuildwheel@v2.22.0
73+
env:
7574
CIBW_BUILD: cp3*-*
7675
CIBW_SKIP: pp* *i686* *musllinux* *-macosx_universal2 *-manylinux_ppc64le *-manylinux_s390x
77-
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.9"
76+
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.10"
7877
CIBW_ARCHS_LINUX: auto64
7978
CIBW_ARCHS_MACOS: x86_64 arm64
8079
CIBW_ARCHS_WINDOWS: auto64
@@ -85,8 +84,12 @@ jobs:
8584
# otherwise Meson detects a MINGW64 platform and use MINGW64
8685
# toolchain
8786
CIBW_CONFIG_SETTINGS_WINDOWS: "setup-args=--vsenv"
88-
- name: Upload package
89-
uses: actions/upload-artifact@v4
90-
with:
91-
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
92-
path: ./wheelhouse/*.whl
87+
# Include free-threaded support
88+
CIBW_ENABLE: cpython-freethreading
89+
# Numpy, scipy, Cython only have free-threaded wheels on scientific-python-nightly-wheels
90+
CIBW_BUILD_FRONTEND: 'pip; args: --pre --extra-index-url "https://pypi.anaconda.org/scientific-python-nightly-wheels/simple" --only-binary :all:'
91+
- name: Upload package
92+
uses: actions/upload-artifact@v4
93+
with:
94+
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
95+
path: ./wheelhouse/*.whl

README.rst

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,26 @@ array([1, 0], dtype=int32)
7373
array([0.91162413, 0.71089547])
7474
>>> # Here Feature 2 must be included
7575
>>> selector = FastCan(n_features_to_select=2, indices_include=[2], verbose=0).fit(X, y)
76-
>>> # We can find the feature which is useful when working with Feature 2
76+
>>> # We can find the feature which is useful when working with Feature 2
7777
>>> selector.indices_
7878
array([2, 0], dtype=int32)
7979
>>> selector.scores_
8080
array([0.34617598, 0.95815008])
8181

8282

83+
NARX Time Series Modelling
84+
--------------------------
85+
FastCan can be used for system identification.
86+
In particular, we provide a submodule `fastcan.narx` to build Nonlinear AutoRegressive eXogenous (NARX) models.
87+
For more information, check our `Home Page <https://fastcan.readthedocs.io/en/latest/?badge=latest>`_.
88+
89+
90+
Support Free-Threaded Wheels
91+
----------------------------
92+
FastCan has support for free-threaded (also known as nogil) CPython 3.13.
93+
For more information about free-threaded CPython, check `how to install a free-threaded CPython <https://py-free-threading.github.io/installing_cpython/>`_.
94+
95+
8396
Citation
8497
--------
8598

0 commit comments

Comments
 (0)