Skip to main content

Finite-element library in Rust, inspired by cast3m, exposed to Python

Project description

pyrucast

Bibliothèque d'éléments finis en Rust, inspirée de cast3m, exposée à Python — et utilisable telle quelle en Rust pur (pyo3 est une dépendance optionnelle : un build par défaut ne tire ni pyo3 ni libpython).

  • Documentation complète : le book mdbook dans book/ (architecture, modèle mémoire, maillage, champs, physiques…) — mdbook build book pour le HTML.
  • Référence API Rust : cargo doc --no-deps --lib --open.

Prérequis

Outil Version Installation
Rust stable (édition 2021) rustup
Python ≥ 3.9 API Python uniquement — inutile en Rust pur
En-têtes Python API Python uniquementLinux : python3-dev (Debian/Ubuntu) ou python3-devel (Fedora/RHEL). Windows : inclus dans l'installateur officiel.

Usage en Rust pur (sans Python)

[dependencies]
pyrucast = { git = "…", default-features = false }   # pas de pyo3, pas de libpython
use pyrucast::containers::mesh::ElementType;
let mesh = pyrucast::ops::mesher::pave_surface(&contour, ElementType::TRI3, Some(1.0))?;

cargo build / cargo test (sans feature) compilent le cœur en Rust pur — ni Python ni venv requis. L'API Python (#[pyclass]) vit derrière la feature python-api, activée automatiquement par maturin.

Compilation dans un venv (API Python)

Pour les builds avec l'API Python (maturin, ou cargo --features python-api), pyo3 localise l'interpréteur via VIRTUAL_ENV : activez toujours le venv avant cargo ou maturin, sinon la compilation échoue avec error: failed to run the Python interpreter at .... (Un cargo build pur n'a pas cette contrainte.)

Linux / macOS

python3 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip maturin
maturin develop --release

Windows (PowerShell)

python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install --upgrade pip maturin
maturin develop --release

maturin develop compile le module et l'installe dans le venv. Vérification :

python -c "import pyrucast; c = pyrucast.Coords(2); print(c)"

Après toute modification du Rust, relancer simplement maturin develop --release.

Développement

pip install pytest ruff     # en plus de maturin, dans le venv
cargo build                 # cœur Rust pur (sans pyo3 ; pas besoin du venv)
cargo test                  # tests unitaires + intégration + doctests (Rust pur)
maturin develop && python -m pytest   # tests Python
cargo fmt && ruff format .  # formatage standard (Rust + Python)
bash script/check.sh        # enchaîne toutes les vérifications (formatage inclus)

Le chapitre Compilation et tests du book détaille les features Cargo (viz, viz-interactive, stub-gen…), la génération du stub pyrucast.pyi et le dépannage courant.

Licence

Distribué sous licence Mozilla Public License 2.0 (MPL-2.0).

C'est un copyleft au fichier : toute modification d'un fichier source de pyrucast doit être republiée sous MPL, mais on peut librement construire du code propriétaire au-dessus de la bibliothèque et l'y combiner. La MPL est par ailleurs compatible GPL/CeCILL (« Secondary Licenses », §3.3).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyrucast-0.1.2.tar.gz (696.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyrucast-0.1.2-cp313-cp313-manylinux_2_38_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.38+ x86-64

File details

Details for the file pyrucast-0.1.2.tar.gz.

File metadata

  • Download URL: pyrucast-0.1.2.tar.gz
  • Upload date:
  • Size: 696.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.14.1

File hashes

Hashes for pyrucast-0.1.2.tar.gz
Algorithm Hash digest
SHA256 c4d5dc768773d3cb8316d03af27ed840f9f70db29a30f58bf1880c7ec7abe990
MD5 c6ecee91aea4e9a6b3235a4a04401dc8
BLAKE2b-256 b9e347eb1cdc896c84e2581de4fd0233d8e5a1ba900eff9ea437c1e5bf764a24

See more details on using hashes here.

File details

Details for the file pyrucast-0.1.2-cp313-cp313-manylinux_2_38_x86_64.whl.

File metadata

File hashes

Hashes for pyrucast-0.1.2-cp313-cp313-manylinux_2_38_x86_64.whl
Algorithm Hash digest
SHA256 9f1944bb36e1c897d1969952b907e56b5d9da41a90a7be369e8743bad72e5622
MD5 fde60a16b74d40c8d7fcf677e5c848fe
BLAKE2b-256 02a27f672bc099e0a6fd19029c166ed0588b2e255c9159d5a99c85a9d47a064c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page