PR 2/7: Pyomo optional dependencies and module structure#7
Conversation
d4a1ce1 to
6fa03b3
Compare
72e8b86 to
9b54119
Compare
9b54119 to
a4d2f9a
Compare
This PR adds the foundation for Pyomo integration: pyproject.toml changes: - Add [optimization] extra with pyomo>=6.7.0 and idaes-pse>=2.9.0 - These are optional dependencies, scipy-based code works without them Module structure: - lyopronto/pyomo_models/__init__.py: Placeholder with documentation - tests/test_pyomo_models/__init__.py: Test directory placeholder Installation: pip install .[optimization] # For Pyomo support pip install . # Standard scipy-only installation This enables users to opt-in to Pyomo optimization without affecting existing scipy-based workflows.
a4d2f9a to
c60cf5e
Compare
Co-authored-by: Copilot <copilot@github.com>
| @@ -0,0 +1,49 @@ | |||
| # Copyright 2019-2025, Gayathri Shivkumar, Petr S. Kazarin, Alina A. Alexeenko | |||
There was a problem hiding this comment.
some files are copyright to lyohub members, some are to david, why?
There was a problem hiding this comment.
Addressed in 28d0898. Updated the new lyopronto/pyomo_models/__init__.py header to Copyright (C) 2026, SECQUOIA so the Pyomo package files use a single SECQUOIA-owned header.
| @@ -0,0 +1,2 @@ | |||
| # Copyright 2019-2025, SECQUOIA | |||
| # Tests for Pyomo-based optimization models. | |||
There was a problem hiding this comment.
Addressed in 28d0898. Removed the placeholder tests/test_pyomo_models/__init__.py file and added real initializer coverage in tests/test_pyomo_models/test_init.py.
bernalde
left a comment
There was a problem hiding this comment.
Reviewed the PR diff, packaging metadata, Pyomo roadmap/conventions, test docs, CI workflows, and surrounding package/test structure. GitHub would not allow REQUEST_CHANGES because the authenticated account is the PR author, so I am leaving this as a COMMENT review with blocking findings. Tests run: Python 3.13.5; python -m pytest tests/ -n auto -v -m "not notebook and not pyomo" --cov=lyopronto --cov-report=term-missing passed 235, skipped 2 in 570.66s; python -m pytest tests/ -n auto -v -m "pyomo" --cov=lyopronto --cov-report=term-missing collected 0 tests and exited 5; python -m pip install --dry-run --no-build-isolation ".[optimization]" resolved on Python 3.13; cross-version resolver check for Python 3.8 failed with ResolutionImpossible. I would not merge this until the blocking issues above are addressed.
|
Follow-up on the copyright-header discussion: PR #7 currently leaves pre-existing upstream files' copyright notices untouched and uses |
Summary
Adds Pyomo as an optional dependency (
pip install lyopronto[optimization]). Creates thelyopronto.pyomo_modelspackage with aPYOMO_AVAILABLEflag and graceful import handling. Pyomo coexists with scipy — both remain available.PR 2 of 7 in the Pyomo integration series.
Changes
lyopronto/pyomo_models/__init__.py— Module init with lazy imports, availability checkpyproject.toml— Add[project.optional-dependencies]foroptimizationextra (pyomo, idaes-pse)tests/test_pyomo_models/__init__.py— Test package initKey Design Decision
Coexistence, not replacement. Installing the
optimizationextra adds Pyomo alongside scipy. The core package works without Pyomo. Code checksPYOMO_AVAILABLEbefore using Pyomo features.PR Chain
Testing
No new tests added. Import test validates graceful fallback when Pyomo is not installed.