CLI and Resources

OpenPinch ships with a real command-line interface and packaged learning assets in addition to the Python API. Those surfaces matter because much of the package’s practical power is meant to be discoverable without writing code from scratch, but the codebase treats them differently: the CLI copies notebooks, while the resource helpers expose both notebooks and sample cases to Python.

Command-Line Interface

The published package currently exposes one CLI subcommand:

  • notebook for copying packaged example notebooks

Command-line helpers for packaged OpenPinch notebook assets.

OpenPinch.__main__.build_parser()[source]

Create the CLI argument parser.

Return type:

ArgumentParser

OpenPinch.__main__.main(argv=None)[source]

Execute the OpenPinch CLI.

Parameters:

argv (list[str] | None)

Return type:

int

This means the CLI is an onboarding surface, not a solve surface. Validation, targeting, graph export, Excel export, and dashboard launch all happen through Python.

Packaged Resources

The resources module exposes the packaged sample cases and notebooks used throughout the guides and examples.

The main helpers are:

  • list_sample_cases() and read_sample_case() for discovery and inspection

  • copy_sample_case() for local editable copies

  • list_notebooks() and copy_notebook() for the packaged notebook series

PinchProblem and PinchWorkspace also resolve packaged sample-case names such as basic_pinch.json directly when no local file with the same name exists.

The packaged notebooks are intended to be copied as clean source assets. They ship without stored execution output and rely on the same public PinchWorkspace and plotting surfaces documented elsewhere in RTD.

The current optional install split is:

  • openpinch[notebook] for Jupyter, Plotly graph rendering, and Excel I/O

  • openpinch[dashboard] for Streamlit plus the same plotting/export stack

  • openpinch[brayton_cycle] for TESPy-backed Brayton-cycle tooling

  • openpinch[full] for the combined optional surface

Helpers for accessing packaged OpenPinch sample cases and notebooks.

OpenPinch.resources.list_sample_cases()[source]

Return the packaged sample-case filenames.

Return type:

list[str]

OpenPinch.resources.list_notebooks()[source]

Return the packaged notebook filenames.

Return type:

list[str]

OpenPinch.resources.read_sample_case(name)[source]

Return the text of a packaged sample case.

Parameters:

name (str)

Return type:

str

OpenPinch.resources.copy_sample_case(name, destination)[source]

Copy a packaged sample case to destination.

Parameters:
Return type:

Path

OpenPinch.resources.copy_notebook(name, destination)[source]

Copy a packaged notebook to destination.

Parameters:
Return type:

Path

Packaged Asset Modules

Packaged data assets for examples and notebooks.

Packaged sample cases for OpenPinch user workflows.

Packaged example notebooks for OpenPinch user workflows.

Dashboard Surface

OpenPinch also includes a Streamlit-oriented graphing and dashboard path for interactive exploration after solving a problem. Install openpinch[dashboard] before using this surface.

The repository-level streamlit_app.py module is documented here as a local demo entrypoint for contributors. It is not part of the published wheel. For installed package usage, prefer OpenPinch.PinchProblem.show_dashboard() or OpenPinch.streamlit_webviewer.web_graphing.render_streamlit_dashboard().

Streamlit entry point for exploring OpenPinch analysis results.

Run with streamlit run streamlit_app.py to load the bundled demonstration case and launch the interactive dashboard defined in OpenPinch.streamlit_webviewer.web_graphing.

streamlit_app.validate_problem_path(problem_path)[source]

Stop the Streamlit app early when the configured problem file is missing.

Return type:

None

Where This Fits

Use the CLI and packaged resources when you want reproducible examples, shareable learning assets, or a fast onboarding path. Use the Python API pages when you need integration into scripts, notebooks, or larger applications.