Package Root

The OpenPinch package root is the primary import surface for notebooks, small scripts, and lightweight applications. It intentionally re-exports a small set of high-value entry points so most users do not need to navigate the full module tree.

Typical Pattern

from OpenPinch import PinchProblem, PinchWorkspace, pinch_analysis_service
from OpenPinch.lib.schemas.io import TargetInput

problem = PinchProblem("basic_pinch.json")
result = problem.target()

workspace = PinchWorkspace(
    source="crude_preheat_train.json",
    project_name="crude_preheat_train",
)
workspace.copy_case("baseline", "wide_dt", activate=False)
workspace.set_dt_cont_multiplier(0.5, case_name="wide_dt")
comparison = workspace.compare_cases("baseline", "wide_dt")

The package root is intentionally small. If your workflow starts depending on prepared zones, direct service orchestration, or lower-level targeting algorithms, move down into the pages under Service Layer and Domain Model.

It is also a Python-first surface. The package root does not hide the fact that real solves, comparisons, exports, and advanced targeting happen through Python objects even though the project also ships packaged learning notebooks.

Root Exports

OpenPinch public API.

High-Level Service Function

OpenPinch.main.pinch_analysis_service(data, project_name='Project')[source]

Validate input data, run targeting, and return TargetOutput.

Parameters:
  • data (Any) – Raw request data matching OpenPinch.lib.schemas.io.TargetInput. Dictionaries, Pydantic models, and dataclass-like objects are accepted.

  • project_name (str) – Optional label used in generated graphs and result files.

Returns:

Validated response data containing solved targets and graph data.

Return type:

TargetOutput

Package-Level Re-Export Notes

The root package also re-exports the contents of OpenPinch.lib. That is useful for interactive work, but for larger codebases it is usually clearer to import schemas, enums, and configuration types from their explicit modules.

Use Schemas and Config when you need the typed input/config layer, and Generated Appendix when you need exhaustive module-level details.