Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
9ba1ca5
Add testing-related files from SECQUOIA fork
Ickaser Jan 1, 2026
1f8f829
Missed a file
Ickaser Jan 1, 2026
636abca
Have tests use pyproject.toml, not requirements.txt
Ickaser Jan 1, 2026
7d21fee
add pandas as dev dep
Ickaser Jan 1, 2026
9aea544
fix tests: replace math.exp with np.exp
Ickaser Jan 1, 2026
4b4b30d
fix: calc_knownRp uses percent rather than 0-1
Ickaser Jan 8, 2026
2d71b30
clean whitespace
Ickaser Jan 8, 2026
f79ef6a
fix: Handle edge case in design space
Ickaser Jan 8, 2026
bb8b0f1
Move helper func to separate module under tests
Ickaser Jan 8, 2026
04dc914
Fix tests for unknownRp
Ickaser Jan 8, 2026
35e9001
Note that edge case needs treatment
Ickaser Jan 8, 2026
4ece426
cleanup
Ickaser Jan 8, 2026
146ce4f
Include pytest settings in pyproject.toml
Ickaser Jan 8, 2026
e3c0b6c
Fully move all tests to percent dried, not fraction
Ickaser Jan 9, 2026
ba54799
Further test cleanup
Ickaser Jan 9, 2026
b8a1b9d
Ignore some local things
Ickaser Jan 9, 2026
762b25e
Standardize calc_unknownRp tests
Ickaser Jan 9, 2026
668b5b9
Fix a bug in design space, uncovered by tests
Ickaser Jan 9, 2026
f4b8c35
DRY the tests out a bit
Ickaser Jan 9, 2026
1e1e450
Eliminate one cause of infinite loops in design space
Ickaser Jan 9, 2026
0580533
fix: give an initial guess in acceptable range
Ickaser Jan 9, 2026
a2e3a63
Make a start on handling cases where optimization fails for Pch
Ickaser Jan 9, 2026
7cc345d
Get all tests passing, skip those that address problems which don't e…
Ickaser Jan 9, 2026
e7ed041
dry out Tsh a little bit
Ickaser Jan 15, 2026
89e187c
Get all opt_Pch tests passing
Ickaser Jan 16, 2026
73d3e2d
Get some Tsh tests passing
Ickaser Jan 16, 2026
59276a9
Get joint optimization tests passing
Ickaser Jan 16, 2026
480333c
Remove separate "coverage" tests
Ickaser Jan 16, 2026
8af8236
Complete line coverage of opt_Pch
Ickaser Jan 16, 2026
8ae591c
Unify Pch_Tsh optimization, with complete coverage
Ickaser Jan 16, 2026
dd6dec3
default ramp rate of no ramp, if not supplied
Ickaser Jan 16, 2026
647d438
Add Tmax parameter to assert_physically_reasonable_output
Ickaser Jan 16, 2026
5b4942e
Tweak path handling
Ickaser Jan 19, 2026
4543700
Include results from web API in repo, for test comparisons
Ickaser Jan 20, 2026
c0bfc4f
Add coverage defaults to testing
Ickaser Jan 20, 2026
f9ba741
Rename for clarity, delete duplicate tests
Ickaser Jan 23, 2026
37ee318
Consolidate calc_unknownRp into one file
Ickaser Jan 23, 2026
9de5ded
Make unknownRp give useful warnings, test those warnings
Ickaser Jan 23, 2026
86fa972
lint
Ickaser Jan 23, 2026
2f546af
Add warnings for design space, consolidate tests,, get complete test …
Ickaser Jan 24, 2026
ce5a6ec
Consolidate
Ickaser Jan 26, 2026
0d5ebe0
Consolidate and clarify knownRp tests
Ickaser Jan 26, 2026
a27f759
clarify deps
Ickaser Jan 26, 2026
0ca6e28
Get a proper regression test passing on calc_knownRp by taking dt and…
Ickaser Jan 26, 2026
08ae428
Work on increasing coverage
Ickaser Jan 26, 2026
773e689
Remove redundant test
Ickaser Jan 26, 2026
e093497
Make path to test data have one source of truth
Ickaser Jan 26, 2026
ac6a566
Standardize a magic number
Ickaser Jan 26, 2026
54a08fb
Test failures
Ickaser Jan 26, 2026
1bf635d
Add one more testing utility function
Ickaser Jan 26, 2026
df1457d
Fix and clean up freezing, clean up tests, add tests to reach 100% co…
Ickaser Jan 26, 2026
cf3499e
Make example scripts with plots part of the test suite
Ickaser Jan 26, 2026
a6d48bb
Add tests which execute notebooks; rework CI to run papermill within …
Ickaser Jan 27, 2026
92f441b
Fix compat bound
Ickaser Jan 27, 2026
180ab8b
fix: don't have notebooks run together with "PR tests"
Ickaser Jan 27, 2026
1466278
Separate out notebook dependencies from docs building dependencies
Ickaser Jan 27, 2026
6c26035
Import papermill inside notebook tests
Ickaser Jan 27, 2026
c1b7e0e
Try out writing PR version of docs again
Ickaser Jan 27, 2026
f72449f
try again pr docs
Ickaser Jan 27, 2026
424a789
one more thing to try
Ickaser Jan 27, 2026
7889425
move permissions?
Ickaser Jan 27, 2026
4746db3
Give up on PR versions of docs from Actions
Ickaser Jan 27, 2026
898264c
Clean up unused config
Ickaser Jan 27, 2026
b6acdcf
Make one category of dev deps, not two
Ickaser Jan 28, 2026
4b3b0bf
Remove unused testing script
Ickaser Jan 28, 2026
81c1175
Delete obsolete test
Ickaser Jan 28, 2026
ac3daf1
Modify equations being solved to account for varying shelf temperatur…
Ickaser Jan 28, 2026
5fdcf97
Add reference test for freezing
Ickaser Jan 28, 2026
79e8d3c
Add new reference data for opt_Pch
Ickaser Jan 28, 2026
fe69ff2
Point to correct file
Ickaser Jan 28, 2026
b840ca3
Test reference case for opt_Pch
Ickaser Jan 28, 2026
3c28e84
Give opt_pch reference case its own inputs setup
Ickaser Jan 28, 2026
6be88f3
Take some of Copilot's review suggestions
Ickaser Jan 28, 2026
ab501b6
Linting
Ickaser Jan 28, 2026
9df00fe
Ruff formatting. Lots of whitespace noise, all single quotes to doubl…
Ickaser Jan 28, 2026
11ca994
Get *a* reference test working for opt_Pch
Ickaser Jan 28, 2026
d80f5f3
unnecessary imports
Ickaser Jan 28, 2026
12e78ba
Relax tolerance
Ickaser Jan 29, 2026
06cd9cb
Help diagnose CI failure
Ickaser Jan 29, 2026
d7eb662
Bite the bullet and add a time interpolator for Tshelf and Pchamber
Ickaser Jan 29, 2026
a051012
Make RampInterpolator conform to existing API for dt_setpt, with kwar…
Ickaser Feb 2, 2026
6598280
Add more consistency checks to optimization tests, use some np.testin…
Ickaser Feb 2, 2026
2dc3d3d
Fix freezing reference to be closer to original interpretation
Ickaser Feb 2, 2026
627a911
Get one last test passing
Ickaser Feb 2, 2026
eb7b25b
ruff format on tests
Ickaser Feb 2, 2026
d1a6fe7
Remove unused sections from pyproject.toml
Ickaser Feb 3, 2026
e2265aa
Make some dev docs, shuffle things into there from README, etc.
Ickaser Feb 3, 2026
43c0a21
Add some extra helpers for RampInterpolator, use in calc_knownRp
Ickaser Feb 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/ci-config/ci-versions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Centralized CI version configuration for LyoPRONTO
# Update this file to change Python version across all workflows
python-version: '3.13'
12 changes: 7 additions & 5 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,21 @@ jobs:
# Could fetch it later on but this seems simpler and less finicky
with:
fetch-depth: 0
- run: pip install mkdocstrings-python mkdocs-material mike mkdocs-ipynb
- run: pip install .
- run: pip install .[docs]
- run: echo ${{ github.event_name}} ${{ github.ref_name }}
# Deploy docs according to type of event
- name: Deploy docs as latest
- name: Build docs as latest
if: ${{ github.event_name == 'release' }}
run: mike deploy ${{ github.ref_name }} latest
- name: Deploy docs for PR
- name: Build docs for PR
if: ${{ github.event_name == 'pull_request' }}
run: mike deploy pr-${{ github.event.number }}
- name: Deploy docs as dev
- name: Build docs as dev
if: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
run: mike deploy dev
- name: Get docs into GitHub Pages
- name: Deploy docs to GitHub Pages
if: ${{ github.event_name != 'pull_request' }}
run: |
git switch gh-pages
git push origin gh-pages
70 changes: 70 additions & 0 deletions .github/workflows/pr-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: PR Tests

