pyrucast 0.15.0

Finite-element library in Rust, inspired by cast3m, exposed to Python
Documentation
[build-system]
requires = ["maturin>=1.5,<2.0"]
build-backend = "maturin"

[project]
name = "pyrucast"
# La version n'est déclarée qu'une fois, dans Cargo.toml : maturin la lit là, et
# `pyrucast.__version__` en vient déjà (`src/lib.rs`, env!("CARGO_PKG_VERSION")).
# Deux déclarations laisseraient publier un crate et une wheel divergents sous le
# même tag.
dynamic = ["version"]
description = "Finite-element library in Rust, inspired by cast3m, exposed to Python"
readme = "README.md"
requires-python = ">=3.11"
license = "MPL-2.0"
authors = [{ name = "Gauthier F" }]
classifiers = [
    "Development Status :: 3 - Alpha",
    "Intended Audience :: Science/Research",
    "Topic :: Scientific/Engineering",
    "Programming Language :: Rust",
]

[project.urls]
Repository = "https://github.com/Pyrucast/pyrucast"

[tool.maturin]
# Pin the binding type. `pyo3` is an *optional* Cargo dependency (so a pure
# `cargo build` links no Python), which means maturin's auto-detection does
# not see it and wrongly falls back to `cffi` — it then runs its bundled
# cbindgen, which panics on our `Point2` type alias. Stating `pyo3`
# explicitly skips that guess.
bindings = "pyo3"
# Enable the Cargo `extension-module` feature (correct Python linkage).
features = ["extension-module"]
# Mixed Rust/Python layout: the pure-Python sources live in `python/` (package
# `python/pyrucast/`) and the compiled extension is placed inside that package
# as the private submodule `_pyrucast`. `pyrucast/__init__.py` re-exports it
# (`from ._pyrucast import *`) and adds the high-level Python layer, so
# `import pyrucast` keeps exposing every Rust symbol unchanged.
python-source = "python"
module-name = "pyrucast._pyrucast"

[tool.ruff]
# Style standard ruff (≈ black). On épingle la cible de version ; le reste
# suit les défauts (line-length = 88). `ruff format` met en forme les exemples
# et la suite de tests Python ; `ruff format --check` garde le standard (cf.
# script/check.sh).
target-version = "py311"
# Le stub de l'extension est généré par `stub_gen` (cargo) : le laisser hors de
# ruff, sinon il dériverait à chaque régénération.
extend-exclude = ["python/pyrucast/_pyrucast/__init__.pyi"]

[tool.ruff.lint]
# ruff's default rules for the version CI pins (0.16.4, see
# .github/workflows/release.yml); `ruff check` runs in script/check_format.sh.

[tool.ruff.lint.per-file-ignores]
# The book's examples come from these files, and an example shows its own
# imports: a module imported again inside an anchor is deliberate.
"tests/python/test_doc_*.py" = ["F811"]

[tool.pytest.ini_options]
testpaths = ["tests/python"]
# Les fichiers `test_doc_*.py` portent les exemples du book **au niveau
# module**, pour que l'extrait inclus s'affiche en colonne 0. Un exemple qui
# casse est donc une erreur de collecte : sans cette option, elle
# interromprait toute la session au lieu du seul fichier concerné.
# `-m "not gmsh"` : les tests de l'interface gmsh sortent de la passe normale.
# Un développeur qui n'y touche pas n'a pas à installer gmsh ; `check_gmsh.sh`
# les rattrape avec `pytest -m gmsh` (l'option de la ligne de commande
# l'emporte sur celle-ci).
addopts = "--continue-on-collection-errors -m \"not gmsh and not medcoupling\""
markers = [
    "gmsh: exige le module gmsh installé — lancé par script/check_gmsh.sh",
    "medcoupling: exige le module medcoupling installé — lancé par script/check_medcoupling.sh",
]