Skip to content

Commit cbcf305

Browse files
committed
upstream merge
2 parents eb9ec7a + 3b76abc commit cbcf305

File tree

1,038 files changed

+86541
-36136
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,038 files changed

+86541
-36136
lines changed

.coveragerc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ omit =
77
/opt/*
88
# skip test directories
99
*/tests/*
10-
# skip DMF's CLI
11-
idaes/dmf/commands.py
1210
# skip plugins
1311
*_plugin.py
1412

.github/CODEOWNERS

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,19 @@
22
# for developmental and contributed code
33

44
# Overall (non-specific)
5-
* @lbianchi-lbl @ksbeattie
5+
* @sufikaur @ksbeattie
66
# packaging
7-
setup.py @lbianchi-lbl @ksbeattie
8-
requirements*.txt @lbianchi-lbl @ksbeattie
7+
setup.py @sufikaur @ksbeattie
8+
requirements*.txt @sufikaur @ksbeattie
99

1010
# CI infra
11-
.github/ @lbianchi-lbl @ksbeattie
11+
.github/ @sufikaur @ksbeattie
12+
# spellchecker configuration
13+
.github/workflows/typos.toml @bpaul4 @sufikaur
1214

1315
# testing
14-
pytest*.ini @lbianchi-lbl
15-
conftest.py @lbianchi-lbl
16+
pytest*.ini @sufikaur @ksbeattie
17+
conftest.py @sufikaur @ksbeattie
1618

1719
# Docs
1820
/docs @dangunter @bpaul4
@@ -21,13 +23,14 @@ conftest.py @lbianchi-lbl
2123
/idaes/commands/ @dangunter
2224

2325
# Core
24-
/idaes/core/ @andrewlee94 @dallan-keylogic @lbianchi-lbl
26+
/idaes/core/ @agarciadiego @dallan-keylogic
2527
/idaes/core/dmf/ @dangunter
26-
/idaes/core/surrogate/ @andrewlee94 @bpaul4 @avdudchenko @rundxdi
28+
/idaes/core/surrogate/ @bpaul4 @avdudchenko @rundxdi
2729
/idaes/core/ui/ @dangunter
2830

2931
# Models
30-
/idaes/models/ @andrewlee94 @bpaul4
32+
/idaes/models/ @agarciadiego @bpaul4
33+
/idaes/models/properties/ @agarciadiego @dallan-keylogic
3134

3235
# Apps - each package needs a maintainer
3336
/idaes/apps/caprese/ @Robbybp

.github/actions/run-examples/action.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,16 @@ inputs:
3131
required: false
3232
default: ''
3333

34+
run-notebooks:
35+
description: "Run notebook tests (via nbmake)"
36+
required: false
37+
default: 'true'
38+
39+
run-pyfiles:
40+
description: "Run Python *.py tests (test_*.py, *_test.py)"
41+
required: false
42+
default: 'true'
43+
3444
runs:
3545
using: composite
3646
steps:
@@ -63,6 +73,8 @@ runs:
6373
shell: bash -l {0}
6474
env:
6575
PYTHONPATH: ${{ github.action_path }}
76+
EXAMPLES_RUN_NOTEBOOKS: ${{ inputs.run-notebooks }}
77+
EXAMPLES_RUN_PYFILES: ${{ inputs.run-pyfiles }}
6678
PYTEST_ADDOPTS: >-
6779
--color=yes
6880
--durations=0

.github/actions/run-examples/examples_for_idaes_ci.py

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
"""
44

55
from contextlib import contextmanager
6-
from dataclasses import dataclass, field
76
import fnmatch
8-
import logging
97
import os
108
from pathlib import Path
119
import sys
@@ -17,35 +15,29 @@
1715
from idaes_examples import notebooks
1816
from idaes_examples import build
1917

20-
2118
matchmarker = pytest.StashKey()
2219
marked = pytest.StashKey()
2320

21+
# Environment triggers for use either locally
22+
# or in GitHub Action
23+
_ENV_TRUE = {"1", "true", "yes", "on"}
24+
RUN_NOTEBOOKS = str(os.getenv("EXAMPLES_RUN_NOTEBOOKS", "1")).lower() in _ENV_TRUE
25+
RUN_PYFILES = str(os.getenv("EXAMPLES_RUN_PYFILES", "1")).lower() in _ENV_TRUE
26+
2427

2528
def _matches_pattern(item: pytest.Item, pattern: str) -> bool:
2629
to_match = os.fspath(item.path)
2730
return fnmatch.fnmatch(to_match, pattern)
2831

2932

3033
def pytest_configure(config: pytest.Config):
31-
tensorflow_py311_win = pytest.mark.xfail(
32-
condition=sys.version_info > (3, 11),
33-
run=True,
34-
strict=False,
35-
reason="tensorflow ImportError on 3.11+ on Windows (cannot import name 'formatargspec' from 'inspect')",
36-
)
3734
config.stash[matchmarker] = {
3835
"*/held/*": pytest.mark.xfail(run=False, reason="notebook has 'held' status"),
3936
"*/archive/*": pytest.mark.skip(reason="notebook is archived"),
40-
# TODO: Need to fix this once the Python 3.11 issue is resolved in tensorflow
41-
"*/surrogates/best_practices_optimization*": tensorflow_py311_win,
42-
"*/surrogates/omlt/keras_flowsheet_optimization*": tensorflow_py311_win,
4337
"*/surrogates/sco2/alamo/*": pytest.mark.xfail(
4438
run=False,
4539
reason="notebooks require ALAMO to run",
4640
),
47-
"*/surrogates/sco2/omlt/keras_training*": tensorflow_py311_win,
48-
"*/surrogates/sco2/omlt/flowsheet_optimization*": tensorflow_py311_win,
4941
}
5042
config.stash[marked] = []
5143

