Metadata-Version: 2.4
Name: simparse
Version: 0.5.0
Classifier: Development Status :: 3 - Alpha
Classifier: License :: Other/Proprietary License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Rust
Classifier: Topic :: Scientific/Engineering
License-File: LICENSE
License-File: THIRD_PARTY_NOTICES
Summary: Lightweight metadata scanner for simulation project and case files.
Author: SVD Lab
License-Expression: LicenseRef-Proprietary
Requires-Python: >=3.9
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Documentation, https://pypi.org/project/simparse/
Project-URL: Homepage, https://github.com/svd-ai-lab/sim-cli
Project-URL: Issues, https://github.com/svd-ai-lab/sim-cli/issues

# simparse

`simparse` is a fast, lightweight scanner for simulation project and case
metadata, implemented in Rust with a Python API. It is built for agent and
automation workflows: inventory a directory of models, preflight a case, and
decide when a heavier vendor tool should be called next.

## Install

```sh
pip install simparse
```

Prebuilt wheels are available for Windows x86_64, macOS arm64 and Linux x86_64
(manylinux2014), Python 3.9+.

## Usage

```python
import simparse

# One file. Format is detected from the suffix and content.
info = simparse.inspect("/path/to/model.mph", summary=True)
print(info["format"], info["ok"])

# Directories and files, recursively.
for entry in simparse.scan(["/path/to/projects"], summary=True):
    print(entry["file_name"], entry["format"])
```

`inspect(path, format="auto", include_paths=False, summary=False)` returns one
result dict. `scan(paths, recursive=True, include_paths=False, summary=False)`
returns one result per supported file found.

- `summary=True` gives a deterministic, bounded preflight view: total counts with
  capped samples and explicit parser limitations. Leave it off for the full
  shallow inventory.
- `include_paths=True` adds full source paths to the results. By default,
  results carry file names only.

Each result also has an `ir` field: a compact inspection manifest (CAD dialect
for STEP, CAE dialect for simulation formats) that describes observed metadata.
The inspection manifest contains metadata.

For COMSOL MPH files, Python can also compare saved model settings, export a
stored mesh to VTU, and read saved solution vectors without launching COMSOL.

```python
simparse.comsol_diff("before.mph", "after.mph")
simparse.comsol_vtu("solved.mph", "mesh.vtu", sequence="mesh1")
simparse.comsol_solutions("solved.mph")
vector = simparse.comsol_solution("solved.mph", sequence="sol1")
```

Solution extraction covers verified COMSOL 6.4 stationary and fixed-size
transient layouts. Vectors are in native solver order. Spatial field
reconstruction requires the extended mesh mapping and element interpolation.

## Supported formats

| Format | Files | What is reported |
|---|---|---|
| STEP Part 21 | `.step`, `.stp` | Schema names, entity-type counts, product names, length-unit declarations |
| COMSOL | `.mph` | File version, model info and tree, used licenses, binary block inventory |
| Abaqus | `.inp`, `.inc` | Include graph, node/element counts, materials, sections, steps, loads, BCs, output requests |
| Fluent | `.cas.h5`, `.msh.h5` | HDF5 object tree, dataset shapes, zone, boundary and settings hints |
| Ansys Electronics Desktop (HFSS / Icepak) | `.aedt`, `.aedtz` | Design and solution types, solved status, variables, setups, sweeps, ports, boundaries, materials, mesh operations, Icepak thermal settings |
| Ansys Mechanical | `.mechdb`, `.mechdat` | Release, analyses, bodies, materials, contacts, loads, results, geometry sources |
| Icepak Classic | `.tzr` | Project name, entry and file counts, sizes, job and model payload presence |
| Simcenter FloTHERM | `.pack`, `.xml`, `.floxml` | Project archive inventory; FloXML model and solve options, grid, attributes, geometry, heat sources, domain boundaries |
| Simulink | `.slx`, `.mdl` | Model kind, release, block and library inventory, subsystems, Stateflow, root ports, solver settings |
| MATLAB data | `.mat` | Variable names, classes, dimensions and flags for Level 4, v5–v7 and v7.3 files |

Files are read shallowly and streamed where possible, so large archives and
decks scan quickly. FloXML files often use the generic `.xml` suffix; simparse
identifies them by their root element, so directory scans pick up FloXML
projects among other XML files.

## License and issues

`simparse` is free to use, including commercial use, under the proprietary
license in the `LICENSE` file shipped with each wheel. Copyright 2026 SVD Lab.
Third-party components are listed with their licenses in `THIRD_PARTY_NOTICES`.

Report bugs and requests at https://github.com/svd-ai-lab/sim-cli/issues with
the `simparse` label.

