diff --git a/.github/workflows/build-pyfixest.yml b/.github/workflows/build-pyfixest.yml new file mode 100644 index 000000000000..1b8473f57a09 --- /dev/null +++ b/.github/workflows/build-pyfixest.yml @@ -0,0 +1,141 @@ +# SPDX-FileCopyrightText: 2026 The RISE Project +# SPDX-License-Identifier: MIT +--- +# This workflow is based on the `linux` job of +# https://github.com/py-econometrics/pyfixest/blob/v0.60.0/.github/workflows/build-and-release.yaml +name: Build pyfixest wheels (riscv64) + +on: + workflow_dispatch: + inputs: + version: + description: 'Version glob to (re)build; empty builds every version of docs/packages/pyfixest.yaml not released yet' + required: false + default: '' + pull_request: + branches: [main] + paths: + - '.github/workflows/build-pyfixest.yml' + - 'docs/packages/pyfixest.yaml' + push: + branches: [main] + paths: + - '.github/workflows/build-pyfixest.yml' + - 'docs/packages/pyfixest.yaml' + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +permissions: + contents: read # to fetch code (actions/checkout) + +env: + MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 + +jobs: + setup: + uses: $/.github/workflows/_setup.yml + with: + package: pyfixest + version: ${{ inputs.version }} + + build_wheels: + needs: [setup] + if: needs.setup.outputs.versions != '[]' + name: Build pyfixest ${{ matrix.version }} ${{ matrix.python }}-manylinux_riscv64 + runs-on: ubuntu-24.04-riscv + timeout-minutes: 180 + strategy: + fail-fast: false + matrix: + version: ${{ fromJSON(needs.setup.outputs.versions) }} + # pyo3 has no abi3 feature enabled here, so upstream builds and + # publishes one wheel per interpreter (cp310-cp314, cp313t/cp314t, + # pypy3.10/3.11); pypy is dropped (this repo doesn't build PyPy + # wheels) and musllinux with it (rustup.rs ships no riscv64 musl + # toolchain). cp310/cp311 are dropped to match this repo's default + # interpreter matrix (numpy 2.5.0+ sets 3.12 as its floor). cp313t + # is dropped because cibuildwheel 4.2.0 has no cp313t build + # identifier on any platform (CLAUDE.md gotcha 204). cp314t is + # dropped because pandas, a runtime requirement, has no + # free-threaded riscv64 wheel anywhere. + python: ["cp312", "cp313", "cp314"] + + env: + PYFIXEST_VERSION: ${{ matrix.version }} + + steps: + - name: Checkout pyfixest v${{ env.PYFIXEST_VERSION }} + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: py-econometrics/pyfixest + ref: v${{ env.PYFIXEST_VERSION }} + persist-credentials: false + + - name: Build wheels + uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 + with: + only: ${{ matrix.python }}-manylinux_riscv64 + output-dir: wheelhouse/ + env: + CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} + # pyfixest ships no [tool.cibuildwheel], so the Rust toolchain its + # maturin backend needs is installed in-container here. + CIBW_BEFORE_ALL_LINUX: >- + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + CIBW_ENVIRONMENT_LINUX: >- + PATH="$PATH:$HOME/.cargo/bin" + PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ + PIP_ONLY_BINARY=numpy,scipy,pandas,matplotlib,duckdb,pillow,polars-runtime-32,pyarrow + CIBW_TEST_REQUIRES: pytest pytest-xdist pytest-benchmark duckdb matplotlib polars pyarrow + CIBW_TEST_SOURCES: tests benchmarks pyfixest/did/data + # test_collinearity.py, test_count_fixef_fully_nested.py, + # test_demean.py and test_detect_singletons.py import pyfixest's + # numba/jax backends at module scope, and the jax-named tests and + # test_wildboottest.py/test_rwolf_error (wildboottest needs numba) + # call them; neither has a riscv64 wheel anywhere, nor a port in + # this repo. test_batched_lsmr.py and test_lsmr_compiled.py import + # torch, which has no riscv64 wheel either. test_quantreg.py needs + # statsmodels, which has no riscv64 wheel for cp314 (CLAUDE.md + # gotcha 84). test_check_version.py tests upstream's release script + # under .github/, not the wheel. test_errors_etable expects the + # AssertionError of upstream's locked maketables 0.1.8; 0.2.0 + # raises ValueError. + CIBW_TEST_COMMAND: >- + python -c "import pyfixest.core._core_impl as m; assert m.__file__.endswith('.so'), m.__file__" + && python -m pytest -v tests -n auto + -m "not (extended or against_r_core or against_r_extended or plots or hac)" + -k "not (jax or test_rwolf_error or test_errors_etable)" + --ignore tests/test_batched_lsmr.py + --ignore tests/test_check_version.py + --ignore tests/test_collinearity.py + --ignore tests/test_count_fixef_fully_nested.py + --ignore tests/test_demean.py + --ignore tests/test_detect_singletons.py + --ignore tests/test_lsmr_compiled.py + --ignore tests/test_quantreg.py + --ignore tests/test_wildboottest.py + + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: pyfixest-${{ env.PYFIXEST_VERSION }}-${{ matrix.python }}-manylinux_riscv64 + path: wheelhouse/*.whl + if-no-files-found: error + + publish: + name: Publish pyfixest ${{ matrix.version }} + needs: [setup, build_wheels] + if: needs.setup.outputs.versions != '[]' + strategy: + fail-fast: false + matrix: + version: ${{ fromJSON(needs.setup.outputs.versions) }} + permissions: + contents: write + pull-requests: write + uses: $/.github/workflows/_publish-wheel.yml + secrets: + app-private-key: ${{ secrets.RISEPROJECT_APP_PRIVATE_KEY }} + with: + artifact-pattern: pyfixest-${{ matrix.version }}-*-manylinux_riscv64 diff --git a/docs/packages/pyfixest.yaml b/docs/packages/pyfixest.yaml new file mode 100644 index 000000000000..5fafac63bc8d --- /dev/null +++ b/docs/packages/pyfixest.yaml @@ -0,0 +1,5 @@ +package-name: pyfixest +source-code: https://github.com/py-econometrics/pyfixest +license: MIT License +versions: +- version: 0.60.0