From 7cb6bb29ad738c4557f092802490cdc52a531d47 Mon Sep 17 00:00:00 2001 From: Ludovico Bianchi Date: Mon, 9 Dec 2024 09:15:46 -0600 Subject: [PATCH 1/7] Add requirement for watertap-solvers --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 39224c6..2b14e0d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,6 +11,7 @@ readme = "README.md" dynamic = ["version"] dependencies = [ "pyomo", + "watertap-solvers @ git+https://github.com/watertap-org/watertap-solvers@24.12.9", ] [project.optional-dependencies] testing = [ From fbfc519c8cd7fdbc615237dc737a0ffe80d674fb Mon Sep 17 00:00:00 2001 From: Ludovico Bianchi Date: Mon, 9 Dec 2024 09:17:13 -0600 Subject: [PATCH 2/7] Update imports to use get_solver() from watertap_solvers --- src/reaktoro_pse/core/tests/test_reaktoro_builder.py | 2 +- src/reaktoro_pse/examples/biogas_combustion.py | 2 +- .../reaktoro_pse_to_phreeqc_comparison/standard_model.py | 2 +- src/reaktoro_pse/examples/simple_desalination.py | 2 +- src/reaktoro_pse/examples/simple_ion_exchange.py | 2 +- src/reaktoro_pse/examples/thermal_precipitation.py | 2 +- src/reaktoro_pse/parallel_tools/tests/test_manager.py | 2 +- src/reaktoro_pse/tests/test_reaktoro_block.py | 2 +- .../tutorials/basic_reaktoro_block_interaction.ipynb | 2 +- src/reaktoro_pse/tutorials/integration_with_ro.ipynb | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/reaktoro_pse/core/tests/test_reaktoro_builder.py b/src/reaktoro_pse/core/tests/test_reaktoro_builder.py index c9c4d42..fe563c3 100644 --- a/src/reaktoro_pse/core/tests/test_reaktoro_builder.py +++ b/src/reaktoro_pse/core/tests/test_reaktoro_builder.py @@ -35,7 +35,7 @@ ) from pyomo.environ import Block, assert_optimal_termination from idaes.core.util.model_statistics import degrees_of_freedom -from watertap.core.solvers import get_solver +from watertap_solvers import get_solver @pytest.fixture diff --git a/src/reaktoro_pse/examples/biogas_combustion.py b/src/reaktoro_pse/examples/biogas_combustion.py index a761654..287c908 100644 --- a/src/reaktoro_pse/examples/biogas_combustion.py +++ b/src/reaktoro_pse/examples/biogas_combustion.py @@ -17,7 +17,7 @@ Constraint, units as pyunits, ) -from watertap.core.solvers import get_solver +from watertap_solvers import get_solver from pyomo.util.calc_var_value import calculate_variable_from_constraint import idaes.core.util.scaling as iscale diff --git a/src/reaktoro_pse/examples/reaktoro_pse_to_phreeqc_comparison/standard_model.py b/src/reaktoro_pse/examples/reaktoro_pse_to_phreeqc_comparison/standard_model.py index 75af141..99dd04b 100644 --- a/src/reaktoro_pse/examples/reaktoro_pse_to_phreeqc_comparison/standard_model.py +++ b/src/reaktoro_pse/examples/reaktoro_pse_to_phreeqc_comparison/standard_model.py @@ -17,7 +17,7 @@ Constraint, units as pyunits, ) -from watertap.core.solvers import get_solver +from watertap_solvers import get_solver from pyomo.util.calc_var_value import calculate_variable_from_constraint import idaes.core.util.scaling as iscale diff --git a/src/reaktoro_pse/examples/simple_desalination.py b/src/reaktoro_pse/examples/simple_desalination.py index 7ad74c3..7bc208b 100644 --- a/src/reaktoro_pse/examples/simple_desalination.py +++ b/src/reaktoro_pse/examples/simple_desalination.py @@ -19,7 +19,7 @@ units as pyunits, ) -from watertap.core.solvers import get_solver +from watertap_solvers import get_solver from pyomo.util.calc_var_value import calculate_variable_from_constraint import idaes.core.util.scaling as iscale diff --git a/src/reaktoro_pse/examples/simple_ion_exchange.py b/src/reaktoro_pse/examples/simple_ion_exchange.py index d309344..851c890 100644 --- a/src/reaktoro_pse/examples/simple_ion_exchange.py +++ b/src/reaktoro_pse/examples/simple_ion_exchange.py @@ -18,7 +18,7 @@ Constraint, units as pyunits, ) -from watertap.core.solvers import get_solver +from watertap_solvers import get_solver from pyomo.util.calc_var_value import calculate_variable_from_constraint import idaes.core.util.scaling as iscale diff --git a/src/reaktoro_pse/examples/thermal_precipitation.py b/src/reaktoro_pse/examples/thermal_precipitation.py index 986b043..e26876a 100644 --- a/src/reaktoro_pse/examples/thermal_precipitation.py +++ b/src/reaktoro_pse/examples/thermal_precipitation.py @@ -19,7 +19,7 @@ assert_optimal_termination, units as pyunits, ) -from watertap.core.solvers import get_solver +from watertap_solvers import get_solver from pyomo.util.calc_var_value import calculate_variable_from_constraint import reaktoro import idaes.core.util.scaling as iscale diff --git a/src/reaktoro_pse/parallel_tools/tests/test_manager.py b/src/reaktoro_pse/parallel_tools/tests/test_manager.py index 1a34170..addf873 100644 --- a/src/reaktoro_pse/parallel_tools/tests/test_manager.py +++ b/src/reaktoro_pse/parallel_tools/tests/test_manager.py @@ -24,7 +24,7 @@ assert_optimal_termination, units as pyunits, ) -from watertap.core.solvers import get_solver +from watertap_solvers import get_solver def test_blockBuild_with_speciation_block(build_rkt_state_with_species): diff --git a/src/reaktoro_pse/tests/test_reaktoro_block.py b/src/reaktoro_pse/tests/test_reaktoro_block.py index a51984d..6c256a1 100644 --- a/src/reaktoro_pse/tests/test_reaktoro_block.py +++ b/src/reaktoro_pse/tests/test_reaktoro_block.py @@ -19,7 +19,7 @@ assert_optimal_termination, units as pyunits, ) -from watertap.core.solvers import get_solver +from watertap_solvers import get_solver @pytest.fixture diff --git a/src/reaktoro_pse/tutorials/basic_reaktoro_block_interaction.ipynb b/src/reaktoro_pse/tutorials/basic_reaktoro_block_interaction.ipynb index 506df63..7ed6789 100644 --- a/src/reaktoro_pse/tutorials/basic_reaktoro_block_interaction.ipynb +++ b/src/reaktoro_pse/tutorials/basic_reaktoro_block_interaction.ipynb @@ -132,7 +132,7 @@ ")\n", "\n", "from idaes.core.util.model_statistics import degrees_of_freedom\n", - "from watertap.core.solvers import get_solver\n", + "from watertap_solvers import get_solver\n", "\n", "from pyomo.util.calc_var_value import calculate_variable_from_constraint\n", "\n", diff --git a/src/reaktoro_pse/tutorials/integration_with_ro.ipynb b/src/reaktoro_pse/tutorials/integration_with_ro.ipynb index d6d43a4..2309453 100644 --- a/src/reaktoro_pse/tutorials/integration_with_ro.ipynb +++ b/src/reaktoro_pse/tutorials/integration_with_ro.ipynb @@ -69,7 +69,7 @@ ")\n", "\n", "from idaes.core.util.model_statistics import degrees_of_freedom\n", - "from watertap.core.solvers import get_solver\n", + "from watertap_solvers import get_solver\n", "\n", "from idaes.core.util.initialization import propagate_state\n", "\n", From ad56023c32a01c2252b581d2525f2286d03736c0 Mon Sep 17 00:00:00 2001 From: Ludovico Bianchi Date: Mon, 9 Dec 2024 09:32:49 -0600 Subject: [PATCH 3/7] Try removing watertap from dev requirements --- requirements-dev.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index d16d263..801e515 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,6 +1,5 @@ black==24.8.0 pytest-cov idaes-pse>=2.5.0 -watertap>=1.0.0 pyomo>=6.8.0 --editable .[testing] \ No newline at end of file From efd512471a339ab2f447daee9025fa6b6fcd1856 Mon Sep 17 00:00:00 2001 From: Ludovico Bianchi Date: Mon, 9 Dec 2024 09:47:37 -0600 Subject: [PATCH 4/7] Try installing watertap right before ipynb tests are run --- .github/workflows/checks.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index caabd96..8b9baca 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -105,6 +105,10 @@ jobs: jupyter kernelspec list - name: Run pytest with nbmake run: | + # watertap is needed to run the following notebooks in src/reaktoro_pse/tutorials: + # - basic_reaktoro_block_interaction.ipynb + # - integration_with_ro.ipynb + pip install watertap pytest --nbmake --nbmake-kernel="${{ env.KERNEL_NAME }}" src/reaktoro_pse/tutorials/*.ipynb - name: Upload coverage report as job artifact if: matrix.coverage From 1d0021b10dea72b62e154d814f676f1acf89a566 Mon Sep 17 00:00:00 2001 From: Ludovico Bianchi Date: Mon, 9 Dec 2024 09:47:57 -0600 Subject: [PATCH 5/7] Update description of dependencies in ipynb tutorials --- .../tutorials/basic_reaktoro_block_interaction.ipynb | 3 ++- src/reaktoro_pse/tutorials/integration_with_ro.ipynb | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/reaktoro_pse/tutorials/basic_reaktoro_block_interaction.ipynb b/src/reaktoro_pse/tutorials/basic_reaktoro_block_interaction.ipynb index 7ed6789..a2f0837 100644 --- a/src/reaktoro_pse/tutorials/basic_reaktoro_block_interaction.ipynb +++ b/src/reaktoro_pse/tutorials/basic_reaktoro_block_interaction.ipynb @@ -13,7 +13,8 @@ "* IDAES - Python package extending Pyomo for flowsheet modeling\n", "* cyipopt - Solver necessary for use with gray box models\n", "* Reaktoro-pse - Python package for building Reaktoro gray box models\n", - "* WaterTAP - for cyipopt-solver wrapper " + "* watertap-solvers - for cyipopt solver wrapper\n", + "* WaterTAP - for NaCl property package" ] }, { diff --git a/src/reaktoro_pse/tutorials/integration_with_ro.ipynb b/src/reaktoro_pse/tutorials/integration_with_ro.ipynb index 2309453..66ca614 100644 --- a/src/reaktoro_pse/tutorials/integration_with_ro.ipynb +++ b/src/reaktoro_pse/tutorials/integration_with_ro.ipynb @@ -13,6 +13,7 @@ "* IDAES - Python package extending Pyomo for flowsheet modeling\n", "* cyipopt - Solver necessary for use with gray box models\n", "* Reaktoro-pse - Python package for building Reaktoro gray box models\n", + "* watertap-solvers - for cyipopt solver wrapper\n", "* WaterTAP - Unit models" ] }, From d3a2b738e2fd70aefc92f032469688745c6245e6 Mon Sep 17 00:00:00 2001 From: Ludovico Bianchi Date: Mon, 9 Dec 2024 09:57:00 -0600 Subject: [PATCH 6/7] Fix random typo I spotted --- src/reaktoro_pse/parallel_tools/reaktoro_block_manager.py | 2 +- .../tutorials/basic_reaktoro_block_interaction.ipynb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/reaktoro_pse/parallel_tools/reaktoro_block_manager.py b/src/reaktoro_pse/parallel_tools/reaktoro_block_manager.py index 084ae02..15643b6 100644 --- a/src/reaktoro_pse/parallel_tools/reaktoro_block_manager.py +++ b/src/reaktoro_pse/parallel_tools/reaktoro_block_manager.py @@ -219,7 +219,7 @@ class ReaktoroBlockManagerData(ProcessBlockData): default=True, domain=bool, description="Enables use of parallel workers", - doc="""If true, will parallelize all rekatoro solver calls using multiprocessing""", + doc="""If true, will parallelize all reaktoro solver calls using multiprocessing""", ), ) CONFIG.declare( diff --git a/src/reaktoro_pse/tutorials/basic_reaktoro_block_interaction.ipynb b/src/reaktoro_pse/tutorials/basic_reaktoro_block_interaction.ipynb index a2f0837..a452bcb 100644 --- a/src/reaktoro_pse/tutorials/basic_reaktoro_block_interaction.ipynb +++ b/src/reaktoro_pse/tutorials/basic_reaktoro_block_interaction.ipynb @@ -41,7 +41,7 @@ "\n", "* Input ion composition (apparent or exact species)\n", "* System temperature, pressure, pH, and charge neutrality\n", - "* Rekatoro databases and activity models\n", + "* Reaktoro databases and activity models\n", "* Outputs supported by Reaktoro and custom outputs built using Reaktoro database information and outputs \n", "\n", "The general API structure is shown in Figure bellow. The figure shows the type of inputs and outputs and how they are handled by core api to configure Reaktoro Graybox model. " From 0f8c668d70f8ec440e6c454d695f430f43828888 Mon Sep 17 00:00:00 2001 From: Ludovico Bianchi Date: Mon, 9 Dec 2024 15:50:43 -0600 Subject: [PATCH 7/7] Use watertap-solvers from PyPI --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 2b14e0d..c6bc931 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,7 @@ readme = "README.md" dynamic = ["version"] dependencies = [ "pyomo", - "watertap-solvers @ git+https://github.com/watertap-org/watertap-solvers@24.12.9", + "watertap-solvers >=24.12.9", ] [project.optional-dependencies] testing = [