@@ -55,16 +47,31 @@ def pytest_sessionstart(session: pytest.Session):
5547

5648

5749
def pytest_ignore_collect(collection_path: Path, config: pytest.Config):
50+
"""Control what gets collected. By default, notebooks and tests; ignore other files."""
5851
if "_dev" in collection_path.parts:
5952
return True
6053
if not collection_path.is_file():
6154
return
62-
if collection_path.suffix == ".py":
63-
# specifically ignore python files
64-
return True
65-
if not collection_path.match("**/*_test.ipynb"):
55+
56+
suffix = collection_path.suffix
57+
# Notebook tests (only *_test.ipynb)
58+
if suffix == ".ipynb":
59+
if not RUN_NOTEBOOKS:
60+
return True
61+
return not collection_path.match("**/*_test.ipynb")
62+
63+
# Python tests (only test_*.py or *_test.py)
64+
if suffix == ".py":
65+
if not RUN_PYFILES:
66+
return True
67+
name = collection_path.name
68+
if fnmatch.fnmatch(name, "test_*.py") or fnmatch.fnmatch(name, "*_test.py"):
69+
return False
6670
return True
6771

72+
# Ignore everything else
73+
return True
74+
6875

6976
def pytest_collection_modifyitems(config: pytest.Config, items):
7077
for item in items:
@@ -113,7 +120,7 @@ def run_pytest(
113120
empty_file_for_ignoring.write_text("")
114121
args += ["-c", empty_file_for_ignoring]
115122

116-
with _temp_cwd(rootdir) as p:
123+
with _temp_cwd(rootdir):
117124
res = pytest.main(
118125
args,
119126
**kwargs,
@@ -125,6 +132,7 @@ def run_pytest(
125132
def main(args):
126133
rootdir = Path(idaes_examples.__path__[0])
127134

135+
# Always include --nbmake, but notebook collection can be disabled by env
128136
res = run_pytest(
129137
rootdir,
130138
[

.github/actions/setup-idaes/action.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,23 @@ runs:
4646
echo '::group::Output of "idaes get-extensions" command'
4747
idaes get-extensions --extra petsc --verbose
4848
echo '::endgroup::'
49+
50+
# extra dependencies must be installed on Ubuntu 24.04
51+
if [ -f "/etc/os-release" ]; then
52+
. /etc/os-release
53+
if [ "$ID" = "ubuntu" ] && [ "$VERSION_ID" = "24.04" ]; then
54+
echo '::group::Output of "apt install" for required OS packages'
55+
sudo apt install libgfortran5 libgomp1 liblapack3 libblas3
56+
echo '::endgroup::'
57+
fi
58+
fi
59+
60+
echo '::group::Output of test commands for IDAES binaries'
61+
echo 'List IDAES binaries directory'
62+
ls -l "$(idaes bin-directory)"
63+
echo 'Try to run ipopt'
64+
"$(idaes bin-directory)"/ipopt -v
65+
echo '::endgroup::'
4966
- name: Install AMPL SCIP (${{ inputs.ampl-scip-pip-target }})
5067
if: inputs.ampl-scip-pip-target
5168
shell: bash -l {0}

.github/workflows/core.yml

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ on:
44
push:
55
branches:
66
- main
7-
- '*_rel'
7+
- "*_rel"
88
schedule:
99
# run daily at 5:00 am UTC (12 am ET/9 pm PT)
10-
- cron: '0 5 * * *'
10+
- cron: "0 5 * * *"
1111
repository_dispatch:
1212
# to run this, send a POST API call at repos/IDAES/idaes-pse/dispatches with the specified event_type
1313
# e.g. `gh repos/IDAES/idaes-pse/dispatches -F event_type=ci_run_tests`
@@ -38,7 +38,7 @@ concurrency:
3838

3939
env:
4040
# default Python version to use for checks that do not require multiple versions
41-
DEFAULT_PYTHON_VERSION: '3.10'
41+
DEFAULT_PYTHON_VERSION: "3.10"
4242
IDAES_CONDA_ENV_NAME_DEV: idaes-pse-dev
4343
PYTEST_ADDOPTS: "--color=yes"
4444

@@ -54,6 +54,7 @@ jobs:
5454
runs-on: ubuntu-latest
5555
steps:
5656
- uses: actions/checkout@v4
57+
5758
- uses: actions/setup-python@v5
5859
with:
5960
python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
@@ -67,17 +68,18 @@ jobs:
6768
pip --no-cache-dir install --progress-bar off "$black_requirement"
6869
- name: Run Black to verify that the committed code is formatted
6970
run: |
70-
black --check .
71+
black --check --diff .
7172
7273
spell-check:
7374
name: Check Spelling
7475
runs-on: ubuntu-latest
7576
steps:
7677
- name: Checkout source
7778
uses: actions/checkout@v4
79+
7880
- name: Run Spell Checker
79-
uses: crate-ci/typos@master
80-
with:
81+
uses: crate-ci/typos@v1.24.5
82+
with:
8183
config: ./.github/workflows/typos.toml
8284

8385
pytest:
@@ -88,27 +90,29 @@ jobs:
8890
strategy:
8991
fail-fast: false
9092
matrix:
91-
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
93+
python-version: ["3.10", "3.11", "3.12", "3.13"]
9294
os:
9395
- linux
9496
- win64
9597
include:
9698
- os: linux
97-
runner-image: ubuntu-20.04
99+
runner-image: ubuntu-24.04
98100
- os: win64
99101
runner-image: windows-2022
100-
- python-version: '3.11'
102+
- python-version: "3.11"
101103
# only generate coverage report for a single python version in the matrix
102104
# to avoid overloading Codecov
103105
cov-report: true
106+
104107
steps:
105-
- uses: actions/checkout@v4
108+
- uses: actions/checkout@v5
106109
- uses: ./.github/actions/display-debug-info
107110
- name: Set up Conda environment
108111
uses: conda-incubator/setup-miniconda@v3
109112
with:
110113
activate-environment: ${{ env.IDAES_CONDA_ENV_NAME_DEV }}
111114
python-version: ${{ matrix.python-version }}
115+
miniforge-version: latest
112116
- name: Set up idaes
113117
uses: ./.github/actions/setup-idaes
114118
with:
@@ -117,6 +121,8 @@ jobs:
117121
if: matrix.cov-report
118122
run: |
119123
echo PYTEST_ADDOPTS="$PYTEST_ADDOPTS --cov --cov-report=xml" >> "$GITHUB_ENV"
124+
- name: Install pandoc
125+
run: conda install -c conda-forge pandoc
120126
- name: Run pytest (not integration)
121127
run: |
122128
pytest --pyargs idaes -m "not integration"
@@ -139,6 +145,7 @@ jobs:
139145
steps:
140146
# the checkout step is needed to have access to codecov.yml
141147
- uses: actions/checkout@v4
148+
142149
- uses: actions/download-artifact@v4
143150
with:
144151
name: coverage-report-${{ matrix.report-variant }}
@@ -152,18 +159,25 @@ jobs:
152159
# but does require token for other workflows e.g. merge to `main`
153160
# see https://github.com/codecov/codecov-action/issues/1274#issuecomment-1934437359
154161
token: ${{ secrets.CODECOV_TOKEN }}
162+
# pinning version after v0.7.0 broke tokenless upload
163+
# see codecov/codecov-action#1487
164+
version: v0.7.1
155165

156166
build-docs:
157167
name: Build Sphinx docs
158168
runs-on: ubuntu-latest
159169
needs: [code-formatting, spell-check]
160170
steps:
161171
- uses: actions/checkout@v4
172+
162173
- name: Set up Conda environment
163174
uses: conda-incubator/setup-miniconda@v3
164175
with:
165176
activate-environment: ${{ env.IDAES_CONDA_ENV_NAME_DEV }}
166177
python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
178+
miniforge-version: latest
179+
- name: Install pandoc
180+
run: conda install -c conda-forge pandoc
167181
- name: Set up idaes
168182
uses: ./.github/actions/setup-idaes
169183
with:
@@ -193,11 +207,13 @@ jobs:
193207
# NOTE: using Conda instead of actions/setup-python in this job is not strictly necessary
194208
# as it doesn't need to run on Windows or use the setup-idaes local action,
195209
# but we do it for consistency with the other jobs
210+
196211
- name: Set up Conda environment
197212
uses: conda-incubator/setup-miniconda@v3
198213
with:
199214
activate-environment: ${{ env.IDAES_CONDA_ENV_NAME_DEV }}
200215
python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
216+
miniforge-version: latest
201217
- name: Set up idaes
202218
uses: ./.github/actions/setup-idaes
203219
with:
@@ -222,14 +238,16 @@ jobs:
222238
223239
compat:
224240
name: Compatibility tests
225-
runs-on: ubuntu-latest
241+
runs-on: ubuntu-24.04
226242
steps:
227243
- uses: actions/checkout@v4
244+
228245
- name: Set up Conda environment
229246
uses: conda-incubator/setup-miniconda@v3
230247
with:
231248
activate-environment: ${{ env.IDAES_CONDA_ENV_NAME_DEV }}
232249
python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
250+
miniforge-version: latest
233251
- name: Set up idaes
234252
uses: ./.github/actions/setup-idaes
235253
with:

0 commit comments

Comments
 (0)