Skip to content
Merged
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
15 changes: 5 additions & 10 deletions refl1d/webview/server/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,13 @@
from refl1d import __version__

# Register the refl1d model loader
# from refl1d.bumps_interface import fitplugin
# from .profile_plot import plot_sld_profile_plotly
# and the serialized model migrations
from refl1d.bumps_interface import fitplugin
from bumps.cli import install_plugin

CLIENT_PATH = Path(__file__).parent.parent / "client"
install_plugin(fitplugin)
Copy link
Member

Choose a reason for hiding this comment

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

It feels like we have two interfaces: bumps.cli.install_plugin and bumps.webview.server.cli.plugin_main. We should refactor bumps with the following in mind:

  • The old bumps.cli is deprecated
  • We may be moving bumps.webview.server.cli to bumps.cli.
  • We may be using the plugin without calling main, such as from a jupyter notebook.
  • The jupyter notebook may need app name, version and client path.

A possible solution is to define app_name, app_version and client_path in bumps.plugin and reference them from there in the cli and in webview.

A minimal 1.0 change is to move the install_plugin method out of bumps.cli. Maybe into bumps/__init__.py?


# from dataclasses import dataclass
# from bumps.webview.server.cli import BumpsOptions, SERIALIZERS
# @dataclass
# class Refl1DOptions(BumpsOptions):
# serializer: SERIALIZERS = "dataclass"
# headless: bool = True
# bumps_cli.OPTIONS_CLASS = Refl1DOptions
CLIENT_PATH = Path(__file__).parent.parent / "client"


def main():
Expand Down
Loading