processforge 0.6.2__tar.gz → 0.6.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (163) hide show
  1. {processforge-0.6.2/src/processforge.egg-info → processforge-0.6.3}/PKG-INFO +2 -2
  2. {processforge-0.6.2 → processforge-0.6.3}/pyproject.toml +2 -2
  3. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/__init__.py +1 -5
  4. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/cli/init.py +0 -24
  5. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/cli/run.py +4 -4
  6. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/cli/runs.py +16 -0
  7. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/output_collector.py +1 -1
  8. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/provenance.py +1 -1
  9. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/result.py +85 -48
  10. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/runner.py +11 -9
  11. {processforge-0.6.2 → processforge-0.6.3/src/processforge.egg-info}/PKG-INFO +2 -2
  12. {processforge-0.6.2 → processforge-0.6.3}/src/processforge.egg-info/requires.txt +1 -1
  13. {processforge-0.6.2 → processforge-0.6.3}/tests/test_cli.py +4 -4
  14. {processforge-0.6.2 → processforge-0.6.3}/LICENSE +0 -0
  15. {processforge-0.6.2 → processforge-0.6.3}/MANIFEST.in +0 -0
  16. {processforge-0.6.2 → processforge-0.6.3}/README.md +0 -0
  17. {processforge-0.6.2 → processforge-0.6.3}/flowsheets/closed-loop-chain.json +0 -0
  18. {processforge-0.6.2 → processforge-0.6.3}/flowsheets/coupled/msre_coupled.json +0 -0
  19. {processforge-0.6.2 → processforge-0.6.3}/flowsheets/custom/crimson/MUWS_HB.json +0 -0
  20. {processforge-0.6.2 → processforge-0.6.3}/flowsheets/custom/crimson/simple_water_system.json +0 -0
  21. {processforge-0.6.2 → processforge-0.6.3}/flowsheets/custom/simple_hyrdaulic_scheme.json +0 -0
  22. {processforge-0.6.2 → processforge-0.6.3}/flowsheets/festim/hydrogen_transport_1d.json +0 -0
  23. {processforge-0.6.2 → processforge-0.6.3}/flowsheets/festim/tds_tungsten.json +0 -0
  24. {processforge-0.6.2 → processforge-0.6.3}/flowsheets/hydraulic-chain.json +0 -0
  25. {processforge-0.6.2 → processforge-0.6.3}/flowsheets/openmc/msre_eigenvalue.json +0 -0
  26. {processforge-0.6.2 → processforge-0.6.3}/setup.cfg +0 -0
  27. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/__main__.py +0 -0
  28. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/_schema.py +0 -0
  29. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/analysis/__init__.py +0 -0
  30. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/analysis/dof.py +0 -0
  31. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/api/__init__.py +0 -0
  32. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/api/serve.py +0 -0
  33. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/cli/__init__.py +0 -0
  34. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/cli/apply.py +0 -0
  35. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/cli/common.py +0 -0
  36. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/cli/diagram.py +0 -0
  37. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/cli/display.py +0 -0
  38. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/cli/export_fmu.py +0 -0
  39. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/cli/export_modelica.py +0 -0
  40. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/cli/persist.py +0 -0
  41. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/cli/plan.py +0 -0
  42. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/cli/validate.py +0 -0
  43. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/compose.py +0 -0
  44. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/coupling.py +0 -0
  45. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/eo/__init__.py +0 -0
  46. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/eo/backends/__init__.py +0 -0
  47. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/eo/backends/base.py +0 -0
  48. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/eo/backends/casadi_backend.py +0 -0
  49. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/eo/backends/pyomo_backend.py +0 -0
  50. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/eo/backends/scipy_backend.py +0 -0
  51. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/eo/flowsheet.py +0 -0
  52. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/eo/jacobian.py +0 -0
  53. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/eo/mixin.py +0 -0
  54. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/eo/solver.py +0 -0
  55. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/eo/stream_var.py +0 -0
  56. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/eo/units/__init__.py +0 -0
  57. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/eo/units/flash_eo.py +0 -0
  58. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/eo/units/heater_eo.py +0 -0
  59. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/eo/units/pipes_eo.py +0 -0
  60. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/eo/units/pump_eo.py +0 -0
  61. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/eo/units/strainer_eo.py +0 -0
  62. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/eo/units/valve_eo.py +0 -0
  63. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/flowsheet.py +0 -0
  64. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/fmu/__init__.py +0 -0
  65. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/fmu/_fmi_vars.py +0 -0
  66. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/fmu/builder.py +0 -0
  67. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/fmu/interface.py +0 -0
  68. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/fmu/slave_template.py +0 -0
  69. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/lock.py +0 -0
  70. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/modelica/__init__.py +0 -0
  71. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/modelica/mo_writer.py +0 -0
  72. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/modelica/omc_runner.py +0 -0
  73. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/modelica/transpiler.py +0 -0
  74. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/modelica/unit_equations.py +0 -0
  75. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/pathsim/__init__.py +0 -0
  76. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/pathsim/adapter.py +0 -0
  77. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/pcl/__init__.py +0 -0
  78. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/pcl/compiler.py +0 -0
  79. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/pcl/namespace.py +0 -0
  80. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/persistence/__init__.py +0 -0
  81. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/persistence/archive.py +0 -0
  82. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/persistence/artifact_store.py +0 -0
  83. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/providers/__init__.py +0 -0
  84. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/providers/_sim_strategy.py +0 -0
  85. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/providers/base.py +0 -0
  86. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/providers/base_jacobian_mixin.py +0 -0
  87. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/providers/base_simulation_provider.py +0 -0
  88. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/providers/cantera_jacobian.py +0 -0
  89. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/providers/cantera_provider.py +0 -0
  90. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/providers/container_client.py +0 -0
  91. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/providers/coolprop_provider.py +0 -0
  92. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/providers/errors.py +0 -0
  93. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/providers/festim/__init__.py +0 -0
  94. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/providers/festim/build_helpers.py +0 -0
  95. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/providers/festim/provider.py +0 -0
  96. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/providers/festim/result_extraction.py +0 -0
  97. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/providers/festim/strategies.py +0 -0
  98. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/providers/jacobian_contributor.py +0 -0
  99. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/providers/manager.py +0 -0
  100. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/providers/modelica_jacobian.py +0 -0
  101. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/providers/modelica_provider.py +0 -0
  102. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/providers/openmc/__init__.py +0 -0
  103. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/providers/openmc/build_helpers.py +0 -0
  104. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/providers/openmc/provider.py +0 -0
  105. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/providers/openmc/result_extraction.py +0 -0
  106. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/providers/openmc/strategies.py +0 -0
  107. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/providers/reference_state_registry.py +0 -0
  108. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/providers/registry.py +0 -0
  109. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/quantity.py +0 -0
  110. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/result_schema.py +0 -0
  111. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/schemas/__init__.py +0 -0
  112. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/schemas/festim/festim_model.py +0 -0
  113. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/schemas/flowsheet_schema.json +0 -0
  114. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/schemas/openmc/openmc_model.py +0 -0
  115. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/simulate.py +0 -0
  116. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/solver.py +0 -0
  117. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/state.py +0 -0
  118. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/thermo.py +0 -0
  119. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/types.py +0 -0
  120. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/units/__init__.py +0 -0
  121. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/units/base.py +0 -0
  122. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/units/cstr.py +0 -0
  123. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/units/flash.py +0 -0
  124. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/units/heater.py +0 -0
  125. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/units/pfr.py +0 -0
  126. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/units/pipes.py +0 -0
  127. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/units/pump.py +0 -0
  128. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/units/registry.py +0 -0
  129. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/units/solver_unit.py +0 -0
  130. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/units/strainer.py +0 -0
  131. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/units/tank.py +0 -0
  132. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/units/valve.py +0 -0
  133. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/utils/__init__.py +0 -0
  134. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/utils/flowsheet_diagram.py +0 -0
  135. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/utils/mermaid_diagram.py +0 -0
  136. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/utils/s3_upload.py +0 -0
  137. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/utils/topology.py +0 -0
  138. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/utils/unit_consistency.py +0 -0
  139. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/utils/validate_flowsheet.py +0 -0
  140. {processforge-0.6.2 → processforge-0.6.3}/src/processforge/utils/validation.py +0 -0
  141. {processforge-0.6.2 → processforge-0.6.3}/src/processforge.egg-info/SOURCES.txt +0 -0
  142. {processforge-0.6.2 → processforge-0.6.3}/src/processforge.egg-info/dependency_links.txt +0 -0
  143. {processforge-0.6.2 → processforge-0.6.3}/src/processforge.egg-info/entry_points.txt +0 -0
  144. {processforge-0.6.2 → processforge-0.6.3}/src/processforge.egg-info/top_level.txt +0 -0
  145. {processforge-0.6.2 → processforge-0.6.3}/tests/test_artifact_store.py +0 -0
  146. {processforge-0.6.2 → processforge-0.6.3}/tests/test_container_client.py +0 -0
  147. {processforge-0.6.2 → processforge-0.6.3}/tests/test_coupling.py +0 -0
  148. {processforge-0.6.2 → processforge-0.6.3}/tests/test_display.py +0 -0
  149. {processforge-0.6.2 → processforge-0.6.3}/tests/test_festim_provider.py +0 -0
  150. {processforge-0.6.2 → processforge-0.6.3}/tests/test_festim_schema.py +0 -0
  151. {processforge-0.6.2 → processforge-0.6.3}/tests/test_fmu_solverunit.py +0 -0
  152. {processforge-0.6.2 → processforge-0.6.3}/tests/test_init.py +0 -0
  153. {processforge-0.6.2 → processforge-0.6.3}/tests/test_openmc_provider.py +0 -0
  154. {processforge-0.6.2 → processforge-0.6.3}/tests/test_pathsim_adapter.py +0 -0
  155. {processforge-0.6.2 → processforge-0.6.3}/tests/test_persist.py +0 -0
  156. {processforge-0.6.2 → processforge-0.6.3}/tests/test_provider_errors.py +0 -0
  157. {processforge-0.6.2 → processforge-0.6.3}/tests/test_providers.py +0 -0
  158. {processforge-0.6.2 → processforge-0.6.3}/tests/test_result_zarr.py +0 -0
  159. {processforge-0.6.2 → processforge-0.6.3}/tests/test_runner.py +0 -0
  160. {processforge-0.6.2 → processforge-0.6.3}/tests/test_runs_command.py +0 -0
  161. {processforge-0.6.2 → processforge-0.6.3}/tests/test_s3_upload.py +0 -0
  162. {processforge-0.6.2 → processforge-0.6.3}/tests/test_state.py +0 -0
  163. {processforge-0.6.2 → processforge-0.6.3}/tests/test_types.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: processforge
