Conversation
9623678 to
a706d51
Compare
…rom wildcard import
There was a problem hiding this comment.
Pull request overview
Refactors the previous main.py “script-style” workflow into a reusable high-level API under lyopronto (with YAML-based inputs/outputs), and adds integration-style tests + example YAML fixtures to validate the refactor.
Changes:
- Introduces
lyopronto.high_levelwithexecute_simulation, YAML input read/write, CSV export, and visualization generation. - Updates
main.pyto delegate to the high-level API and switches legacyY/Nflags to booleans. - Adds “fullstack” pytest coverage for the former
main.pybehavior and adds YAML fixtures intest_data/.
Reviewed changes
Copilot reviewed 22 out of 24 changed files in this pull request and generated 13 comments.
Show a summary per file
| File | Description |
|---|---|
lyopronto/high_level.py |
New high-level API wrapper for running tools, saving/loading inputs, exporting CSVs, and plotting. |
lyopronto/__init__.py |
Re-exports high-level API functions at package root for from lyopronto import *. |
main.py |
Refactored to build an inputs dict and call the package high-level API instead of inlining logic. |
lyopronto/plot_styling.py |
Refactors plotting style helpers to reduce duplication and centralize defaults. |
lyopronto/design_space.py |
Adds return-shape documentation; preserves existing design space computation behavior. |
lyopronto/functions.py |
Refactors/renames config tuple usage in primary drying output generation; adjusts crystallization timing logic. |
lyopronto/calc_knownRp.py |
Updates callsites to use the renamed inputs tuple passed into fill_output. |
tests/test_main.py |
New end-to-end tests for the high-level API (I/O + simulation + plotting). |
tests/test_design_space.py |
Updates assertions to match design space outputs as stacked arrays with explicit shapes. |
tests/test_calc_knownRp.py |
Adds coverage that the high-level API dispatches into calc_knownRp.dry as expected. |
tests/test_calc_unknownRp.py |
Adds coverage that the high-level API dispatches into calc_unknownRp.dry as expected. |
test_data/example_freezing.yaml |
New YAML fixture for freezing tool inputs. |
test_data/example_knownrp.yaml |
New YAML fixture for known-Kv/Rp primary drying inputs. |
test_data/example_unknownkv.yaml |
New YAML fixture for unknown-Kv primary drying inputs. |
test_data/example_unknownrp.yaml |
New YAML fixture for unknown-Rp primary drying inputs (with external temperature file reference). |
test_data/example_design_space.yaml |
New YAML fixture for design space tool inputs. |
test_data/example_opt_tsh.yaml |
New YAML fixture for optimizer (variable shelf temperature) inputs. |
test_data/example_opt_pch.yaml |
New YAML fixture for optimizer (variable chamber pressure) inputs. |
test_data/example_opt_pch_tsh.yaml |
New YAML fixture for optimizer (variable chamber + shelf) inputs. |
test_data/badexample_unknownkvrp.yaml |
New negative-test YAML fixture (neither Kv nor Rp known). |
test_data/badexample_optimizer_noopt.yaml |
New negative-test YAML fixture (optimizer with no variable decision). |
pyproject.toml |
Adds ruamel.yaml to runtime deps, pytest-mock to dev deps, and a main marker. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| from contextlib import chdir | ||
| import pytest |
There was a problem hiding this comment.
from contextlib import chdir is only available on Python 3.11+, but pyproject.toml declares support for Python >= 3.8. This will raise ImportError on 3.8–3.10. Prefer using monkeypatch.chdir(tmp_path) (pytest) or a small local context manager based on os.chdir to keep the tests compatible with the supported Python range.
|
Will close #11. Remaining (possible) to-do items: add more keyword arguments to the basic plotting method, or come up with more documentation showing how to customize directly with matplotlib. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 22 out of 24 changed files in this pull request and generated 12 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Going to give myself a day or two to stew on this, but otherwise I think this is ready to merge. Along with changing "Y" and "N" to |
As a step towards making the web interface of LyoPRONTO easier to update, refactor the
main.pyso that the bulk of the logic is encapsulated inside LyoPRONTO as a package.Some things still to document, and possibly some more to add as kwargs. This should get rebased to add unit tests from #6 , so that I have actually kept the old API.
This does introduce a possibly-breaking change of replacing
'Y'and'N'strings withTrueandFalse, which feels like a no-brainer to me. Other aspects of the API are kept constant, I think.Still would like to add a YAML representation of the input parameters, to replace the current CSV representation.