Skip to content
Merged
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
8 changes: 5 additions & 3 deletions flixopt/flow_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ def plot_network(

def start_network_app(self):
"""Visualizes the network structure of a FlowSystem using Dash, Cytoscape, and networkx.
Requires optional dependencies: dash, dash-cytoscape, networkx, werkzeug.
Requires optional dependencies: dash, dash-cytoscape, dash-daq, networkx, flask, werkzeug.
"""
from .network_app import DASH_CYTOSCAPE_AVAILABLE, VISUALIZATION_ERROR, flow_graph, shownetwork

Expand All @@ -258,7 +258,8 @@ def start_network_app(self):
if not DASH_CYTOSCAPE_AVAILABLE:
raise ImportError(
f'Network visualization requires optional dependencies. '
f'Install with: pip install flixopt[viz], flixopt[full] or pip install dash dash_cytoscape networkx werkzeug. '
f'Install with: `pip install flixopt[network_viz]`, `pip install flixopt[full]` '
f'or: `pip install dash dash-cytoscape dash-daq networkx werkzeug`. '
f'Original error: {VISUALIZATION_ERROR}'
)

Expand All @@ -278,7 +279,8 @@ def stop_network_app(self):
if not DASH_CYTOSCAPE_AVAILABLE:
raise ImportError(
f'Network visualization requires optional dependencies. '
f'Install with: pip install flixopt[viz]. '
f'Install with: `pip install flixopt[network_viz]`, `pip install flixopt[full]` '
f'or: `pip install dash dash-cytoscape dash-daq networkx werkzeug`. '
f'Original error: {VISUALIZATION_ERROR}'
)

Expand Down
93 changes: 48 additions & 45 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,73 +36,76 @@ dependencies = [
# Core scientific computing
"numpy >= 1.21.5, < 3",
"pandas >= 2.0.0, < 3",
"xarray >= 2024.2.0, < 2026.0", # CalVer: allow through next calendar year
# Optimization and data handling
"linopy >=0.5.7, <0.5.8", # Update and test regularly
"linopy >= 0.5.1, < 0.6", # Widened from patch pin to minor range
"netcdf4 >= 1.6.1, < 2",
# Utilities
"PyYAML >= 6.0.0, < 7",
"rich >= 13.0.0",
"tomli >= 2.0.1; python_version < '3.11'", # Only needed with python 3.10 or earlier
"pyyaml >= 6.0.0, < 7",
"rich >= 13.0.0, < 15",
"tomli >= 2.0.1, < 3; python_version < '3.11'", # Only needed with python 3.10 or earlier
# Default solver
"highspy >= 1.5.3",
"highspy >= 1.5.3, < 2",

# Visualization
"matplotlib >= 3.5.2, < 4.0.0",
"plotly >=5.15.0, <6.4.0",
"matplotlib >= 3.5.2, < 4",
"plotly >= 5.15.0, < 7",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

❓ Verification inconclusive

Resolve Plotly↔nbformat mismatch to prevent CI breakage.

Base allows Plotly < 7 while dev pins nbformat==5.10.4 (<6). If Plotly 6.x needs nbformat≥6 (or vice‑versa), installs with the dev extra will fail. Choose one strategy:

  • Option A (safer now): cap Plotly to < 6 across base until CI is fixed.
  • Option B (forward): keep Plotly < 7, drop/raise the nbformat cap, and fix CI.

Recommended (A) for this PR’s “bounds” scope:

-    "plotly >= 5.15.0, < 7",
+    # Plotly 6+ conflicts with nbformat<6 in dev; widen after CI fix
+    "plotly >= 5.15.0, < 6",

Also applies to: 81-82


Cap Plotly to <6 in base deps to avoid nbformat mismatch / CI breakage.

Base currently allows "plotly >= 5.15.0, < 7" while dev pins nbformat==5.10.4 (<6). Plotly v6 drops support for older Jupyter and introduced regressions that have broken notebook rendering/HTML export — pin Plotly <6 until CI and notebook integrations are validated. (plotly.com)

-    "plotly >= 5.15.0, < 7",
+    # Plotly 6+ conflicts with nbformat<6 in dev; widen after CI fix
+    "plotly >= 5.15.0, < 6",

Also applies to: 81-82

🤖 Prompt for AI Agents
In pyproject.toml around line 52 (and also update occurrences at lines 81-82),
the Plotly base dependency range allows "< 7" which can pull Plotly v6 and cause
nbformat/Jupyter/CI breakage; change the constraint to cap Plotly to "< 6"
(e.g., "plotly >= 5.15.0, < 6") in the base deps and make the same change for
the other listed occurrences so CI and notebook integrations keep using the
tested v5 series.

]

[project.optional-dependencies]
# Interactive network visualization with enhanced color picker
network-viz = [
"dash >= 3.0.0",
"dash-cytoscape >= 1.0.0",
"dash-daq >= 0.6.0",
"networkx >= 3.0.0",
"werkzeug >= 3.0.0",
network_viz = [
"dash >= 3.0.0, < 4",
"dash-cytoscape >= 1.0.0, < 2",
"dash-daq >= 0.6.0, < 1",
"networkx >= 3.0.0, < 4",
"werkzeug >= 3.0.0, < 4",
"flask >= 3.0.0, < 4", # Explicit Flask cap to prevent transitive major bumps
]

# Full feature set (everything except dev tools)
full = [
"pyvis ==0.3.2", # Visualizing FlowSystem Network
"tsam >= 2.3.1, < 3.0.0", # Time series aggregation
"scipy >= 1.15.1, < 2.0.0", # Used by tsam. Prior versions have conflict with highspy. See https://github.com/scipy/scipy/issues/22257
"gurobipy >= 10.0.0",
"dash >= 3.0.0", # Visualizing FlowSystem Network as app
"dash-cytoscape >= 1.0.0", # Visualizing FlowSystem Network as app
"dash-daq >= 0.6.0", # Visualizing FlowSystem Network as app
"networkx >= 3.0.0", # Visualizing FlowSystem Network as app
"werkzeug >= 3.0.0", # Visualizing FlowSystem Network as app
"pyvis==0.3.2", # Visualizing FlowSystem Network
"tsam >= 2.3.1, < 3", # Time series aggregation
"scipy >= 1.15.1, < 2", # Used by tsam. Prior versions have conflict with highspy. See https://github.com/scipy/scipy/issues/22257
"gurobipy >= 10.0.0, < 13",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Don't force proprietary solver into the dev extra.

Pinning gurobipy in [dev] makes contributor installs fail without a license. Keep gurobi in feature extras (e.g., full/solvers) and remove it from dev, or gate it behind a separate [dev-solver] extra.

 dev = [
@@
-    "gurobipy==12.0.3",
 ]

Optionally add:

+[project.optional-dependencies]
+dev-solver = [
+    "gurobipy==12.0.3",
+]

Also applies to: 88-88

🤖 Prompt for AI Agents
In pyproject.toml around line 71 (and also line 88), the proprietary package
"gurobipy >= 10.0.0, < 13" is incorrectly listed in the [dev] extras causing
contributor installs to fail without a license; remove gurobipy from the [dev]
extra and instead add it to a feature extra such as
[project.optional-dependencies.full] or [project.optional-dependencies.solvers],
or create a separate [project.optional-dependencies."dev-solver"] extra (and
update any docs/CI that reference the dev extra) so that installing dev
dependencies no longer requires a gurobi license.

"dash >= 3.0.0, < 4", # Visualizing FlowSystem Network as app
"dash-cytoscape >= 1.0.0, < 2", # Visualizing FlowSystem Network as app
"dash-daq >= 0.6.0, < 1", # Visualizing FlowSystem Network as app
"networkx >= 3.0.0, < 4", # Visualizing FlowSystem Network as app
"werkzeug >= 3.0.0, < 4", # Visualizing FlowSystem Network as app
"flask >= 3.0.0, < 4", # Explicit Flask cap to prevent transitive major bumps
]

# Development tools and testing
dev = [
"pytest >= 7.0.0",
"nbformat>=4.2.0", # Related to failing CI with Plotly>6
"ruff >= 0.9.0",
"pre-commit >= 4.0.0",
"pyvis ==0.3.2", # Visualizing FlowSystem
"tsam >= 2.3.1, < 3.0.0", # Time series aggregation
"scipy >= 1.15.1, < 2.0.0", # Used by tsam. Prior versions have conflict with highspy. See https://github.com/scipy/scipy/issues/22257
"gurobipy >= 10.0.0",
"dash >= 3.0.0",
"dash-cytoscape >= 1.0.0",
"dash-daq >= 0.6.0",
"networkx >= 3.0.0",
"werkzeug >= 3.0.0",
"pytest==8.4.2",
"nbformat==5.10.4",
"ruff==0.13.0",
"pre-commit==4.3.0",
"pyvis==0.3.2",
"tsam==2.3.1",
"scipy==1.15.1",
"gurobipy==12.0.3",
"dash==3.0.0",
"dash-cytoscape==1.0.0",
"dash-daq==0.6.0",
"networkx==3.0.0",
"werkzeug==3.0.0",
]

# Documentation building
docs = [
"mkdocs-material >= 9.0.0, < 10",
"mkdocstrings-python >= 1.0.0",
"mkdocs-table-reader-plugin >= 2.0.0",
"mkdocs-gen-files >= 0.4.0",
"mkdocs-include-markdown-plugin >= 6.0.0",
"mkdocs-literate-nav >= 0.6.0",
"markdown-include >= 0.8.0",
"pymdown-extensions >= 10.0.0",
"pygments >= 2.14.0",
"mike >= 2.0.0",
"mkdocs-material==9.6.19",
"mkdocstrings-python==1.18.2",
"mkdocs-table-reader-plugin==3.1.0",
"mkdocs-gen-files==0.5.0",
"mkdocs-include-markdown-plugin==7.1.7",
"mkdocs-literate-nav==0.6.2",
"markdown-include==0.8.1",
"pymdown-extensions==10.16.1",
"pygments==2.19.2",
"mike==2.1.3",
]

[project.urls]
Expand Down