3
- Version: 0.6.2
3
+ Version: 0.6.3
4
4
  Summary: A Python-based process simulation framework for chemical engineering applications.
5
5
  Author-email: Processforge Team <team@processforge.dev>
6
6
  License-Expression: BSD-3-Clause
@@ -22,8 +22,8 @@ License-File: LICENSE
22
22
  Requires-Dist: numpy>=2.0
23
23
  Requires-Dist: pydantic>=2.0
24
24
  Requires-Dist: scipy>=1.14
25
- Requires-Dist: matplotlib>=3.9
26
25
  Requires-Dist: loguru>=0.7
26
+ Requires-Dist: plotext>=5.2
27
27
  Requires-Dist: jsonschema>=4.20
28
28
  Requires-Dist: graphviz>=0.20
29
29
  Requires-Dist: pandas>=2.2
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "processforge"
7
- version = "0.6.2"
7
+ version = "0.6.3"
8
8
  description = "A Python-based process simulation framework for chemical engineering applications."
9
9
  readme = "README.md"
10
10
  license = "BSD-3-Clause"
@@ -28,8 +28,8 @@ dependencies = [
28
28
  "numpy>=2.0",
29
29
  "pydantic>=2.0",
30
30
  "scipy>=1.14",
31
- "matplotlib>=3.9",
32
31
  "loguru>=0.7",
32
+ "plotext>=5.2",
33
33
  "jsonschema>=4.20",
34
34
  "graphviz>=0.20",
35
35
  "pandas>=2.2",
@@ -10,14 +10,12 @@ Provides steady-state and dynamic process simulation capabilities including:
10
10
  - Equation-oriented (EO) steady-state solver via EOFlowsheet
11
11
  """
12
12
 
13
- __version__ = "0.6.2"
13
+ __version__ = "0.6.3"
14
14
 
15
15
  from .eo import EOFlowsheet, EOSolver
16
16
  from .flowsheet import Flowsheet
17
17
  from .provenance import build_run_info
18
18
  from .result import (
19
- plot_results,
20
- plot_timeseries,
21
19
  save_results_zarr,
22
20
  )
23
21
  from .runner import (
@@ -66,8 +64,6 @@ __all__ = [
66
64
  "__version__",
67
65
  "apply_flowsheet",
68
66
  "build_run_info",
69
- "plot_results",
70
- "plot_timeseries",
71
67
  "rachford_rice",
72
68
  "run_flowsheet",
73
69
  "save_results_zarr",
@@ -3,7 +3,6 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  import importlib.util
6
- import json
7
6
  import os
8
7
  import shutil
9
8
  import subprocess
@@ -116,29 +115,6 @@ def init(
116
115
  # dir so existing repos aren't silently broken by the new structure.
117
116
  _migrate_legacy_env(pf_dir)
118
117
 
119
- # Write config.json (always)
120
- config_path = os.path.join(pf_dir, "config.json")
121
- if not os.path.exists(config_path):
122
- default_config = {
123
- "version": 1,
124
- "default_backend": "scipy",
125
- "outputs_dir": "outputs",
126
- }
127
- with open(config_path, "w", encoding="utf-8") as f:
128
- json.dump(default_config, f, indent=2)
129
- logger.info(f"Created {config_path}")
130
- else:
131
- logger.info(f"{config_path} already exists — skipped.")
132
-
133
- # Honour a configured outputs_dir for the rest of init.
134
- outputs_dir_name = "outputs"
135
- try:
136
- with open(config_path, encoding="utf-8") as f:
137
- outputs_dir_name = json.load(f).get("outputs_dir", "outputs")
138
- except Exception:
139
- pass
140
- outputs_dir = os.path.join(root, outputs_dir_name)
141
-
142
118
  # Remove stale .pfstate snapshot directories from outputs/
143
119
  stale_count = 0
144
120
  for entry in os.listdir(outputs_dir):
@@ -9,15 +9,15 @@ from ..runner import ProcessforgeRunError, run_flowsheet
9
9
 
10
10
  def run(
11
11
  flowsheet: str = typer.Argument(help="Path to the flowsheet JSON file"),
12
- export_images: bool = typer.Option(
12
+ no_plot: bool = typer.Option(
13
13
  False,
14
- "--export-images",
15
- help="Generate PNG plots for simulation outputs",
14
+ "--no-plot",
15
+ help="Skip terminal plots for simulation outputs",
16
16
  ),
17
17
  ) -> None:
18
18
  """Run a process simulation from a flowsheet JSON file."""
19
19
  try:
20
- result = run_flowsheet(flowsheet, export_images=export_images)
20
+ result = run_flowsheet(flowsheet, no_plot=no_plot)
21
21
  except ProcessforgeRunError as exc:
22
22
  logger.error(str(exc))
23
23
  raise SystemExit(1) from exc
@@ -15,6 +15,7 @@ from ..result import (
15
15
  _fmt_scientific,
16
16
  _one_line_summary,
17
17
  _scalar_from_sequence,
18
+ plot_zarr_summary_terminal,
18
19
  summarize_zarr_store,
19
20
  )
20
21
 
@@ -157,6 +158,11 @@ def runs(
157
158
  "--schema",
158
159
  help="Print the result schema JSON instead of the summary.",
159
160
  ),
161
+ no_plot: bool = typer.Option(
162
+ False,
163
+ "--no-plot",
164
+ help="Skip terminal plots for the run summary.",
165
+ ),
160
166
  ):
161
167
  """List runs for a flowsheet, or inspect one run's Zarr result summary."""
162
168
  base = flowsheet_basename(flowsheet)
@@ -197,6 +203,16 @@ def runs(
197
203
  manifest = archive.load_run(resolved_id)
198
204
  summary = summarize_zarr_store(zarr_path)
199
205
  summary["_zarr_path"] = zarr_path
206
+
207
+ if not no_plot:
208
+ plot_title = f"{base} / {resolved_id}"
209
+ try:
210
+ plot_zarr_summary_terminal(summary, title=plot_title)
211
+ except Exception as exc: # noqa: BLE001
212
+ logger.warning(
213
+ f"Failed to render terminal plots: {type(exc).__name__}: {exc}"
214
+ )
215
+
200
216
  typer.echo(_format_run_compact(manifest, summary))
201
217
  return
202
218
 
@@ -36,7 +36,7 @@ def _to_scalar(value):
36
36
 
37
37
  Dynamic simulations store stream properties as timeseries lists. For
38
38
  manifest-level thermo output we use the final timestep as the representative
39
- scalar, matching the convention used by :func:`~processforge.result.plot_results`.
39
+ scalar, matching the convention used by terminal result plots.
40
40
  """
41
41
  if isinstance(value, (list, tuple, np.ndarray)):
42
42
  arr = np.asarray(value)
@@ -18,7 +18,7 @@ _KEY_PACKAGES = [
18
18
  "loguru",
19
19
  "pandas",
20
20
  "openpyxl",
21
- "matplotlib",
21
+ "plotext",
22
22
  "jsonschema",
23
23
  "graphviz",
24
24
  ]
@@ -5,7 +5,7 @@ from datetime import datetime, timezone
5
5
 
6
6
  import numpy as np
7
7
  import pandas as pd
8
- import matplotlib.pyplot as plt
8
+ import plotext as plt
9
9
  import zarr
10
10
  from loguru import logger
11
11
 
@@ -355,44 +355,54 @@ def save_results_zarr_s3(results, s3_uri: str, run_info: RunInfo | dict | None =
355
355
  logger.info(f"Saved Zarr results to {s3_uri}")
356
356
 
357
357
 
358
- def plot_results(results, fname="results.png"):
359
- os.makedirs("outputs", exist_ok=True)
360
- streams = list(results.keys())
358
+ def _plotext_figure():
359
+ """Return a fresh plotext figure with a sensible terminal size."""
360
+ fig = plt.figure
361
+ fig.clear()
362
+ fig.plot_size(80, 18)
363
+ return fig
364
+
365
+
366
+ def plot_results_terminal(results, title=""):
367
+ """Render steady-state stream results as terminal bar charts."""
368
+ streams = [k for k, v in results.items() if isinstance(v, dict) and "T" in v]
369
+ if not streams:
370
+ return
371
+
361
372
  temp_values = [_scalar_from_sequence(results[s].get("T")) or 0.0 for s in streams]
362
373
 
363
- plt.figure(figsize=(8, 4))
364
- plt.bar(streams, temp_values, color="skyblue")
365
- plt.ylabel("Temperature [K]")
366
- plt.title("Stream Temperatures (Steady State)")
367
- plt.tight_layout()
368
- plt.savefig(os.path.join("outputs", "temps_" + fname))
369
- plt.close()
374
+ fig = _plotext_figure()
375
+ fig.draw(fig.bar(streams, temp_values, orientation="vertical"))
376
+ fig.title(title or "Stream Temperatures (Steady State)")
377
+ fig.show()
378
+ fig.clear()
370
379
 
371
380
  comps = set()
372
- for s in results.values():
373
- comps.update(s.get("z", {}).keys())
381
+ for s in streams:
382
+ z = results[s].get("z")
383
+ if isinstance(z, dict):
384
+ comps.update(z.keys())
374
385
  comps = sorted(comps)
386
+ if not comps:
387
+ return
375
388
 
376
- bottom = [0.0] * len(streams)
377
- plt.figure(figsize=(8, 4))
389
+ values = []
378
390
  for comp in comps:
379
- vals = [
391
+ values.append([
380
392
  _scalar_from_sequence(results[s].get("z", {}).get(comp, 0.0)) or 0.0
381
393
  for s in streams
382
- ]
383
- plt.bar(streams, vals, bottom=bottom, label=comp)
384
- bottom = [bottom[i] + vals[i] for i in range(len(vals))]
385
- plt.ylabel("Mole Fraction")
386
- plt.title("Stream Compositions (Steady State)")
387
- plt.legend()
388
- plt.tight_layout()
389
- plt.savefig(os.path.join("outputs", "comps_" + fname))
390
- plt.close()
391
-
392
-
393
- def plot_timeseries(results, fname="timeseries.png"):
394
- os.makedirs("outputs", exist_ok=True)
395
- streams = sorted(results.keys())
394
+ ])
395
+
396
+ fig = _plotext_figure()
397
+ fig.draw(fig.bar(streams, values, orientation="vertical", stacked=True))
398
+ fig.title(title or "Stream Compositions (Steady State)")
399
+ fig.show()
400
+ fig.clear()
401
+
402
+
403
+ def plot_timeseries_terminal(results, title=""):
404
+ """Render dynamic stream results as terminal line plots."""
405
+ streams = sorted(k for k, v in results.items() if isinstance(v, dict))
396
406
  if not streams:
397
407
  return
398
408
 
@@ -400,17 +410,13 @@ def plot_timeseries(results, fname="timeseries.png"):
400
410
  if not times:
401
411
  return
402
412
 
403
- plt.figure(figsize=(8, 5))
413
+ fig = _plotext_figure()
404
414
  for s_name in streams:
405
415
  if "T" in results[s_name]:
406
- plt.plot(times, results[s_name]["T"], label=s_name)
407
- plt.xlabel("Time [s]")
408
- plt.ylabel("Temperature [K]")
409
- plt.title("Stream Temperatures vs Time")
410
- plt.legend()
411
- plt.tight_layout()
412
- plt.savefig(os.path.join("outputs", "temps_" + fname))
413
- plt.close()
416
+ fig.draw(fig.signal(times, results[s_name]["T"]).label(s_name))
417
+ fig.title(title or "Stream Temperatures vs Time")
418
+ fig.show()
419
+ fig.clear()
414
420
 
415
421
  comps = set()
416
422
  for s_data in results.values():
@@ -421,17 +427,48 @@ def plot_timeseries(results, fname="timeseries.png"):
421
427
  for s_name in streams:
422
428
  if "z" not in results[s_name]:
423
429
  continue
424
- plt.figure(figsize=(8, 5))
430
+ fig = _plotext_figure()
425
431
  for comp in comps:
426
432
  if comp in results[s_name]["z"]:
427
- plt.plot(times, results[s_name]["z"][comp], label=comp)
428
- plt.xlabel("Time [s]")
429
- plt.ylabel("Mole Fraction")
430
- plt.title(f"Compositions vs Time ({s_name})")
431
- plt.legend()
432
- plt.tight_layout()
433
- plt.savefig(os.path.join("outputs", f"comps_{s_name}_" + fname))
434
- plt.close()
433
+ fig.draw(fig.signal(times, results[s_name]["z"][comp]).label(comp))
434
+ fig.title(f"Compositions vs Time ({s_name})")
435
+ fig.show()
436
+ fig.clear()
437
+
438
+
439
+ def plot_zarr_summary_terminal(summary: dict, title: str = "") -> None:
440
+ """Render a terminal visualization from a Zarr summary dict."""
441
+ if not summary.get("present"):
442
+ return
443
+
444
+ mode = summary.get("mode", "steady")
445
+ streams = summary.get("streams", {})
446
+
447
+ if mode == "dynamic":
448
+ # Reconstruct a results-like dict from Zarr summary for plotting.
449
+ results: dict = {}
450
+ for s_name, sdata in streams.items():
451
+ fields = sdata.get("fields", {})
452
+ results[s_name] = {k: v.get("value") for k, v in fields.items()}
453
+ plot_timeseries_terminal(results, title=title)
454
+ else:
455
+ # Steady: show final timestep values.
456
+ results = {}
457
+ for s_name, sdata in streams.items():
458
+ fields = sdata.get("fields", {})
459
+ results[s_name] = {
460
+ k: _scalar_from_sequence(v.get("value"))
461
+ for k, v in fields.items()
462
+ }
463
+ plot_results_terminal(results, title=title)
464
+
465
+
466
+ def plot_results_to_terminal(results, title: str = "", mode: str = "steady") -> None:
467
+ """Dispatch to the appropriate terminal plotter for run results."""
468
+ if mode == "dynamic":
469
+ plot_timeseries_terminal(results, title=title)
470
+ else:
471
+ plot_results_terminal(results, title=title)
435
472
 
436
473
 
437
474
  def _convert_value(value):
@@ -399,7 +399,7 @@ def run_flowsheet(
399
399
  *,
400
400
  outputs_dir: str | None = None,
401
401
  backend: Literal["scipy", "pyomo", "casadi"] | None = None,
402
- export_images: bool = False,
402
+ no_plot: bool = False,
403
403
  s3_bucket: str | None = None,
404
404
  s3_prefix: str | None = None,
405
405
  ) -> RunResult:
@@ -410,7 +410,7 @@ def run_flowsheet(
410
410
  outputs_dir: Directory for local pfarchive output. Defaults to
411
411
  ``PROCESSFORGE_OUTPUT_DIR`` or ``outputs/``.
412
412
  backend: Optional EO solver backend override (``scipy``/``pyomo``/``casadi``).
413
- export_images: If ``True``, generate PNG plots of the results.
413
+ no_plot: If ``True``, skip terminal plots of the results.
414
414
  s3_bucket: S3 bucket for archive upload. Defaults to ``S3_BUCKET`` env var.
415
415
  s3_prefix: S3 key prefix. Defaults to ``S3_PREFIX`` env var or
416
416
  ``"processforge"``.
@@ -546,17 +546,19 @@ def run_flowsheet(
546
546
  s3_prefix=s3_prefix,
547
547
  )
548
548
 
549
- if export_images:
549
+ if not no_plot:
550
550
  try:
551
- from .result import plot_results, plot_timeseries
551
+ from .result import plot_results_to_terminal
552
552
 
553
- plot_results(results, fname=f"{base_name}_results.png")
554
- plot_timeseries(results, fname=f"{base_name}_timeseries.png")
555
- logger.info(
556
- f"Plots saved: {base_name}_results.png, {base_name}_timeseries.png"
553
+ plot_results_to_terminal(
554
+ results,
555
+ title=f"{base_name} / {run_id}",
556
+ mode=mode,
557
557
  )
558
558
  except Exception as exc: # noqa: BLE001
559
- logger.warning(f"Failed to generate plots: {type(exc).__name__}: {exc}")
559
+ logger.warning(
560
+ f"Failed to render terminal plots: {type(exc).__name__}: {exc}"
561
+ )
560
562
 
561
563
  return result
562
564
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: processforge
3
- Version: 0.6.2
3
+ Version: 0.6.3
4
4
  Summary: A Python-based process simulation framework for chemical engineering applications.
5
5
  Author-email: Processforge Team <team@processforge.dev>
6
6
  License-Expression: BSD-3-Clause
@@ -22,8 +22,8 @@ License-File: LICENSE
22
22
  Requires-Dist: numpy>=2.0
23
23
  Requires-Dist: pydantic>=2.0
24
24
  Requires-Dist: scipy>=1.14
25
- Requires-Dist: matplotlib>=3.9
26
25
  Requires-Dist: loguru>=0.7
26
+ Requires-Dist: plotext>=5.2
27
27
  Requires-Dist: jsonschema>=4.20
28
28
  Requires-Dist: graphviz>=0.20
29
29
  Requires-Dist: pandas>=2.2
@@ -1,8 +1,8 @@
1
1
  numpy>=2.0
2
2
  pydantic>=2.0
3
3
  scipy>=1.14
4
- matplotlib>=3.9
5
4
  loguru>=0.7
5
+ plotext>=5.2
6
6
  jsonschema>=4.20
7
7
  graphviz>=0.20
8
8
  pandas>=2.2
@@ -286,7 +286,7 @@ class TestCmdInit:
286
286
  from processforge.cli.init import init
287
287
 
288
288
  init(flowsheet=None, path=str(tmp_path))
289
- assert (tmp_path / ".processforge" / "config.json").exists()
289
+ assert not (tmp_path / ".processforge" / "config.json").exists()
290
290
  assert (tmp_path / "outputs").is_dir()
291
291
  assert any("initialised successfully" in m for m in log_output)
292
292
 
@@ -327,7 +327,7 @@ class TestCmdInit:
327
327
  from processforge.lock import read_lock
328
328
 
329
329
  init(flowsheet=str(coolprop_flowsheet), path=str(tmp_path))
330
- assert (tmp_path / ".processforge" / "config.json").exists()
330
+ assert not (tmp_path / ".processforge" / "config.json").exists()
331
331
  lock = read_lock(str(tmp_path / ".processforge"), str(coolprop_flowsheet))
332
332
  assert lock is not None
333
333
  assert "coolprop" in lock["providers"]
@@ -374,7 +374,7 @@ class TestCmdRun:
374
374
  with patch.object(
375
375
  runner_mod, "run_flowsheet", side_effect=FlowsheetValidationError("not found")
376
376
  ), pytest.raises(SystemExit) as exc_info:
377
- run(flowsheet=str(tmp_path / "nope.json"), export_images=False)
377
+ run(flowsheet=str(tmp_path / "nope.json"), no_plot=True)
378
378
  assert exc_info.value.code == 1
379
379
 
380
380
  def test_run_flowsheet_delegates_to_runner(self, tmp_path, log_output):
@@ -382,7 +382,7 @@ class TestCmdRun:
382
382
  from processforge.cli.run import run
383
383
 
384
384
  with patch.object(run_mod, "run_flowsheet", return_value=self._mock_result()):
385
- run(flowsheet=str(tmp_path / "fs.json"), export_images=False)
385
+ run(flowsheet=str(tmp_path / "fs.json"), no_plot=True)
386
386
 
387
387
  assert any("Run Summary" in m for m in log_output)
388
388
  assert any("converged" in m for m in log_output)
File without changes
File without changes
File without changes
File without changes