@@ -329,6 +329,52 @@ jobs:
329329 - run : spin run -- pytest --doctest-glob='*.rst' doc/source
330330 - run : spin docs
331331
332+ test_cython_c_api :
333+ name : ' Test C API with Cython consumers'
334+ runs-on : ubuntu-24.04
335+ steps :
336+ - uses : actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
337+ with :
338+ persist-credentials : false
339+ - uses : actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
340+ with :
341+ python-version : ' 3.13'
342+ - run : sudo apt-get update
343+ - run : sudo apt-get install libflint-dev
344+ - run : pip install "cython==3.3.0" meson-python ninja
345+ - run : pip wheel --no-build-isolation --no-deps --wheel-dir=/tmp/python-flint-wheel .
346+ - run : pip install /tmp/python-flint-wheel/python_flint-*.whl
347+ - name : Build examples with Cython 3.1 through 3.3
348+ run : |
349+ for version in 3.1.0 3.2.9 3.3.0; do
350+ pip install "cython==$version"
351+ pip install --no-build-isolation --no-deps --force-reinstall ./examples/cython/capi
352+ pip install --no-build-isolation --no-deps --force-reinstall ./examples/cython/flint
353+ (cd /tmp && python "$GITHUB_WORKSPACE/examples/cython/capi/test_capi.py")
354+ (cd /tmp && python "$GITHUB_WORKSPACE/examples/cython/flint/test_flint.py")
355+ done
356+ - name : Capsule-only example has no FLINT dependency
357+ run : |
358+ python - <<'PY'
359+ import _flint_capi_example
360+ import subprocess
361+ dependencies = subprocess.check_output(
362+ ["ldd", _flint_capi_example.__file__], text=True)
363+ print(dependencies)
364+ assert "libflint" not in dependencies
365+ PY
366+ - name : Installed API files are present
367+ run : |
368+ cd /tmp
369+ python - <<'PY'
370+ import flint
371+ from pathlib import Path
372+ package = Path(flint.__file__).parent
373+ assert (package / "__init__.pxd").is_file()
374+ assert (package / "__init__.cython-31.pxd").is_file()
375+ assert (Path(flint.get_include()) / "python_flint" / "fmpz.h").is_file()
376+ PY
377+
332378 # Test build with minimum Cython and meson-python versions.
333379 test_old_build_requires :
334380 name : ' Test old Cython/meson-python'
@@ -349,7 +395,7 @@ jobs:
349395 # We don't need to specify ninja as a requirement in pyproject.toml
350396 # because without --no-build-isolation meson-python handles it
351397 # automatically in get_requirements_for_build_wheel().
352- - run : ' pip install "cython==3.0.11 " "meson-python==0.18" "ninja<1.11"'
398+ - run : ' pip install "cython==3.1.0 " "meson-python==0.18" "ninja<1.11"'
353399 - run : pip install --no-build-isolation .
354400 - run : python -m flint.test --verbose
355401
0 commit comments