Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate watertap.ui.fsapi to idaes_flowsheet_processor #1518

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions docs/how_to_guides/how_to_use_ui_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@

Add a flowsheet to the UI
==========================
.. py:currentmodule:: watertap.ui.fsapi
.. py:currentmodule:: idaes_flowsheet_processor.api

This API is intended for model developers who would like to connect their flowsheets to the UI.
Developers can select which variables to "export" to the UI for each component of the model,
and provide extra metadata (display name, description) for them. For flowsheets, they should also
specify how to build and solve the flowsheets.

For reference, see :class:`FlowsheetInterface` and :class:`FlowsheetExport` in the `watertap.ui.fsapi` module.
For reference, see :class:`FlowsheetInterface` and :class:`FlowsheetExport` in the `idaes_flowsheet_processor.api` module.

----

In some Python module, define the function ``export_to_ui``, which will look
similar to this::

from watertap.ui.fsapi import FlowsheetInterface, FlowsheetCategory
from idaes_flowsheet_processor.api import FlowsheetInterface, FlowsheetCategory
def export_to_ui():
return FlowsheetInterface(
name="NF-DSPM-DE",
Expand Down
2 changes: 1 addition & 1 deletion docs/technical_reference/ui/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ changes from the UI front-end.

.. include:: <isonum.txt>

.. py:currentmodule:: watertap.ui.fsapi
.. py:currentmodule:: idaes_flowsheet_processor.api

.. contents:: Contents
:depth: 1
Expand Down
13 changes: 11 additions & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
black==24.3.0
pre-commit

# coverage
pytest-cov

# TODO pin exact version for pylint and astroid
pylint<3
astroid
# Defer to setup.py contents
-e .[dev,notebooks,oli_api]

# docs
sphinx==7.1.*
nbsphinx
sphinx_rtd_theme

-e .[testing,notebooks,oli_api]
16 changes: 1 addition & 15 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
# treebeardtech/nbmake#121
"nbmake != 1.5.1",
"nbconvert",
"idaes-flowsheet-processor @ git+https://github.com/watertap-org/idaes-flowsheet-processor@main",
],
"notebooks": [
"jupyter",
Expand All @@ -104,21 +105,6 @@
"requests",
"cryptography", # for encrypting OLI credentials
],
"dev": [
"nbsphinx", # jupyter notebook support for sphinx
"jinja2<3.1.0", # see watertap-org/watertap#449
"Sphinx==7.1.*", # docs
"sphinx_rtd_theme", # docs
"urllib3 < 2", # see watertap-org/watertap#1021,
# other requirements
"linkify-it-py",
"black", # code formatting
# other requirements
"pytest", # test framework
"pytest-cov", # code coverage
# treebeardtech/nbmake#121
"nbmake != 1.5.1",
],
},
package_data={ # Optional
"": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# "https://github.com/watertap-org/watertap/"
#################################################################################
from watertap.core.solvers import get_solver
from watertap.ui.fsapi import FlowsheetInterface
from idaes_flowsheet_processor.api import FlowsheetInterface
from watertap.flowsheets.RO_with_energy_recovery.RO_with_energy_recovery import (
build,
set_operating_conditions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# information, respectively. These files are also available online at the URL
# "https://github.com/watertap-org/watertap/"
#################################################################################
from watertap.ui.fsapi import FlowsheetInterface
from idaes_flowsheet_processor.api import FlowsheetInterface
from watertap.core.util.initialization import assert_degrees_of_freedom
from watertap.flowsheets.dye_desalination.dye_desalination import (
build,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# "https://github.com/watertap-org/watertap/"
#################################################################################
from watertap.core.solvers import get_solver
from watertap.ui.fsapi import FlowsheetInterface
from idaes_flowsheet_processor.api import FlowsheetInterface
from watertap.flowsheets.electrodialysis.electrodialysis_1stack_conc_recirc import (
build,
_condition_base,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import idaes.logger as idaeslog

from watertap.ui.fsapi import FlowsheetInterface
from idaes_flowsheet_processor.api import FlowsheetInterface

from watertap.flowsheets.full_water_resource_recovery_facility.BSM2_P_extension import (
build,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from pyomo.environ import units as pyunits, assert_optimal_termination
from pyomo.util.check_units import assert_units_consistent

from watertap.ui.fsapi import FlowsheetInterface
from idaes_flowsheet_processor.api import FlowsheetInterface

from watertap.core.util.initialization import assert_degrees_of_freedom

Expand Down
2 changes: 1 addition & 1 deletion watertap/flowsheets/gac/gac_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
)
from watertap.costing.unit_models.gac import ContactorType
from watertap.flowsheets.gac import gac as gac_fs
from watertap.ui.fsapi import FlowsheetInterface, FlowsheetCategory
from idaes_flowsheet_processor.api import FlowsheetInterface, FlowsheetCategory

__author__ = "Hunter Barber"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# information, respectively. These files are also available online at the URL
# "https://github.com/watertap-org/watertap/"
#################################################################################
from watertap.ui.fsapi import FlowsheetInterface, FlowsheetCategory
from idaes_flowsheet_processor.api import FlowsheetInterface, FlowsheetCategory
from watertap.flowsheets.generic_desalination_train import generic_train
from pyomo.environ import units as pyunits
from idaes.core.solvers import get_solver
Expand Down
2 changes: 1 addition & 1 deletion watertap/flowsheets/lsrro/lsrro_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# "https://github.com/watertap-org/watertap/"
#################################################################################
from watertap.core.solvers import get_solver
from watertap.ui.fsapi import FlowsheetInterface
from idaes_flowsheet_processor.api import FlowsheetInterface
from watertap.flowsheets.lsrro.lsrro import (
build,
set_operating_conditions,
Expand Down
2 changes: 1 addition & 1 deletion watertap/flowsheets/mvc/mvc_single_stage_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# information, respectively. These files are also available online at the URL
# "https://github.com/watertap-org/watertap/"
#################################################################################
from watertap.ui.fsapi import FlowsheetInterface
from idaes_flowsheet_processor.api import FlowsheetInterface
from watertap.flowsheets.mvc.mvc_single_stage import (
build,
set_operating_conditions,
Expand Down
2 changes: 1 addition & 1 deletion watertap/flowsheets/nf_dspmde/nf_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# information, respectively. These files are also available online at the URL
# "https://github.com/watertap-org/watertap/"
#################################################################################
from watertap.ui.fsapi import FlowsheetInterface, FlowsheetCategory
from idaes_flowsheet_processor.api import FlowsheetInterface, FlowsheetCategory
from watertap.flowsheets.nf_dspmde import nf
from watertap.flowsheets.nf_dspmde import nf_with_bypass
from watertap.unit_models.nanofiltration_DSPMDE_0D import ConcentrationPolarizationType
Expand Down
2 changes: 1 addition & 1 deletion watertap/flowsheets/oaro/oaro_multi_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# "https://github.com/watertap-org/watertap/"
#################################################################################
from watertap.core.solvers import get_solver
from watertap.ui.fsapi import FlowsheetInterface
from idaes_flowsheet_processor.api import FlowsheetInterface
from watertap.flowsheets.oaro.oaro_multi import (
build,
set_operating_conditions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@ def display_costing(m):


def export_to_ui():
from watertap.ui.fsapi import FlowsheetInterface
from idaes_flowsheet_processor.api import FlowsheetInterface

def noop(*args, **kwargs):
return
Expand Down
Empty file removed watertap/ui/__init__.py
Empty file.
Loading
Loading