Skip to content

Commit

Permalink
Iterate
Browse files Browse the repository at this point in the history
  • Loading branch information
martinRenou committed Sep 26, 2023
1 parent 9890044 commit 55d1015
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 21 deletions.
2 changes: 1 addition & 1 deletion beakerx_widgets/beakerx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

from ._version import version_info, __version__
# from .commands import parse_widgets
from .commands import parse_widgets
from .forms import *
from .jupyter_server_handlers import setup_jupyter_server_handlers
from .magics import *
Expand Down
10 changes: 1 addition & 9 deletions beakerx_widgets/beakerx/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import sys

import beakerx
from notebook import notebookapp as app

from .bkr2ipynb import main
from .install import install, uninstall
Expand Down Expand Up @@ -63,14 +62,9 @@ def bkr2ipynb_subparser(subparser):
# Py4JServer(args.port, args.pyport, args.kernel, args.context)


def run_jupyter(jupyter_commands):
app.launch_new_instance(jupyter_commands)


def init_parser():
parser = argparse.ArgumentParser()
parser.add_argument('--version', action='version', version=beakerx.__version__)
parser.set_defaults(func=run_jupyter)

subparsers = parser.add_subparsers()
install_subparser(subparsers)
Expand All @@ -83,9 +77,7 @@ def init_parser():
def parse_widgets():
parser = init_parser()
args, jupyter_commands = parser.parse_known_args()
if args.func == run_jupyter:
args.func(jupyter_commands)
elif not jupyter_commands:
if not jupyter_commands:
args.func(args)
else:
parser.parse_args(jupyter_commands)
12 changes: 3 additions & 9 deletions beakerx_widgets/beakerx/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,8 @@ def make_parser():


def install(args):
if sys.platform == 'win32':
subprocess.check_call(["jupyter", "nbextension", "install", "beakerx", "--py", "--sys-prefix"])

subprocess.check_call(["jupyter", "nbextension", "enable", "beakerx", "--py", "--sys-prefix"])
subprocess.check_call(["jupyter", "serverextension", "enable", "beakerx", "--py", "--sys-prefix"])
if LAB_VERSION is not None and LAB_VERSION != 3:
subprocess.check_call(["jupyter", "server", "extension", "enable", "beakerx", "--py", "--sys-prefix"])
if LAB_VERSION is not None and LAB_VERSION < 3:
subprocess.call(["jupyter", "labextension", "install", "@jupyter-widgets/jupyterlab-manager", "--no-build"],
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
if LAB_VERSION == 1:
Expand All @@ -142,9 +138,7 @@ def install(args):


def uninstall(args):
subprocess.check_call(["jupyter", "nbextension", "disable", "beakerx", "--py", "--sys-prefix"])
subprocess.check_call(["jupyter", "nbextension", "uninstall", "beakerx", "--py", "--sys-prefix"])
subprocess.check_call(["jupyter", "serverextension", "disable", "beakerx", "--py", "--sys-prefix"])
subprocess.check_call(["jupyter", "server", "extension", "disable", "beakerx", "--py", "--sys-prefix"])
if LAB_VERSION is not None:
subprocess.check(["jupyter", "labextension", "uninstall", "@beakerx/beakerx-widgets"],
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
Expand Down
2 changes: 1 addition & 1 deletion beakerx_widgets/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["jupyter_packaging~=0.10,<2", "jupyterlab~=3.1"]
requires = ["jupyter_packaging~=0.10,<2", "jupyterlab>4,<5"]
build-backend = "jupyter_packaging.build_api"

[tool.jupyter-packaging.options]
Expand Down
2 changes: 1 addition & 1 deletion configuration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ channels:
- conda-forge
dependencies:
- bottle
- ipywidgets>=7.5.1,<8
- ipywidgets>=7.5.1,<9
- pandas
- py4j
- pyspark
Expand Down

0 comments on commit 55d1015

Please sign in to comment.