Skip to content

Commit

Permalink
Merge pull request #93 from martinRenou/update_ipywidgets8
Browse files Browse the repository at this point in the history
  • Loading branch information
TanayParikh committed Feb 1, 2024
2 parents 61d4433 + c15c8f1 commit 7d7cf4c
Show file tree
Hide file tree
Showing 32 changed files with 9,981 additions and 9,345 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ jobs:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle
${{ runner.os }}-gradle
- name: Cache Conda
uses: actions/cache@v1
with:
path: ~/.conda
key: ${{ runner.os }}-mconda-${{ hashFiles('**/configuration.yml') }}
restore-keys: |
${{ runner.os }}-conda-
${{ runner.os }}-conda-
- name: Set up Conda
uses: conda-incubator/setup-miniconda@v2
with:
Expand All @@ -47,6 +47,7 @@ jobs:
uses: actions/checkout@v2
with:
repository: twosigma/beakerx_base
ref: master
path: beakerx_base
- name: Checkout beakerx_kernel_groovy repo
uses: actions/checkout@v2
Expand All @@ -62,19 +63,19 @@ jobs:
run: |
cd $GITHUB_WORKSPACE/beakerx_kernel_base
chmod +x gradlew
./gradlew install
./gradlew install
- name: Update conda package
shell: bash -l {0}
run: |
cd $GITHUB_WORKSPACE/beakerx_tests/dev_scripts
conda env create -n beakerx -f configuration.yml
conda env create -n beakerx -f configuration.yml
- name: Build Groovy Kernel
shell: bash -l {0}
run: |
conda activate beakerx
cd $GITHUB_WORKSPACE/beakerx_kernel_groovy/groovy-dist
pip install -r requirements.txt --verbose
beakerx_kernel_groovy install
beakerx_kernel_groovy install
- name: Build BeakerX Base
shell: bash -l {0}
run: |
Expand All @@ -96,4 +97,3 @@ jobs:
conda activate beakerx
pip install psutil
python ci_tests.py --app=notebook --tst=*.Widget*
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ beakerx_widgets/js/lib
# Karma tests coverage
beakerx_widgets/js/coverage

# Yarn cache
beakerx_widgets/js/.yarn

# JS bundles
beakerx_widgets/beakerx/static
beakerx_widgets/beakerx/labextension
Expand Down
14 changes: 0 additions & 14 deletions beakerx_widgets/beakerx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
from ._version import version_info, __version__
from .commands import parse_widgets
from .forms import *
from .handlers import setup_handlers
from .jupyter_server_handlers import setup_jupyter_server_handlers
from .magics import *
from .outputs import *
Expand Down Expand Up @@ -59,21 +58,8 @@ def _jupyter_server_extension_paths():
def _jupyter_server_extension_points():
return [dict(module="beakerx")]

def load_jupyter_server_extension(lab_app):
"""Registers the API handler to receive HTTP requests from the frontend extension.
Parameters
----------
lab_app: jupyterlab.labapp.LabApp
JupyterLab application instance
"""
url_path = "beakerx"
setup_handlers(lab_app.web_app, url_path)
lab_app.log.info("Registered beakerx server extension at URL path /{}".format(url_path))

def _load_jupyter_server_extension(serverapp):
"""Registers the API handler to receive HTTP requests from the frontend extension.
Used by JupyterLab 3
"""
url_path = "beakerx"
setup_jupyter_server_handlers(serverapp, url_path)
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)
168 changes: 0 additions & 168 deletions beakerx_widgets/beakerx/handlers.py

This file was deleted.

14 changes: 4 additions & 10 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,10 +138,8 @@ 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"])
if LAB_VERSION is not None:
subprocess.check_call(["jupyter", "server", "extension", "disable", "beakerx", "--py", "--sys-prefix"])
if LAB_VERSION is not None and LAB_VERSION < 3:
subprocess.check(["jupyter", "labextension", "uninstall", "@beakerx/beakerx-widgets"],
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
_install_kernelspec_manager(args.prefix, disable=True)
Expand Down
4 changes: 2 additions & 2 deletions beakerx_widgets/beakerx/jupyter_server_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import tornado
import zmq
from jupyter_server.base.handlers import APIHandler, JupyterHandler
from notebook.utils import url_path_join
from jupyter_server.utils import url_path_join
from tornado import web, gen
from tornado.simple_httpclient import HTTPStreamClosedError

Expand Down Expand Up @@ -149,7 +149,7 @@ def setup_jupyter_server_handlers(serverapp, url_path):
host_pattern = '.*$'
web_app = serverapp.web_app
base_url = web_app.settings["base_url"]

settings_route_pattern = url_path_join(base_url, url_path, '/settings')
spark_metrics_executors_route_pattern = url_path_join(base_url, url_path, '/sparkmetrics/executors')
version_route_pattern = url_path_join(base_url, url_path, '/version')
Expand Down
10 changes: 6 additions & 4 deletions beakerx_widgets/beakerx/outputs/outputcontainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from IPython.display import display

from beakerx_base import BeakerxHTML, BeakerxHTMLPre, CyclingDisplayBox, Tab, BeakerxHBox, GridView

try:
Expand Down Expand Up @@ -75,7 +77,7 @@ def __init__(self):

def display(self, output_container):
for widget in self.getWidgets(output_container):
widget._ipython_display_()
display(widget)


class TabbedOutputContainerLayoutManager(OutputContainerLayoutManager):
Expand All @@ -85,7 +87,7 @@ def __init__(self):
def display(self, output_container):
widgets = self.getWidgets(output_container)
tab = Tab(widgets, output_container.labels)
tab._ipython_display_()
display(tab)


class CyclingOutputContainerLayoutManager(OutputContainerLayoutManager):
Expand All @@ -100,7 +102,7 @@ def setPeriod(self, miliseconds):
def display(self, output_container):
c = CyclingDisplayBox(self.getWidgets(output_container))
c.setPeriod(self.period)
c._ipython_display_()
display(c)


class AbstractGridLayoutManager(OutputContainerLayoutManager):
Expand All @@ -125,7 +127,7 @@ def display(self, output_container):
rows.append(BeakerxHBox(self.createRow(columns, items, itemIndex)))

grid_view = GridView(rows)
grid_view._ipython_display_()
display(grid_view)

def createRow(self, columns, items, itemIndex):
row_items = []
Expand Down
Loading

0 comments on commit 7d7cf4c

Please sign in to comment.