cande-wrapper
Python wrapper for the CANDE (Culvert ANalysis and DEsign) finite element engine.
The CANDE-2025 Fortran source is compiled via f2py into a native Python extension module, allowing direct calls from Python without subprocess overhead or DLL wrappers.
Installation
Install from PyPI (includes pre-built wheels for Windows and Linux):
pip install cande-wrapper
For development (requires gfortran):
pip install -e ".[dev]"
Build prerequisites (development only)
| Dependency | Version | Purpose |
|---|---|---|
| Python | >= 3.10 | Runtime |
| gfortran | any recent | Compiles the CANDE Fortran engine |
| NumPy | >= 1.26 | f2py extension building and runtime |
| Meson | >= 1.1 | Build system |
| Ninja | any recent | Build backend for Meson |
Installing gfortran on Windows
Via MSYS2:
# In MSYS2 terminal
pacman -S mingw-w64-x86_64-gcc-fortran
# Add to PATH (PowerShell)
$env:PATH += ";C:\msys64\mingw64\bin"
Or via conda:
conda install -c conda-forge gfortran
Quick Start
from cande_wrapper import CandeEngine
engine = CandeEngine(work_dir="path/to/my/models")
result = engine.run("EX1") # reads EX1.cid, writes EX1.out
print(result.output_text)
Vehicle definitions
Standard AASHTO design vehicles are available for live-load analysis:
from cande_wrapper import Vehicle
hs20 = Vehicle.hs20() # AASHTO HS-20 (72 kip)
hs25 = Vehicle.hs25() # AASHTO HS-25 (90 kip)
tandem = Vehicle.tandem() # AASHTO design tandem (50 kip)
cooper = Vehicle.cooper_e80() # Cooper E-80 railroad (160 kip)
Custom vehicles can be defined with arbitrary axle configurations:
from cande_wrapper import Vehicle, WheelFootprint, Axle
truck = Vehicle(
name="Custom Truck",
footprint=WheelFootprint(length=12.0, width=24.0, spacing=84.0),
axles=[
Axle(weight=12000, spacing=0),
Axle(weight=40000, spacing=180),
Axle(weight=40000, spacing=54),
],
)
print(f"{truck.name}: {truck.total_weight/1000:.0f} kip")
CANDE Input Files
CANDE reads .cid input files (CANDE Input Data). These are fixed-format text files with sections:
- A-1: Master control line (analysis/design mode, solution level, title)
- A-2: Pipe type and element counts
- B-*: Pipe material properties
- C-*: Mesh, node, and element definitions
- D-*: Soil properties and load steps
- STOP: End-of-problem marker
Multiple problems can be run back-to-back in a single .cid file, each terminated by STOP.
An example input file is included at tests/example_data/MGK-IO.cid.
Output Files
After running engine.run("prefix"), these files are created in the working directory:
| File | Description |
|---|---|
prefix.out |
Main analysis output report |
prefix.log |
Engine log messages |
prefix.ctc |
Table of contents for the output |
prefix_MeshGeom.xml |
Mesh geometry (for visualization) |
prefix_MeshResults.xml |
Mesh results (for visualization) |
prefix_BeamResults.xml |
Beam element results |
prefix_PLOT1.dat |
Plot data file 1 |
prefix_PLOT2.dat |
Plot data file 2 |
The CandeResult object returned by engine.run() gives convenient access to the main output files:
result = engine.run("EX1")
print(result.output_file) # Path to EX1.out
print(result.log_file) # Path to EX1.log
print(result.output_text) # Full contents of EX1.out
Testing
pytest -v # unit tests (no build required)
pytest -m integration -v # integration tests (requires build)
pytest -m "" -v # all tests
Troubleshooting
gfortran: command not found
gfortran is not on your PATH. Verify with gfortran --version. On Windows, ensure the MSYS2/MinGW or conda bin directory is in your PATH.
Linker errors about missing symbols
The meson.build file lists Engine source files explicitly. If you see unresolved symbols like plasti_ or prhero_, the corresponding .f file needs to be added to the engine_sources list in meson.build.
ImportError: CANDE Fortran extension not found
The package was imported but the compiled extension (_cande.pyd / _cande.so) was not found. Rebuild with:
pip install -e . --no-build-isolation
Large memory usage
The CANDE engine statically allocates ~320 MB for the stiffness matrix (REAL*8 A(20000,2000) in system.fi). This is normal for FEA solvers and is mapped as virtual memory.
Metadata
Release files for cande-wrapper 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cande_wrapper-0.2.1.tar.gz | 402.2 kB | Without provenance | Details for cande_wrapper-0.2.1.tar.gz |
Built distributions (wheels)
Total release size: 13.3 MB
Release files / cande_wrapper-0.2.1.tar.gz
| Download URL | cande_wrapper-0.2.1.tar.gz |
|---|---|
| Size | 402.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f1dddab672aab2f9cd8bbd7f2e854d3853ea74953bf1e1a7ad9652ff6babb4d0
|
|
BLAKE2b-256 checksum How to use checksums |
9de2f673e1df1321827d7d0951500199309bdf3b7b86fc7283a3d6520f40f470
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.20
|
Release files / cande_wrapper-0.2.1-cp313-cp313-win_amd64.whl
| Download URL | cande_wrapper-0.2.1-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
a48716028929ffe546ea5e1737eb79cfc2766d9f1f256785622749dd6c75957f
|
|
BLAKE2b-256 checksum How to use checksums |
4acbbbc2e4a97e6d467b3d164a9c28478265466e78c48ac09cca6d92d4c115c1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.20
|
Release files / cande_wrapper-0.2.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | cande_wrapper-0.2.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 1.3 MB |
| Tags | CPython 3.13 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
083da47191ba329685367fd79aa95340f7ab1d3dac1e71ed2149bfb424d6ac1c
|
|
BLAKE2b-256 checksum How to use checksums |
34f6c63ee6eb2e655073b52002e66df6a1eeaff40097cee1cb9a835b8184341e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.20
|
Release files / cande_wrapper-0.2.1-cp312-cp312-win_amd64.whl
| Download URL | cande_wrapper-0.2.1-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
19020402a98bcffb0e7933516756995d10fafa9eee0d0c78e1aa785d54078bb7
|
|
BLAKE2b-256 checksum How to use checksums |
cb951dd91c0603875946b11f1054e1ac67141ca13b3ca888dc6c8026623452b1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.20
|
Release files / cande_wrapper-0.2.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | cande_wrapper-0.2.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 1.3 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
d0f278430d2d5e3b00a4af87400d92290ff5042c661a67c9c1abb290b3c4ba0f
|
|
BLAKE2b-256 checksum How to use checksums |
6be46a588ae6a1e9f39da0618a4409c9e8e2fd5788d7c9c6c159e08811d8d54c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.20
|
Release files / cande_wrapper-0.2.1-cp311-cp311-win_amd64.whl
| Download URL | cande_wrapper-0.2.1-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
49931bb322ebf4e4febdf991fb1c07a03f68cb84e9bd56f9203b773c5c74afc8
|
|
BLAKE2b-256 checksum How to use checksums |
22025d3f0ceebfbb0e5f912287bf26c8cca522478b7c1e4319a2942cd6546b4e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.20
|
Release files / cande_wrapper-0.2.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | cande_wrapper-0.2.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 1.3 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
2433970bd64057a1dcf7f0b94b3a598eff24784df776b77e383808fb83a88df3
|
|
BLAKE2b-256 checksum How to use checksums |
d97ebcf254d4c818b4740ec607393cdbf99885dd2313a26c3cbd72f116b6ba71
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.20
|
Release files / cande_wrapper-0.2.1-cp310-cp310-win_amd64.whl
| Download URL | cande_wrapper-0.2.1-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
34c8fc4469263a25d90c176be545bfb2c2a3f2b24a8b8112edd87c00b28de47b
|
|
BLAKE2b-256 checksum How to use checksums |
86efffc5c2acb3579cca2d887f4061747cca8ea54401467639e1946ef3c575de
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.20
|
Release files / cande_wrapper-0.2.1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | cande_wrapper-0.2.1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 1.3 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
1c8468f943e147b02763305bc28623d4c37d5d25115fe394d78143d6910b8890
|
|
BLAKE2b-256 checksum How to use checksums |
85dafa49934206b35b2148c954f0039a07f6f7a06d7bd7281827d8cbaa5d48c9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.20
|
Security for cande-wrapper 0.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.