Skip to content

Commit

Permalink
Support free-threaded wheel (#31)
Browse files Browse the repository at this point in the history
* FEAT support nogil wheels
  • Loading branch information
MatthewSZhang authored Jan 6, 2025
1 parent 8306e04 commit b4445d6
Show file tree
Hide file tree
Showing 4 changed files with 1,045 additions and 342 deletions.
117 changes: 60 additions & 57 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,62 +3,61 @@ name: CI
on:
workflow_call:
push:
branches: [ "main" ]
branches: ["main"]
pull_request:
branches: [ "main" ]
branches: ["main"]

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: prefix-dev/setup-pixi@v0.8.1
with:
environments: default
cache: true
- uses: actions/checkout@v4
- uses: prefix-dev/setup-pixi@v0.8.1
with:
environments: default
cache: true

- name: Re-install local
run: |
pixi run rebuild
- name: Lint with ruff
run: |
pixi run lint
- name: Lint with cython-lint
run: |
pixi run cython-lint
- name: Format with black
run: |
pixi run fmt
- name: Type check with mypy
run: |
pixi run type
- name: Test with pytest
run: |
pixi run test
- name: Test with doctest
shell: bash
run: |
pixi run doc
CMD=doctest pixi run doc
- name: Test coverage
shell: bash
run: |
FMT=xml pixi run test-coverage
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Build SDist
run: |
pixi run build-sdist
- name: Store artifacts
uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz
- name: Re-install local
run: |
pixi run rebuild
- name: Lint with ruff
run: |
pixi run lint
- name: Lint with cython-lint
run: |
pixi run cython-lint
- name: Format with black
run: |
pixi run fmt
- name: Type check with mypy
run: |
pixi run type
- name: Test with pytest
run: |
pixi run test
- name: Test with doctest
shell: bash
run: |
pixi run doc
CMD=doctest pixi run doc
- name: Test coverage
shell: bash
run: |
FMT=xml pixi run test-coverage
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Build SDist
run: |
pixi run build-sdist
- name: Store artifacts
uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz

build:
strategy:
Expand All @@ -68,13 +67,13 @@ jobs:
runs-on: ${{ matrix.os }}
needs: test
steps:
- uses: actions/checkout@v4
- name: Build wheels
uses: pypa/cibuildwheel@v2.21.3
env:
- uses: actions/checkout@v4
- name: Build wheels
uses: pypa/cibuildwheel@v2.22.0
env:
CIBW_BUILD: cp3*-*
CIBW_SKIP: pp* *i686* *musllinux* *-macosx_universal2 *-manylinux_ppc64le *-manylinux_s390x
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.9"
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.10"
CIBW_ARCHS_LINUX: auto64
CIBW_ARCHS_MACOS: x86_64 arm64
CIBW_ARCHS_WINDOWS: auto64
Expand All @@ -85,8 +84,12 @@ jobs:
# otherwise Meson detects a MINGW64 platform and use MINGW64
# toolchain
CIBW_CONFIG_SETTINGS_WINDOWS: "setup-args=--vsenv"
- name: Upload package
uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl
# Include free-threaded support
CIBW_ENABLE: cpython-freethreading
# Numpy, scipy, Cython only have free-threaded wheels on scientific-python-nightly-wheels
CIBW_BUILD_FRONTEND: 'pip; args: --pre --extra-index-url "https://pypi.anaconda.org/scientific-python-nightly-wheels/simple" --only-binary :all:'
- name: Upload package
uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl
15 changes: 14 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,26 @@ array([1, 0], dtype=int32)
array([0.91162413, 0.71089547])
>>> # Here Feature 2 must be included
>>> selector = FastCan(n_features_to_select=2, indices_include=[2], verbose=0).fit(X, y)
>>> # We can find the feature which is useful when working with Feature 2
>>> # We can find the feature which is useful when working with Feature 2
>>> selector.indices_
array([2, 0], dtype=int32)
>>> selector.scores_
array([0.34617598, 0.95815008])


NARX Time Series Modelling
--------------------------
FastCan can be used for system identification.
In particular, we provide a submodule `fastcan.narx` to build Nonlinear AutoRegressive eXogenous (NARX) models.
For more information, check our `Home Page <https://fastcan.readthedocs.io/en/latest/?badge=latest>`_.


Support Free-Threaded Wheels
----------------------------
FastCan has support for free-threaded (also known as nogil) CPython 3.13.
For more information about free-threaded CPython, check `how to install a free-threaded CPython <https://py-free-threading.github.io/installing_cpython/>`_.


Citation
--------

Expand Down
Loading

0 comments on commit b4445d6

Please sign in to comment.