Skip to main content

OpenPinch

CI Develop Documentation Status PyPI version Python versions License: MIT

OpenPinch is an open-source Python toolkit for advanced Pinch Analysis and Total Site Integration. It supports direct and indirect heat integration targeting, graph interpretation, Heat Pump and refrigeration screening, exergy and cogeneration post-processing, heat exchanger network synthesis, multi-period analysis, stream piece-wise linearisation (for variable heat capacity and phase change streams), and file-backed or schema-first workflows.

Full documentation is available at https://openpinch.readthedocs.io/en/latest/.

Install

Install the base package for validation, targeting, summaries, and schema-first Python workflows:

python -m pip install openpinch

Install optional extras only for the workflows that need them:

python -m pip install "openpinch[notebook]"      # Jupyter, Plotly graphs, Excel I/O
python -m pip install "openpinch[dashboard]"     # Streamlit dashboard
python -m pip install "openpinch[synthesis]"     # HEN synthesis, then run: idaes get-extensions
python -m pip install "openpinch[brayton_cycle]" # TESPy-backed Brayton-cycle tooling
python -m pip install "openpinch[tespy]"          # TESPy HPR targeting and performance maps
python -m pip install "openpinch[full]"          # all optional surfaces, including synthesis

OpenPinch currently requires Python >=3.14.2.

Both synthesis and full install the IDAES/Pyomo synthesis stack. Complete the IDAES installation before running solver-backed workflows:

idaes get-extensions

First Solve

OpenPinch exposes two package-root workflow classes. Use PinchProblem for one case and PinchWorkspace for named cases and scenarios.

from OpenPinch import PinchProblem

problem = PinchProblem(
    {
        "streams": [
            {
                "name": "Hot feed",
                "zone": "Process",
                "t_supply": 180.0,
                "t_target": 80.0,
                "heat_flow": 1000.0,
            },
            {
                "name": "Cold feed",
                "zone": "Process",
                "t_supply": 20.0,
                "t_target": 120.0,
                "heat_flow": 800.0,
            },
        ],
        "utilities": [],
    },
    project_name="First solve",
)
problem.validate()
problem.target.all_heat_integration()

print(problem.summary_frame())

Analysis is explicit: named methods execute work, while summaries, reports, plots, and exports consume prepared or cached state.

Packaged Resources

OpenPinch ships maintained sample cases and notebook workflows. The resource helpers below are useful repository tooling, but are not compatibility protected:

from OpenPinch.resources import (
    list_notebooks,
    list_sample_cases,
    notebook_metadata,
    sample_case_metadata,
)

print(list_sample_cases())
print(sample_case_metadata("basic_pinch.json").description)
print(list_notebooks())
print(notebook_metadata("01_first_solve_and_core_curves.ipynb").title)

Copy the notebook series from the CLI:

openpinch notebook -o notebooks

Notebooks and sample cases live in OpenPinch/tutorials/notebooks and OpenPinch/tutorials/sample_cases, with discovery and copying available through OpenPinch.resources.

The nineteen-notebook series progresses from first solve through multiperiod HPR, cogeneration, HEN synthesis, and publication workflows.

The CLI intentionally copies notebooks only. Solves, validation, graph export, Excel export, dashboards, and advanced targeting happen through Python.

Documentation Map

Testing

Run the test suite locally:

uv sync --frozen --group dev
uv run --no-sync ruff check .
uv run --no-sync coverage run --branch --source=OpenPinch -m pytest --hypothesis-seed=20260715 -m "not solver"
uv run --no-sync coverage report --fail-under=95
uv run --no-sync python scripts/build_docs.py
uv run --no-sync python scripts/build_dist.py

Ubuntu runs the complete CI suite. Windows and macOS install the generated wheel and verify the core import, CLI, and packaged resources. Tests marked solver require external solver binaries; the release workflow installs the IDAES extensions and runs this gate automatically. Run it locally with uv run pytest -m solver when the required binaries are available.

