-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Labels
enhancementNew feature or requestNew feature or request
Milestone
Description
Summary
Add a stub .plot property on Result that raises a helpful ImportError if fluxopt-plot is not installed. This makes the accessor discoverable via tab-completion without coupling core to the plot package.
Design
# fluxopt/results.py
class Result:
@property
def plot(self):
raise ImportError(
"Plotting requires fluxopt-plot. "
"Install it with: pip install fluxopt-plot"
)When fluxopt-plot is installed, it monkey-patches this property at import time:
# fluxopt_plot/__init__.py
from fluxopt.results import Result
from fluxopt_plot.accessor import PlotAccessor
Result.plot = property(lambda self: PlotAccessor(self))Acceptance Criteria
-
Result.plotraisesImportErrorwith install instructions whenfluxopt-plotis absent - Property is discoverable in
dir(result)and tab-completion - Does not add any dependencies to core
Refs
Part of #47 — Architecture: Package Separation, SolutionResult Design, and Stability Tiers
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request