# Smart CI workflow:
# - Draft PRs: Fast tests only (no coverage) for rapid iteration
# - Ready for Review: Full tests with coverage for quality assurance
# - All subsequent commits: Continue with full coverage

on:
pull_request:
branches: [ main ]
types: [ opened, synchronize, reopened, ready_for_review, converted_to_draft ]

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Read CI version config
id: versions
uses: mikefarah/yq@v4.44.1
with:
cmd: yq eval '.python-version' .github/ci-config/ci-versions.yml

- name: Determine test mode
id: mode
run: |
if [ "${{ github.event.pull_request.draft }}" ]; then
echo "mode=fast" >> $GITHUB_OUTPUT
else
echo "mode=full" >> $GITHUB_OUTPUT
fi

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ steps.versions.outputs.result }}
cache: 'pip'
cache-dependency-path: |
pyproject.toml

- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install .
pip install .[dev]
pip install -e . --no-build-isolation

- name: Run tests
# Currently this conditional branching doesn't actually do anything,
# since pyproject.toml adds these coverage arguments to the testing anyway
run: |
if [ "${{ steps.mode.outputs.mode }}" == "fast" ]; then
echo "⚡ Skipping notebook tests (marked with @pytest.mark.notebook) - these run separately"
pytest tests/ -n auto -v -m "not notebook" --cov=lyopronto --cov-report=term-missing
else
echo "⚡ Skipping notebook tests (marked with @pytest.mark.slow), not running coverage"
pytest tests/ -n auto -v -m "not notebook"
fi

