Skip to content

Commit

Permalink
Resolve dependencies issues (#49)
Browse files Browse the repository at this point in the history
* Move testing dependencies to extras_require and remove dev target

* Add pytest importorskip for optional dependencies

* Use Action from PR instead of main

* Remove FastAPI code and dependencies for the time being

* Remove unused code causing error message shown during tests

* Add pint version constraint for compat with unreleased IDAES/idaes-pse#1438
  • Loading branch information
lbianchi-lbl authored Jun 21, 2024
1 parent 320368f commit aa95ba5
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 245 deletions.
10 changes: 1 addition & 9 deletions .github/actions/install/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,7 @@ runs:
env:
_pip_install_url: ${{ github.server_url }}/${{ github.repository }}@${{ github.ref }}
run: |
pip install --progress-bar off -r requirements-dev.txt
- name: Install using pip (git+... URL)
if: inputs.variant == 'standard'
shell: bash -l {0}
env:
_pip_install_url: ${{ github.server_url }}/${{ github.repository }}@${{ github.ref }}
run: |
pip install --progress-bar off "git+$_pip_install_url" idaes-pse pytest
pip install --progress-bar off "idaes-ui[testing] @ git+$_pip_install_url" idaes-pse
- name: Install extensions
shell: bash -l {0}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
- os: win64
runner-image: windows-2022
steps:
- uses: IDAES/idaes-ui/.github/actions/install@main
- uses: IDAES/idaes-ui/.github/actions/install@refs/pull/49/merge
with:
variant: ${{ matrix.install-variant }}
python-version: ${{ matrix.python-version }}
Expand Down Expand Up @@ -99,7 +99,7 @@ jobs:
steps:
#python starts here
- name: Install python code
uses: IDAES/idaes-ui/.github/actions/install@main
uses: IDAES/idaes-ui/.github/actions/install@refs/pull/49/merge
with:
variant: ${{ matrix.install-variant }}
python-version: ${{ matrix.python-version }}
Expand Down
3 changes: 2 additions & 1 deletion docs/tests/test_screenshots.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@


# third-party
from playwright.sync_api import Page, expect
import pytest
pytest.importorskip("playwright", reason="Playwright not installed")
from playwright.sync_api import Page, expect

# package
from idaes.models.flowsheets.demo_flowsheet import build_flowsheet
Expand Down
104 changes: 0 additions & 104 deletions idaes_ui/fv/app.py

This file was deleted.

2 changes: 0 additions & 2 deletions idaes_ui/fv/model_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,6 @@ def _get_diagnostics(self, id_):
}

self._write_json(200, build_diagnostics_report)
# json.dumps(diag_data_config)
json.dumps(diagnostics_toolbox_report)

# === PUT ===
def do_PUT(self):
Expand Down
6 changes: 4 additions & 2 deletions idaes_ui/fv/models/tests/test_diag.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
Tests for the diagnostics models
"""

import pytest
import json

import pytest
requests = pytest.importorskip("requests")

from ..diag import DiagnosticsData
from . import flowsheet
import requests


# get diagnostics data from remote
Expand Down
102 changes: 0 additions & 102 deletions idaes_ui/fv/tests/test_app.py

This file was deleted.

5 changes: 3 additions & 2 deletions idaes_ui/fv/tests/test_fsvis.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@
import logging
import os
from pathlib import Path
import pytest
import re
import requests
import time

import pytest
requests = pytest.importorskip("requests")

from pyomo.environ import ConcreteModel
from idaes.core import FlowsheetBlock
from idaes.models.properties.activity_coeff_models.BTX_activity_coeff_VLE import (
Expand Down
29 changes: 18 additions & 11 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,24 +37,31 @@ build-backend = "setuptools.build_meta"
"Topic :: Software Development :: Libraries :: Python Modules",
]
dependencies = [
# IMPORTANT: idaes-pse should NOT be added to the default dependencies
# this causes, among other things, CI failures in IDAES/idaes-pse
# Don't version setuptools, various bits complain
"setuptools",
# For running tests
"idaes-pse @ git+https://github.com/IDAES/idaes-pse@main",
"pytest",
"playwright==1.42.0",
"pytest-playwright==0.4.4",
"requests==2.31.0",
"pydantic~=2.0",
"pydantic ~= 2.0",

# for compatibility with IDAES unit formatting
# following IDAES/idaes-pse#1438 is released
"pint < 0.24",

# fastapi is not used at the moment; uncomment once fastapi is needed again
# "fastapi",
# "uvicorn",
]

keywords = ["IDAES", "energy systems", "chemical engineering", "process modeling"]

[project.optional-dependencies]
dev = [
# For adding copyright headers (see addheader.yml and the readme)
"addheader >= 0.3.0",
# Dev versions of idaes/idaes-ui in requirements-dev.txt
testing = [
"pytest",
"pytest-icdiff >= 0.7", # readable dict diffs for test_flowsheet and others
"playwright==1.42.0",
"pytest-playwright==0.4.4",
"requests==2.31.0",
# "httpx", # fastapi testing
]
# For packaging
pkg = [
Expand Down
14 changes: 4 additions & 10 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
--editable .[dev]
--editable .[testing]

# For adding copyright headers (see addheader.yml and the readme)
addheader >= 0.3.0
idaes-pse @ git+https://github.com/IDAES/idaes-pse@main
pydantic~=2.0
fastapi
uvicorn
pytest-icdiff >= 0.7 # readable dict diffs for test_flowsheet and others
httpx # fastapi testing
# for testing w/playwright
playwright==1.42.0
pytest-playwright==0.4.4
requests==2.31.0

0 comments on commit aa95ba5

Please sign in to comment.