PyMats
PyMats is a Python library for working with engineering materials. It brings material records, temperature- and thickness-dependent properties, design points, and material models into one place, ready to use in Python scripts and Jupyter notebooks.
Whether you are exploring material data, comparing candidates, or preparing inputs for a finite element model, PyMats aims to make that work easier to follow and repeat. The package includes ASME and EN material classes and supports custom material classes for your own workflows.
PyMats is under active development. This preview reflects the source reviewed on 1 November 2026; the notes below distinguish available functionality from areas still being developed.
What you can do
- Construct local materials or load records through a configured backend.
- Evaluate material properties at a temperature and thickness.
- Work with design points and implemented allowable-stress rules.
- Choose between tabulated data and supported approximation models.
- Build linear-elastic, perfectly plastic, and linear-hardening stress–strain curves.
- Prepare material definitions for Ansys, Abaqus, and LS-DYNA.
- Explore material similarity and create Particular Material Appraisal (PMA) drafts.
The Python package is the heart of the project. A companion FastAPI service and Next.js application provide shared data access and a browser interface. User accounts and user management are outside the scope of PyMats.
Getting started
Python 3.11 or newer is required. To work from this repository, install the core package:
python -m pip install pymats
You can create a material locally without connecting to a database:
from pymats import Material
material = Material(
Identifier="LOCAL",
EO_overwritten=210_000.0,
)
print(material.EO)
This example supplies only an overridden Young’s modulus. For calculations that need additional properties, provide those inputs or load a complete material record.
Loading a material
MaterialFactory loads records through your configured backend:
from pymats import MaterialFactory
material = MaterialFactory.from_config({
"Identifier": "SA-723-2-2",
"Collection": "asme",
})
print(material.Name)
This example requires an accessible backend containing the requested record. Material data is supplied separately from the package.
Working with design points
A design point groups the conditions used to evaluate a material:
from pymats import DesignPoint, MaterialConstants
point = DesignPoint(
EnvironmentTemperature=20.0,
DesignTemperature=100.0,
ThicknessConstraint=10.0,
DesignCode=MaterialConstants.DesignCode.AD2000,
)
# Apply this to a material with the required property data.
material(point)
print(material.EO) # Young’s modulus at design temperature
print(material.SYo) # Yield strength at design temperature
print(material.STo) # Tensile strength at design temperature
Choose conditions and a design code supported by your material data and the implemented calculation rules.
Configuration and material data
PyMats supports three backend types: api, mongodb, and atlas. Use an API backend to access a running PyMats service, or a direct MongoDB connection for your own data environment.
Set PYMATS_CONFIG to the location of your YAML configuration:
export PYMATS_CONFIG=/absolute/path/to/config.yaml
A minimal API client configuration looks like this:
pymats:
api_url: http://localhost:8001
database:
type: api
logging:
file: null
The library resolves an explicit configuration file argument first, then PYMATS_CONFIG, then ~/.pymats/config.yaml. If the default file is absent, importing the package uses API client defaults without creating a file. To create a minimal default file explicitly, call pymats.config.create_default_config().
Explicit DB_* environment variables override database settings. Configuration can also be loaded from gs://bucket/path with the gcs extra and suitable credentials. File logging is optional.
Built-in material classes include ASMEMaterial and ENMaterial. You can register custom classes before loading their records. Configured Python plugins run when you explicitly call pymats.register_custom_materials(); unknown material class names raise an error.
Material properties and interpolation
The propertydata setting selects exact, ml, or nn property sources. For tabulated data, choose an interpolation approach that fits your data and intended use:
| Setting | Approach |
|---|---|
standard |
Thickness bands with linear interpolation over temperature |
smooth |
Two-dimensional Clough–Tocher interpolation |
triangular |
Triangulated, piecewise-linear interpolation |
Property tables are checked for matching input/value sizes, finite values, and conflicting duplicate points. The two-dimensional methods need suitable point geometry.
Boundary behavior currently depends on the evaluation path. MechanicalProperty clamps temperatures below the table minimum and linearly extrapolates above the maximum using evaluations 10 °C apart. Thickness handling depends on the selected interpolator. The declared extrapolation field does not currently switch this behavior to a nearest-value policy.
Approximation models need the ml extra. Neural models also need a compatible ai-edge-litert or tflite-runtime installation. Model and scaler loading uses skops; legacy pickle/joblib fallback is not supported.
Material models and solver exports
PyMats provides linear-elastic, perfectly plastic, and linear-hardening material models through pymats.cae. The package can build stress–strain curves and prepare solver material definitions for Ansys, Abaqus, and LS-DYNA.
Material modulus and strength inputs use MPa, and density uses kg/m³. Elongation at break is stored as a percentage and converted when building curves. Solver exports use m, kg, s, and Pa and validate required inputs, including a positive numeric Mid, positive density, and a valid Poisson ratio.
Linear hardening approximates the response using modulus, yield strength, tensile strength, and elongation at break. Unsupported allowable-stress rules raise errors. Material similarity scores help explore candidates, while engineering equivalence and solver suitability still need assessment for the intended application.
PMA support
The package includes models and a builder for Particular Material Appraisal drafts, including general requirements, property definitions, and documentation metadata. Draft creation is available; document generation and export are still being developed. PMABuilder.build() currently raises NotImplementedError.
The companion service can serve existing PDF specifications through a manifest that identifies the material revision, file path, and checksum.
Optional dependencies
Install extras as needed, for example python -m pip install -e '.[ml,dev]'.
| Extra | Purpose |
|---|---|
ml |
scikit-learn and skops model loading |
pma |
Document rendering dependencies; generation remains incomplete |
excel |
openpyxl support |
gcs |
Configuration loading from Google Cloud Storage |
dev |
Python tests and package builds |
api |
Companion FastAPI service dependencies |
Companion applications
pymats-api/ provides HTTP access to material search, properties, collections, solver exports, metadata, and PMA drafts. It requires a direct mongodb or atlas backend and an api section in the runtime configuration. Interactive route documentation is available at /docs when the service is running with its default FastAPI documentation settings.
pymats-app/ provides a browser interface for exploring materials and models. Its development command serves port 3001. NEXT_PUBLIC_API_URL is a frontend build-time setting and must be reachable from the browser.
The repository also includes a Docker Compose stack. It publishes the browser application on port 3001 and maps host port 8001 to API container port 8000. It requires deployment-specific environment variables, runtime configuration, database storage, and the external edge-network network. Configuration is supplied through bind mounts and environment variables. The Python package version and Git revision metadata are separate values.
Areas still being developed
A few parts of the current implementation need further work:
- API-backed collection loading: the Python loader and collection endpoint currently expect different response structures and property-data flags. Direct database loading remains a separate path.
- Property boundary handling: interpolation methods have different boundary behavior, and the
extrapolationoption is not yet connected to a consistent policy. - Shared data definitions: some frontend enums and response interfaces differ from the Python models.
- PMA editing and export: draft models are available, while the complete editing and document workflow is unfinished.
These notes come from source inspection. They are intended to help you choose a suitable workflow; they do not replace running the tests against your checkout and environment.
Future features
Possible directions for future development include:
- More consistent interpolation and explicit extrapolation policies.
- Broader material property coverage and additional allowable-stress rules.
- Easier import and validation of material datasets, with clear source references and units.
- More examples and notebooks for material evaluation, comparison, and solver preparation.
- A complete PMA draft and document export workflow.
- Shared schemas across the Python package and companion applications.
- Additional solver export validation and examples.
These are ideas for discussion rather than release commitments. User accounts and user management are outside the project scope and are not part of this roadmap.
Contributing
Questions, bug reports, documentation improvements, and practical examples are welcome. If something behaves unexpectedly, a small reproducible example with the relevant configuration, property data, and package version makes it easier to investigate. Please leave credentials and private material data out of shared examples.
For a code contribution, keep changes focused and run the relevant tests. Examples that show how you use PyMats in an engineering or research workflow are welcome too.
Development and checks
The repository keeps the reusable package in pymats/, Python tests in tests/, configuration files in configs/, and notebooks and development notes in jupyter/. The companion API and browser application have their own directories.
From the repository root, with the dev extra installed:
python -m pytest -q
python -m build
For frontend work, run npm run typecheck and npm run build from pymats-app/ after installing its dependencies. After changing Compose configuration, run docker compose config --quiet.
The CI workflow defines Python regressions, a wheel installation smoke test, frontend checks, and container readiness checks. Their results depend on the checkout and environment; no tests or builds were run as part of preparing this documentation preview.
Metadata
Release files for pymats 0.1.4
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 |
|---|---|---|---|---|
| pymats-0.1.4.tar.gz | 3.7 MB | With provenance | Details for pymats-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pymats-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for pymats-0.1.4-py3-none-any.whl |
Total release size: 3.8 MB
Release files / pymats-0.1.4.tar.gz
| Download URL | pymats-0.1.4.tar.gz |
|---|---|
| Size | 3.7 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4f0cc6d5f77ab0d53587ccc4b5a9f17ffeb6b107199d9c79a762ad210f907041
|
|
BLAKE2b-256 checksum How to use checksums |
4ff6b442e610ee142d07e2a0c10fee8b56a9a9b38ee02f13bf603953a2853a96
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.
Transparency logRelease files / pymats-0.1.4-py3-none-any.whl
| Download URL | pymats-0.1.4-py3-none-any.whl |
|---|---|
| Size | 51.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9dc21e865fd995c2a3802353921afde820dcd841e3737d5abb0e5ea09557bd60
|
|
BLAKE2b-256 checksum How to use checksums |
0e42e905724ce9625d126b3f0cacd67e39f0156d0da5b6c8a804513fe2713882
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.
Transparency logSecurity for pymats 0.1.4
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for pymats-0.1.4.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.
Transparency logA 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.