Skip to content

Add some mpoly context util functions #979

Add some mpoly context util functions

Add some mpoly context util functions #979

Workflow file for this run

name: Build
on: [push, pull_request]
jobs:
build_wheels:
name: Build wheels for ${{ matrix.os }}
runs-on: ${{ matrix.os }}
continue-on-error: true
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, windows-2019, macos-13, macos-14]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- uses: msys2/setup-msys2@v2
with:
msystem: mingw64
# path-type inherit is used so that when cibuildwheel calls msys2 to
# run bin/cibw_before_build_windows.sh the virtual environment
# created by cibuildwheel will be available within msys2. The
# msys2/setup-msys2 README warns that using inherit here can be
# problematic in some situations. Maybe there is a better way to do
# this.
path-type: inherit
if: ${{ matrix.os == 'windows-2019' }}
# Install pkgconfig on Windows from choco rather than from msys and
# avoid using the Strawberry one.
- run: choco install -y --stoponfirstfailure --checksum 6004DF17818F5A6DBF19CB335CC92702 pkgconfiglite
if: ${{ matrix.os == 'windows-2019' }}
# We have to set this here rather than in the cibuildwheel config
# This is probably something to do with \ vs / in paths...
- run: echo "PKG_CONFIG_PATH=${{ github.workspace }}/.local/lib/pkgconfig" >> $env:GITHUB_ENV
if: ${{ matrix.os == 'windows-2019' }}
- name: Build wheels
uses: pypa/cibuildwheel@v2.20.0
env:
# override setting in pyproject.toml to use msys2 instead of msys64 bash
CIBW_BEFORE_ALL_WINDOWS: msys2 -c bin/cibw_before_all_windows.sh
#
# Don't need to create pythonXX.a under meson. Not needed any more:
# CIBW_BEFORE_BUILD_WINDOWS: pip install delvewheel && msys2 -c bin/cibw_before_build_windows.sh
#
- uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}
path: wheelhouse/*.whl
build_sdist:
name: Build sdist
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- run: bin/install_latest_flint_ubuntu.sh
- run: pip install build
- run: python -m build --sdist
- uses: actions/upload-artifact@v4
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 }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, windows-2019, macos-13, macos-14]
# This list to be kept in sync with cibuildwheel config
# and python-requires in pyproject.toml.
python-version: ['3.10', '3.11', '3.12', '3.13-dev', 'pypy3.10']
steps:
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: actions/download-artifact@v4
with:
name: wheels-${{ matrix.os }}
path: wheelhouse
- run: pip install --no-index --find-links wheelhouse python_flint
- run: python -m flint.test --verbose
# 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@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- 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@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- 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@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- 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" "meson-python==0.13" "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.0', 'v3.0.1', 'v3.1.0', 'v3.1.1', 'v3.1.2']
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- run: bin/install_flint_ubuntu.sh ${{ matrix.flint-tag }}
- run: pip install .
- run: python -m flint.test --verbose
# Test against flint main
test_flint_main:
name: Test flint main
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- 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:
name: Test coverage setuptools build
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- run: sudo apt-get update
- run: sudo apt-get install libflint-dev
# Need Cython's master branch until 3.1 is released because of:
# https://github.com/cython/cython/pull/6341
- run: pip install git+https://github.com/cython/cython.git@master
- run: pip install -r requirements-dev.txt
- run: bin/coverage.sh
# On new enough Ubuntu we can build against the system deb.
test_freethreaded:
name: Free-threaded ${{ matrix.python-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04]
python-version: ['3.13-dev']
steps:
- uses: actions/checkout@v4
# Can't use actions/setup-python
# https://github.com/actions/setup-python/issues/771
# deadsnakes only works for Ubuntu...
- uses: deadsnakes/action@v3.1.0
with:
python-version: ${{ matrix.python-version }}
nogil: true
- run: |
python --version --version
which python
python -c "import sysconfig; print(sysconfig.get_config_var('Py_GIL_DISABLED'))"
python -c "import sys; print(sys._is_gil_enabled())"
- run: sudo apt-get update
- run: sudo apt-get install libflint-dev
# Need Cython master until 3.1 is released
- run: pip install git+https://github.com/cython/cython.git@master
- run: pip install -r requirements-dev.txt
- run: pip install --no-build-isolation .
- run: python -m flint.test --verbose
# 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']
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- 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 sympy==${{ matrix.sympy-version }}
- run: python -c 'import sympy; sympy.test(parallel=True)'
# 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
runs-on: ubuntu-latest
steps:
# Downloads all artifacts
- name: Download release artifacts
uses: actions/download-artifact@v4
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@8a08d616893759ef8e1aa1f2785787c0b97e20d6 # v1.10.0
# Make a GitHub release
github-publish:
name: Publish GitHub release
needs: pypi_release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Download sdist
uses: actions/download-artifact@v4
with:
name: sdist
path: dist
- name: Create GitHub release
env:
GH_TOKEN: ${{ github.token }}
run: >
gh release create ${{ github.ref_name }} dist/*
--title "python-flint ${{ github.ref_name }}"
--notes "https://github.com/flintlib/python-flint?tab=readme-ov-file#changelog"