Skip to content

Commit 5843259

Browse files
authored
Reorganize dependencies (#42)
* Remove extra indentation * Use hyphen in package distribution name * Update minimum Python version * Reorganize optional dependencies * Introduce requirements-dev.txt file * Try removing idaes-pse from requirement file * Try using IDAES/idaes-pse#1133 for dev requirements * Add dependencies for surrogates target * Add (temporarily) dmf target for convergence_base * Rename target to omlt * Remove dmf extras_require * Try removing setup.py * Remove ref to merged PR * Add test for idaes_examples.browse.find_notebook_dir() * Add gui target to dev dependencies * Add requirement for importlib_resources backport for 3.8
1 parent 3d03942 commit 5843259

File tree

9 files changed

+93
-92
lines changed

9 files changed

+93
-92
lines changed

.github/workflows/core.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ jobs:
7373
- name: Install the code
7474
uses: ./.github/actions/install
7575
with:
76-
install-target: .[dev,jb]
76+
install-target: -r requirements-dev.txt
7777
- name: Run pytest
7878
run: |
7979
pwd

.readthedocs.yml

+1-4
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@ build:
1010
- idaesx conf --execute cache --timeout 600 --sphinx --show
1111
python:
1212
install:
13-
- method: pip
14-
path: .
15-
extra_requirements:
16-
- jb
13+
- requirements: requirements-dev.txt
1714

1815
sphinx:
1916
builder: html

README-developer.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ Clone the repository from GitHub, set up your Python environment as you usually
3636

3737
```shell
3838
# to create a conda environment first:
39-
# conda create -n idaes-examples python=3; conda activate idaes-examples
40-
pip install -e .[dev,jb]
39+
# conda create -n idaes-examples python=3.10; conda activate idaes-examples
40+
pip install -r requirements-dev.txt
4141
```
4242

4343
The configuration of the installation is stored in `pyproject.toml`.

idaes_examples/browse.py

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
"""
44
# stdlib
55
from importlib import resources
6+
if not hasattr(resources, "files"):
7+
# importlib.resources.files() added in Python 3.9
8+
import importlib_resources as resources
69
import json
710
import logging
811
from logging.handlers import RotatingFileHandler

idaes_examples/tests/test_browse.py

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import pytest
2+
3+
from idaes_examples import browse
4+
5+
6+
@pytest.mark.unit
7+
def test_dir_finding():
8+
found = browse.find_notebook_dir()
9+
assert found is not None
10+
assert found.is_dir()

pyproject.toml

+72-65
Original file line numberDiff line numberDiff line change
@@ -7,90 +7,97 @@ requires = [
77
build-backend = "setuptools.build_meta"
88

99
[project]
10-
name = "idaes_examples"
11-
description = "IDAES Process Systems Engineering Examples"
12-
readme = "README.md"
13-
version = "2.0.0a2"
14-
license = {text="BSD"}
15-
requires-python = ">=3.7"
16-
authors = [
17-
{name="The IDAES Project"},
18-
{name="Dan Gunter", email="[email protected]"}
19-
]
20-
classifiers = [
21-
"Development Status :: 3 - Alpha",
22-
"Intended Audience :: End Users/Desktop",
23-
"Intended Audience :: Science/Research",
24-
"License :: OSI Approved :: BSD License",
25-
"Natural Language :: English",
26-
"Operating System :: MacOS",
27-
"Operating System :: Microsoft :: Windows",
28-
"Operating System :: Unix",
29-
"Programming Language :: Python",
30-
"Programming Language :: Python :: 3",
31-
"Programming Language :: Python :: 3.7",
32-
"Programming Language :: Python :: 3.8",
33-
"Programming Language :: Python :: 3.9",
34-
"Programming Language :: Python :: 3.10",
35-
"Programming Language :: Python :: Implementation :: CPython",
36-
"Topic :: Scientific/Engineering :: Mathematics",
37-
"Topic :: Scientific/Engineering :: Chemistry",
38-
"Topic :: Software Development :: Libraries :: Python Modules",
39-
]
40-
dependencies = [
41-
# Don't version setuptools, various bits complain
42-
"setuptools",
43-
# Get IDAES from last release. NOTE: [dev] overrides this!
44-
"idaes-pse",
45-
# Pyomo
46-
"pyomo>=6.5.0",
47-
# For the small embedded GUI
48-
"PySimpleGUI~=4.60.4",
49-
"tkhtmlview==0.1.1.post5",
50-
"Markdown~=3.4.1",
51-
# For Keras/OMLT
52-
"tensorflow"
53-
]
54-
keywords = ["IDAES", "energy systems", "chemical engineering", "process modeling"]
10+
name = "idaes-examples"
11+
description = "IDAES Process Systems Engineering Examples"
12+
readme = "README.md"
13+
version = "2.0.0a2"
14+
license = {text="BSD"}
15+
requires-python = ">=3.8"
16+
authors = [
17+
{name="The IDAES Project"},
18+
{name="Dan Gunter", email="[email protected]"}
19+
]
20+
classifiers = [
21+
"Development Status :: 3 - Alpha",
22+
"Intended Audience :: End Users/Desktop",
23+
"Intended Audience :: Science/Research",
24+
"License :: OSI Approved :: BSD License",
25+
"Natural Language :: English",
26+
"Operating System :: MacOS",
27+
"Operating System :: Microsoft :: Windows",
28+
"Operating System :: Unix",
29+
"Programming Language :: Python",
30+
"Programming Language :: Python :: 3",
31+
"Programming Language :: Python :: 3.8",
32+
"Programming Language :: Python :: 3.9",
33+
"Programming Language :: Python :: 3.10",
34+
"Programming Language :: Python :: 3.11",
35+
"Programming Language :: Python :: Implementation :: CPython",
36+
"Topic :: Scientific/Engineering :: Mathematics",
37+
"Topic :: Scientific/Engineering :: Chemistry",
38+
"Topic :: Software Development :: Libraries :: Python Modules",
39+
]
40+
dependencies = [
41+
# Don't version setuptools, various bits complain
42+
"setuptools",
43+
# Pyomo
44+
"pyomo>=6.5.0",
45+
"jupyter",
46+
"importlib_resources ; python_version < '3.9'", # importlib.resources.files()
47+
]
48+
keywords = ["IDAES", "energy systems", "chemical engineering", "process modeling"]
5549

5650
[project.optional-dependencies]
57-
# Just for developers (they should also add 'jb')
58-
dev = [
59-
# IDAES
60-
# -- for development, use github main
61-
# NOTE: Need to manually comment this out when building the package
62-
#"idaes-pse @ git+https://github.com/IDAES/idaes-pse",
51+
gui = [
52+
# For the small embedded GUI
53+
"PySimpleGUI~=4.60.4",
54+
"tkhtmlview==0.1.1.post5",
55+
"Markdown~=3.4.1",
56+
]
57+
omlt = [
58+
# For Keras/OMLT
59+
"omlt",
60+
"tensorflow",
61+
]
62+
idaes = [
63+
"idaes-pse", # installing IDAES (from release) is opt-in
64+
]
65+
testing = [
6366
# parallel pytest
6467
"pytest-xdist ~= 3.0.2",
6568
# pytest reporting
6669
"pytest-reportlog ~= 0.1.2",
67-
# For jupyter notebook testing
68-
"black[jupyter] ~= 22.8.0",
69-
# For adding copyright headers (see addheader.yml and the readme)
70-
"addheader >= 0.3.0",
71-
# For the idaesx new terminal UI
72-
"blessed ~= 1.20.0"
73-
]
74-
# For packaging
75-
pkg = [
76-
"build",
77-
"twine"
70+
"nbclient",
71+
"nbmake",
7872
]
79-
# For Jupyterbook (e.g. readthedocs builds)
80-
jb = [
73+
# dependencies for building documentation
74+
docs = [
8175
"jupyter-book ~= 0.13.1",
8276
# "jupyter-cache ~= 0.4.3",
8377
"jupyter-cache",
8478
# the older version of nbmake goes with the older
8579
# version of nbclient, which is required by jupyter-cache
8680
# "nbclient ~= 0.5.13",
8781
"nbclient",
88-
"nbmake",
8982
"nbformat",
9083
# markdown in Sphinx
9184
"myst-nb ~= 0.13.2",
9285
"myst-parser ~= 0.15.2",
9386
]
87+
# For developers
88+
dev = [
89+
"idaes-examples[gui,testing,docs]",
90+
# For jupyter notebook testing
91+
"black[jupyter] ~= 22.8.0",
92+
# For adding copyright headers (see addheader.yml and the readme)
93+
"addheader >= 0.3.0",
94+
"blessed ~= 1.20.0",
95+
]
96+
# For creating a package
97+
packaging = [
98+
"build",
99+
"twine"
100+
]
94101

95102
[project.urls]
96103
github = "https://github.com/idaes/examples"

requirements-dev.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
--editable .[dev,omlt]
2+
3+
idaes-pse @ git+https://github.com/IDAES/idaes-pse@main

setup.py

-19
This file was deleted.

tutorial.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Create a conda environment and install examples (and dependencies, including ida
3939
```
4040
conda create -y -n idaes-examples python=3.10
4141
conda activate idaes-examples
42-
pip install -e '.[dev]'
42+
pip install -r requirements-dev.txt
4343
idaes get-extensions
4444
```
4545

0 commit comments

Comments
 (0)