Release Process

  1. For a same-repository pull request targeting main, the PR workflow automatically advances an unchanged release version before validating it. A major, minor, or patch label takes precedence, followed by a matching title marker such as [minor]; the default is patch. The bump updates pyproject.toml, uv.lock, and .bumpversion.toml together without creating a tag. Fork pull requests remain read-only and must provide those synchronized forward-version changes in the contributor branch.
  2. The ordered release-version job checks out and validates the updated PR head after the bump. Any later synchronize run or manual rerun recognizes the already-forward version without another commit. Merge only after the validation jobs, external-solver suite, and aggregate pr-gate result pass.
  3. The main-branch workflow repeats the test, documentation, solver, build, and cross-platform artifact gates.
  4. After those gates pass, it creates the annotated version tag and a draft GitHub release with checksummed release artifacts, then publishes the same distributions to TestPyPI. Preflight and postflight checks require the exact expected filenames and SHA-256 hashes, including safe recovery from a partial upload.
  5. After TestPyPI succeeds:
    • it publishes the GitHub release before production PyPI
    • it dispatches the same workflow at the version tag
  6. The tag-ref run verifies the source push, workflow, prerequisite jobs, and immutable build artifact ID, digest, and build attempt. It then requires the public release files to match that artifact byte-for-byte without rebuilding and waits at the protected pypi environment.
  7. Approve that deployment to use PyPI Trusted Publishing; the workflow uploads the verified distributions and confirms the version through the PyPI API.

The automatic pull-request bump is idempotent: a candidate already greater than the base is validated without another commit, while a candidate behind the base fails for manual reconciliation. Version bumping does not create a tag. The release workflow owns tags and rejects malformed versions, mismatched lock metadata, or an existing tag that points anywhere other than the main-branch release commit. If production publication or its availability check fails after the GitHub Release becomes public, open the original tag run and select Re-run failed jobs. Exact index preflight, skip-existing, and a separately retryable availability check make an absent, partial, or already-complete release recoverable without accepting mismatched files. Do not start a fresh tag dispatch when the upload may already have succeeded.

Build the documentation locally:

uv run scripts/build_docs.py

History and Citation

OpenPinch started in 2011 as an Excel workbook with macros. The Python implementation began in 2021 to make the workflows scriptable and testable.

In publications and forks, please cite and link the foundational article and this repository:

Timothy Gordon Walmsley, 2026. OpenPinch: An Open-Source Python Library for Advanced Pinch Analysis and Total Site Integration. Process Integration and Optimization for Sustainability. https://doi.org/10.1007/s41660-026-00729-6

Contributors

Founder: Tim Walmsley, University of Waikato

Stephen Burroughs, Benjamin Lincoln, Alex Geary, Harrison Whiting, Khang Tran, Roger Padulles, Jasper Walden, Caleb Archer

License

OpenPinch is released under the MIT License. See LICENSE for details.

Release files for OpenPinch 0.6.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for OpenPinch 0.6.7
File Size Uploaded
openpinch-0.6.7.tar.gz 536.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for OpenPinch 0.6.7
File Interpreter ABI Platform
openpinch-0.6.7-py3-none-any.whl Python 3 none any Details

Total release size: 1.3 MB

Release files / openpinch-0.6.7.tar.gz

Download URL openpinch-0.6.7.tar.gz
Size 536.9 kB
Tags Source
SHA-256 checksum
How to use checksums
6122d8de3a75640313f2ebe9223fba149a995a191dd09ce97cdf5ded1c067b04
BLAKE2b-256 checksum
How to use checksums
225073ebf21bac32b144b5966d3577e0cef383ffa66212e7eb9668966ea5727f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 18, 2026.

Transparency log

Release files / openpinch-0.6.7-py3-none-any.whl

Download URL openpinch-0.6.7-py3-none-any.whl
Size 739.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9c2c33f611f48e42c37f4ad32479ca4e924d8d927fdcd3ec9d682e323ef3f264
BLAKE2b-256 checksum
How to use checksums
6f516452a63325fdf1d52103505a1c224e9abb9c32c5dddada082850883e4346
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 18, 2026.

Transparency log

Release history Release notifications | RSS feed

0.6.9

2 release files

0.6.8

2 release files

This release

0.6.7 This release

2 release files

0.6.6

2 release files

0.6.5

2 release files

0.6.4

2 release files

0.6.3

2 release files

0.6.0

2 release files

0.5.4

2 release files

0.4.5

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.2.9

2 release files

0.2.8

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.28

2 release files

0.1.27

2 release files

0.1.26

2 release files

0.1.24

2 release files

0.1.23

2 release files

0.1.22

2 release files

0.1.21

2 release files

0.1.14

2 release files

0.1.10

2 release files

0.1.9

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.28

2 release files

0.0.27

2 release files

0.0.26

2 release files

0.0.22

2 release files

0.0.21

2 release files

0.0.18

2 release files

0.0.17

2 release files

0.0.15

2 release files

0.0.14

2 release files

0.0.13

2 release files

0.0.12

2 release files

0.0.11

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page