- name: Upload coverage (if run)
if: steps.mode.outputs.coverage == 'true'
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
flags: pr-tests
name: pr-coverage
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
68 changes: 49 additions & 19 deletions .github/workflows/rundocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,54 @@ on:

jobs:
doctests:
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# GIT_COMMITTER_NAME: ${{ github.actor }}
# GIT_COMMITTER_EMAIL: ${{ github.actor }}@users.noreply.github.com
name: Notebook
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./docs/examples
strategy:
matrix:
notebook:
- knownRp_PD.ipynb
- unknownRp_PD.ipynb

steps:
- uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v4
- run: pip install ruamel.yaml scipy numpy matplotlib papermill ipykernel
- name: Run notebooks
run: papermill ${{ matrix.notebook }} ${{ matrix.notebook }} -k python
- uses: actions/checkout@v4

- name: Read CI version config
id: versions
uses: mikefarah/yq@v4.44.1
with:
cmd: yq eval '.python-version' .github/ci-config/ci-versions.yml

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ steps.versions.outputs.result }}
cache: 'pip'
cache-dependency-path: |
pyproject.toml

- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install .
pip install .[dev]
pip install -e . --no-build-isolation

- name: Run tests (draft = fast, ready = coverage)
run: pytest tests/ -n auto -v -m "notebook" --cov=lyopronto --cov-report=xml --cov-report=term-missing
# jobs:
# doctests:
# # env:
# # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# # GIT_COMMITTER_NAME: ${{ github.actor }}
# # GIT_COMMITTER_EMAIL: ${{ github.actor }}@users.noreply.github.com
# name: Notebook
# runs-on: ubuntu-latest
# defaults:
# run:
# working-directory: ./docs/examples
# strategy:
# matrix:
# notebook:
# - knownRp_PD.ipynb
# - unknownRp_PD.ipynb
# steps:
# - uses: actions/checkout@v5
# - name: Set up Python
# uses: actions/setup-python@v4
# - run: pip install ruamel.yaml scipy numpy matplotlib papermill ipykernel
# - name: Run notebooks
# run: papermill ${{ matrix.notebook }} ${{ matrix.notebook }} -k python
77 changes: 77 additions & 0 deletions .github/workflows/slow-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Slow Tests (Manual)

