Metadata-Version: 2.5
Name: ABQflow
Version: 0.6.0
Summary: A modular batch-processing framework for Abaqus FEA — typed job specs, strategy pattern workflow, fault-tolerant parallel execution, and resource-aware scheduling.
Project-URL: Homepage, https://github.com/Yutu0k/ABQflow
Project-URL: Issues, https://github.com/Yutu0k/ABQflow/issues
Project-URL: Source, https://github.com/Yutu0k/ABQflow
Author-email: yutu0k <yutu0k@sjtu.edu.cn>
License: MIT License
        
        Copyright (c) 2025 Yutu0k
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: abaqus,batch-processing,fea,finite-element-analysis,simulation,workflow
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9
Requires-Dist: numpy
Requires-Dist: psutil
Requires-Dist: rich
Provides-Extra: abqpy
Requires-Dist: abqpy<2026,>=2025.9; extra == 'abqpy'
Provides-Extra: dev
Requires-Dist: furo<2025,>=2024.8.6; extra == 'dev'
Requires-Dist: ipykernel; extra == 'dev'
Requires-Dist: ipywidgets<9,>=8.1.7; extra == 'dev'
Requires-Dist: jupyter; extra == 'dev'
Requires-Dist: myst-parser<5,>=4.0.1; extra == 'dev'
Requires-Dist: pytest-dependency<0.6,>=0.5.1; extra == 'dev'
Requires-Dist: pytest<9,>=8.4.1; extra == 'dev'
Requires-Dist: sphinx<9,>=8.1.3; extra == 'dev'
Provides-Extra: remote
Requires-Dist: paramiko>=3.4; extra == 'remote'
Description-Content-Type: text/markdown

<div align="center">

# ABQ-FLOW

**Modular batch-processing framework for [Abaqus FEA](https://www.3ds.com/products/simulia/abaqus) based on [python](https://www.python.org/).**
Typed job specs, strategy-pattern workflows, fault-tolerant parallel execution, resource-aware scheduling — no more hand-crafted launch scripts.

[![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)  ![Version](https://img.shields.io/badge/version-v0.6.0-green.svg?style=flat-square) ![python](https://img.shields.io/badge/python-3.9+-blue.svg)
<!-- ↑ version badge: update on release (single source: pyproject.toml) -->

English | [简体中文](../README.zh-CN.md) 

</div>

## Features

- **⚒️ Strategy-pattern workflows**: compose preparation, extraction, and simulation steps into reusable pipelines
- **📗 Typed configuration**: `JobSpec` dataclasses validate before execution, no silent `KeyError` at runtime
- **🔒 Fault-tolerant parallel execution**: `ProcessPoolExecutor` + `JobOutcome` envelope; one failed job won't kill the batch
- **💻 Extensible**: register custom preparation strategies without modifying framework code

## Installation

Install from PyPI:

```bash
pip install ABQflow
```

If you want the optional `abqpy` integration path:

```bash
pip install "ABQflow[abqpy]"
```

If you manage environments with Pixi:

```bash
pixi add --pypi ABQflow
```

**Prerequisites:** Abaqus (with `abaqus` on PATH), Python ≥ 3.9. `abqpy` is optional and only needed when you want to run eligible scripts through plain `python` instead of the Abaqus kernel.

## Packaging

Build a source distribution and wheel locally with:

```bash
python -m build
```

Then upload the artifacts from `dist/` to TestPyPI or PyPI.

## How to use?

### Single parameterized job

```python
from ABQflow import BatchAbaqusProcessor, JobSpec, PreparationSpec, HookSpec

spec = JobSpec(
    job_name = "planar_stress_odb",
    workflow = "modular",
    preparation = PreparationSpec(
        kind = "inp_based",
        source_path = "./examples/cae_file/planar_stress_template.inp",
        params = {
            "youngs_modulus": 210000,
            "load_magnitude": 2000,
        }
    ),
    post_extraction = [
        HookSpec(
            script_path = "./examples/extraction_scripts/get_max_stress_mises.py",
            tasks = [
                {"result_name": "max_stress_mises",},
                {"result_name": "max_displacement",},
            ]
        )
    ]
)

processor_odb = BatchAbaqusProcessor(
    batch_data = [spec],
    base_output_dir = os.path.join(CWD, "examples/01_SingleParameterizedJob/output"),
    cpus_per_job = 4,
    duplicate_mode = "overwrite",
    abaqus_exe = ABAQUS_CAE,
)
outcomes = processor.run_batch(num_parallel_jobs=1)

for oc in outcomes:
    print(f"{oc.job_name}: {oc.status} → {oc.results}")
```


## License

MIT License | See [LICENSE](LICENSE) for more details
