Skip to content

Use POSIX paths for license metadata in wheels #1726

Use POSIX paths for license metadata in wheels

Use POSIX paths for license metadata in wheels #1726

Workflow file for this run

name: Build
on: [push, pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
# These values need to be kept in sync. Each Pyodide version pins an
# Emscripten version and a CPython version.
PYODIDE_VERSION: '314.0.0'
PYODIDE_EMSCRIPTEN_VERSION: '5.0.3'
PYODIDE_PYTHON_VERSION: '3.14'
jobs:
build_wheels:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
continue-on-error: true
strategy:
fail-fast: false
matrix:
include:
- name: Build manylinux x86-64 wheels
os: ubuntu-22.04
kind: native
artifact_name: wheels-ubuntu-22.04
cibw_platform: auto
cibw_build: "cp313-* cp314-* cp314t-* pp311-*"
cibw_config_settings: ""
- name: Build manylinux x86-64 stable ABI wheels
os: ubuntu-22.04
kind: stable-abi
artifact_name: wheels-ubuntu-22.04-abi3
cibw_platform: auto
cibw_build: "cp310-*"
cibw_config_settings: "setup-args=-Dpython.allow_limited_api=true"
- name: Build manylinux arm64 wheels
os: ubuntu-22.04-arm
kind: native
artifact_name: wheels-ubuntu-22.04-arm
cibw_platform: auto
cibw_build: "cp313-* cp314-* cp314t-* pp311-*"
cibw_config_settings: ""
- name: Build manylinux arm64 stable ABI wheels
os: ubuntu-22.04-arm
kind: stable-abi
artifact_name: wheels-ubuntu-22.04-arm-abi3
cibw_platform: auto
cibw_build: "cp310-*"
cibw_config_settings: "setup-args=-Dpython.allow_limited_api=true"
- name: Build Windows x86-64 wheels
os: windows-2022
kind: native
artifact_name: wheels-windows-2022
cibw_platform: auto
cibw_build: "cp313-* cp314-* cp314t-* pp311-*"
cibw_config_settings: "setup-args=--vsenv build-dir=build"
- name: Build Windows x86-64 stable ABI wheels
os: windows-2022
kind: stable-abi
artifact_name: wheels-windows-2022-abi3
cibw_platform: auto
cibw_build: "cp310-*"
cibw_config_settings: "setup-args=--vsenv setup-args=-Dpython.allow_limited_api=true build-dir=build"
- name: Build Windows arm64 wheels
os: windows-11-arm
kind: native
artifact_name: wheels-windows-11-arm
cibw_platform: auto
cibw_build: "cp313-* cp314-* cp314t-* pp311-*"
cibw_config_settings: "setup-args=--vsenv build-dir=build"
- name: Build Windows arm64 stable ABI wheels
os: windows-11-arm
kind: stable-abi
artifact_name: wheels-windows-11-arm-abi3
cibw_platform: auto
cibw_build: "cp310-*"
cibw_config_settings: "setup-args=--vsenv setup-args=-Dpython.allow_limited_api=true build-dir=build"
- name: Build macOS x86-64 wheels
os: macos-15-intel
kind: native
artifact_name: wheels-macos-15-intel
cibw_platform: auto
cibw_build: "cp313-* cp314-* cp314t-* pp311-*"
cibw_config_settings: ""
- name: Build macOS x86-64 stable ABI wheels
os: macos-15-intel
kind: stable-abi
artifact_name: wheels-macos-15-intel-abi3
cibw_platform: auto
cibw_build: "cp310-*"
cibw_config_settings: "setup-args=-Dpython.allow_limited_api=true"
- name: Build macOS arm64 wheels
os: macos-14
kind: native
artifact_name: wheels-macos-14
cibw_platform: auto
cibw_build: "cp313-* cp314-* cp314t-* pp311-*"
cibw_config_settings: ""
- name: Build macOS arm64 stable ABI wheels
os: macos-14
kind: stable-abi
artifact_name: wheels-macos-14-abi3
cibw_platform: auto
cibw_build: "cp310-*"
cibw_config_settings: "setup-args=-Dpython.allow_limited_api=true"
- name: Build Pyodide wheels
os: ubuntu-22.04
kind: pyodide
artifact_name: wheels-pyodide
cibw_platform: pyodide
cibw_build: "cp314-*"
cibw_config_settings: "build-dir=flint_wasm_build setup-args=-Dflint_version_check=false"
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- if: ${{ matrix.kind != 'pyodide' }}
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: '3.13'
# -------------- Windows stuff ---------------- #
- if: ${{ matrix.os == 'windows-2022' }}
uses: msys2/setup-msys2@66cd2cce69caa17b53920067426061ca1de3a884 # v2.32.0
with:
msystem: ucrt64
update: true
- if: ${{ matrix.os == 'windows-11-arm' }}
uses: msys2/setup-msys2@66cd2cce69caa17b53920067426061ca1de3a884 # v2.32.0
with:
msystem: clangarm64
update: true
# Install pkgconfig on Windows from choco rather than from msys and
# avoid using the Strawberry one.
- if: ${{ startsWith( matrix.os , 'windows' ) }}
run: choco install -y --stoponfirstfailure --checksum 6004DF17818F5A6DBF19CB335CC92702 pkgconfiglite
# We have to set this here rather than in the cibuildwheel config
# This is probably something to do with \ vs / in paths...
- if: ${{ startsWith( matrix.os , 'windows' ) }}
run: |
$pkgConfigPath = "$env:GITHUB_WORKSPACE/.local/lib/pkgconfig"
$pkgConfigPath = $pkgConfigPath.Replace('\', '/')
echo "PKG_CONFIG_PATH=$pkgConfigPath" >> $env:GITHUB_ENV
# ------------- pyodide ------------- #
- if: ${{ matrix.kind == 'pyodide' }}
name: Set up Emscripten toolchain
uses: pyodide/setup-emsdk@ca2dd8aef8c2a0e11743c5c36f0b430ddb694b5c # v15
with:
version: ${{ env.PYODIDE_EMSCRIPTEN_VERSION }}
actions-cache-folder: emsdk-cache
# ------------- actual build ------------- #
- name: Build wheels
uses: pypa/cibuildwheel@294735312765b09d24a2fbec22660ce817587d55 # v4.1.0
env:
CIBW_PLATFORM: ${{ matrix.cibw_platform }}
CIBW_BUILD: ${{ matrix.cibw_build }}
CIBW_CONFIG_SETTINGS: ${{ matrix.cibw_config_settings }}
CIBW_PYODIDE_VERSION: ${{ env.PYODIDE_VERSION }}
# override setting in pyproject.toml to use msys2 instead of msys64 bash
CIBW_BEFORE_ALL_WINDOWS: ${{ matrix.os == 'windows-11-arm' && 'msys2 -c bin/cibw_before_all_windows_arm64.sh' || 'msys2 -c bin/cibw_before_all_windows_amd64.sh' }}
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: ${{ matrix.artifact_name }}
path: wheelhouse/*.whl
build_sdist:
name: Build sdist
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: ${{ env.PYODIDE_PYTHON_VERSION }}
- run: bin/install_latest_flint_ubuntu.sh
- run: pip install build
- run: python -m build --sdist
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: sdist
path: dist/*.tar.gz
test_wheels:
needs: build_wheels
name: Test ${{ matrix.python-version }} wheel on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
permissions: {}
strategy:
fail-fast: false
matrix:
os: [
ubuntu-22.04,
ubuntu-24.04,
ubuntu-24.04-arm,
windows-2022,
windows-2025,
windows-11-arm,
macos-15-intel,
macos-14,
macos-15,
]
# This list to be kept in sync with python-requires in pyproject.toml.
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14', '3.14t', '3.15', 'pypy3.11']
exclude:
- os: windows-11-arm
python-version: '3.10'
- os: windows-11-arm
python-version: pypy3.11
steps:
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
path: wheelhouse
merge-multiple: true
- run: pip install --no-index --find-links wheelhouse python_flint
# Check if the GIL is disabled in the free-threading build after import.
- run: |
python --version --version
which python
python -c "import sysconfig; print(sysconfig.get_config_var('Py_GIL_DISABLED'))"
python -c "import sys; print(getattr(sys, '_is_gil_enabled', lambda: True)())"
python -c "import sys; import flint; print(getattr(sys, '_is_gil_enabled', lambda: True)())"
- run: python -m flint.test --verbose
test_pyodide:
needs: build_wheels
name: Test Pyodide wheel
runs-on: ubuntu-22.04
permissions: {}
steps:
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: ${{ env.PYODIDE_PYTHON_VERSION }}
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: '22'
- run: pip install pyodide-build
- run: pyodide xbuildenv install "$PYODIDE_VERSION"
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: wheels-pyodide
path: wheelhouse
- run: |
pyodide venv .venv-pyodide
source .venv-pyodide/bin/activate
pip install wheelhouse/*.whl
pip install pytest hypothesis
python -m pytest -svra -p no:cacheprovider --pyargs flint
# On new enough Ubuntu we can build against the system deb.
test_pip_flint_deb:
name: Build on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04]
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: '3.13'
- run: sudo apt-get update
- run: sudo apt-get install libflint-dev
- run: pip install .
- run: python -m flint.test --verbose
test_docs:
name: Test docs (build and doctest)
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: '3.13'
- run: bin/install_latest_flint_ubuntu.sh
- run: pip install --upgrade pip
- run: pip install -r requirements-dev.txt
- run: spin run -- pytest --doctest-glob='*.rst' doc/source
- run: spin docs
# Test build with minimum Cython and meson-python versions.
test_old_build_requires:
name: 'Test old Cython/meson-python'
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: '3.13'
- run: sudo apt-get update
- run: sudo apt-get install libflint-dev
# The versions of cython and meson-python here should be kept in sync
# with those in pyproject.toml so that we test the stated minimum
# versions.
#
# We don't need to specify ninja as a requirement in pyproject.toml
# because without --no-build-isolation meson-python handles it
# automatically in get_requirements_for_build_wheel().
- run: 'pip install "cython==3.0.11" "meson-python==0.18" "ninja<1.11"'
- run: pip install --no-build-isolation .
- run: python -m flint.test --verbose
# For older Ubuntu we have to build Flint >= 3.0.0
test_flint_releases:
name: Test flint ${{ matrix.flint-tag }}
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
# Supported Flint versions:
flint-tag: [
'v3.0.1',
'v3.1.3-p1',
'v3.2.2',
'v3.3.1',
'v3.4.0',
'v3.5.0',
]
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: '3.13'
- env:
FLINT_TAG: ${{ matrix.flint-tag }}
run: bin/install_flint_ubuntu.sh "$FLINT_TAG"
- run: pip install .
- run: python -m flint.test --verbose
# Test against flint main
test_flint_main:
name: Test flint main Linux x86-64
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: '3.13'
- run: bin/install_flint_ubuntu.sh main
# Need to disable flint version check to build against main
- run: pip install --config-settings=setup-args="-Dflint_version_check=false" .
- run: python -m flint.test --verbose
# Test against flint main
test_flint_main_arm:
name: Test flint main Linux ARM
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: '3.13'
- run: bin/install_flint_ubuntu.sh main
# Need to disable flint version check to build against main
- run: pip install --config-settings=setup-args="-Dflint_version_check=false" .
- run: python -m flint.test --verbose
# Test that we can make a coverage build and report coverage
test_coverage_build_setuptools:
name: Test coverage setuptools build
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: '3.13'
- run: sudo apt-get update
- run: sudo apt-get install libflint-dev
- run: pip install -r requirements-dev.txt
- run: bin/coverage_setuptools.sh
# Test that we can make a coverage build and report coverage
test_coverage_build_meson:
name: Test coverage meson build
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: '3.12' # does not work with 3.13
- run: sudo apt-get update
- run: sudo apt-get install libflint-dev
- run: pip install -r requirements-dev.txt
- run: bin/coverage.sh
# Run SymPy test suite against python-flint master
test_sympy:
name: Test SymPy ${{ matrix.sympy-version }}
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
sympy-version: ['1.13.1', '1.14.0']
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: '3.13'
- run: sudo apt-get update
- run: sudo apt-get install libflint-dev
- run: pip install .
- run: pip install pytest pytest-xdist hypothesis
- env:
SYMPY_VERSION: ${{ matrix.sympy-version }}
run: pip install "sympy==$SYMPY_VERSION"
- run: python -c 'import sympy; sympy.test(parallel=True)'
# Run SymPy master branch agains python-flint main
test_sympy_master:
name: Test SymPy master
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: '3.13'
- run: sudo apt-get update
- run: sudo apt-get install libflint-dev
- run: pip install .
- run: pip install pytest pytest-xdist hypothesis
- run: pip install git+https://github.com/sympy/sympy.git@master
- run: python -c 'import sympy; sympy.test(parallel=True)'
# Push nightly wheels to Anaconda scientific-python nightly channel
# https://scientific-python.org/specs/spec-0004/
# https://anaconda.org/scientific-python-nightly-wheels/python-flint
# https://github.com/scientific-python/upload-nightly-action/issues/111
nightly-wheels-upload:
name: Upload Anaconda Scientific Python nightly wheels
needs: [build_wheels]
# Run on push/merge to main
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
environment:
name: anaconda_nightly
permissions: {}
steps:
# Downloads all artifacts
- name: Download release artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
path: wheelhouse
merge-multiple: true
- name: Copy the wheels into dist
run: mkdir dist && cp wheelhouse/*.whl dist
- name: Upload wheels
uses: scientific-python/upload-nightly-action@e76cfec8a4611fd02808a801b0ff5a7d7c1b2d99 # 0.6.4
with:
artifacts_path: dist
# This token is generated from anaconda.org
# https://github.com/scientific-python/upload-nightly-action/issues/111
anaconda_nightly_upload_token: ${{ secrets.ANACONDA_ORG_UPLOAD_TOKEN_V2 }}
# Deploy wheels and sdist to PyPI
pypi_release:
name: Publish to PyPI
needs: [build_wheels, build_sdist]
# Run only when a tag is pushed to the flintlib/python-flint repo
if: "github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && github.repository_owner == 'flintlib'"
environment:
name: pypi
url: https://pypi.org/p/python-flint
permissions:
id-token: write # Required for trusted publishing to PyPI via OIDC.
runs-on: ubuntu-latest
steps:
# Downloads all artifacts
- name: Download release artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
path: wheelhouse
merge-multiple: true
- name: Copy the PyPI files into dist
run: |
mkdir dist
cp wheelhouse/*.whl wheelhouse/*.tar.gz dist
- name: Publish package on PyPI
# It is recommended to pin a commit hash here for security but it
# should be kept up to date. Possibly all actions and dependencies used
# by the build script should be pinned...
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0
# Make a GitHub release
github-publish:
name: Publish GitHub release
needs: pypi_release
runs-on: ubuntu-latest
permissions:
contents: write # Required to create the GitHub release with the gh CLI.
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- name: Download sdist
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: sdist
path: dist
- name: Create GitHub release
env:
GH_TOKEN: ${{ github.token }}
REF_NAME: ${{ github.ref_name }}
run: |
gh release create "$REF_NAME" dist/* \
--title "python-flint $REF_NAME" \
--notes "https://github.com/flintlib/python-flint?tab=readme-ov-file#changelog"