# Manual workflow for running slow optimization tests
# Useful for:
# - Testing before merge if concerned about slow test failures
# - Running comprehensive tests on feature branches
# - Validating optimization behavior changes

on:
workflow_dispatch:
inputs:
run_all:
description: 'Run all tests (true) or only slow tests (false)'
required: false
default: 'false'
type: choice
options:
- 'true'
- 'false'

jobs:
slow-tests:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Read CI version config
id: versions
uses: mikefarah/yq@v4.44.1
with:
cmd: yq eval '.python-version' .github/ci-config/ci-versions.yml

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ steps.versions.outputs.result }}
cache: 'pip'
cache-dependency-path: |
pyproject.toml

- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install .
pip install .[dev]
pip install -e . --no-build-isolation

- name: Run slow tests
run: |
if [ "${{ inputs.run_all }}" == "true" ]; then
echo "🔍 Running ALL tests (including slow optimization tests)"
echo "⏱️ This may take 30-40 minutes on CI"
pytest tests/ -n auto -v --cov=lyopronto --cov-report=xml --cov-report=term-missing
else
echo "🐌 Running ONLY slow tests (marked with @pytest.mark.slow)"
echo "⏱️ This focuses on optimization tests that take minutes"
pytest tests/ -n auto -v -m "slow" --cov=lyopronto --cov-report=xml --cov-report=term-missing
fi

- name: Upload coverage
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
flags: slow-tests
name: slow-tests-coverage
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}

- name: Test Summary
if: always()
run: |
if [ "${{ inputs.run_all }}" == "true" ]; then
echo "✅ Complete test suite finished"
else
echo "🐌 Slow tests completed"
fi
echo "📊 Coverage uploaded to Codecov"
55 changes: 55 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Main Branch Tests

# Full tests with coverage for main branch
# (PRs are handled by pr-tests.yml)

on:
push:
branches: [ main, dev-pyomo ]

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Read CI version config
id: versions
uses: mikefarah/yq@v4.44.1
with:
cmd: yq eval '.python-version' .github/ci-config/ci-versions.yml
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ steps.versions.outputs.result }}
cache: 'pip'
cache-dependency-path: |
pyproject.toml

- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install .
pip install .[dev]
pip install -e . --no-build-isolation

- name: Run ALL tests with pytest and coverage (including slow tests)
run: |
echo "🔍 Running complete test suite including slow tests"
echo "⏱️ This may take 30-40 minutes on CI (includes optimization tests)"
pytest tests/ -n auto -v --cov=lyopronto --cov-report=xml --cov-report=term-missing

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}

- name: Coverage Summary
if: always()
run: |
echo "✅ Full coverage tests completed for main branch"
echo "📊 Coverage metrics updated in Codecov"
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
*.csv

docs/build

# for conda environment install, converted from pyproject.toml
environment.yml
# for local settings
.vscode/
################################################################################
# Jupyter Notebook #
################################################################################
Expand Down
12 changes: 0 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,3 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

By request, this software may also be distributed under the terms of the GNU Lesser General Public License (LGPL); for permission, contact the authors or maintainer.

# Notes on contributing & maintenance

There is a GitHub Action on this repo which will automatically build the documentation (which uses Material for MkDocs with `mike` for versioning). This action triggers on push to main (which creates a `dev` section of the docs), on publishing a release (which creates a numbered version of the docs), and on pull request edits (which makes a `pr-###` version of the docs).
After merging a pull request, it is a good idea to use [mike](https://github.com/jimporter/mike) to clear out the PR version of the docs. Locally, do something like the following
```
git fetch
mike delete pr-### # replace with correct PR number
git switch gh-pages
git push origin gh-pages
```
This could theoretically be automated but I decided against this for now. In the long run, it may be worth not generating PR versions of the docs if this is burdensome.
7 changes: 0 additions & 7 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,4 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.


import sys
import scipy.optimize as sp
import numpy as np
import math
import csv

from .lyopronto import *
Loading