Skip to content

Commit

Permalink
Merge pull request #356 from Carifio24/ecliptic-grid-start-color
Browse files Browse the repository at this point in the history
Update ecliptic grid color default
  • Loading branch information
pkgw authored Jul 28, 2023
2 parents 225b413 + fe5691f commit 449f88a
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 22 deletions.
22 changes: 16 additions & 6 deletions .check_enabled.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,32 @@
import sys

from jupyterlab.commands import get_app_info
from notebook.nbextensions import validate_nbextension
from notebook.serverextensions import validate_serverextension

try:
from nbclassic.nbextensions import validate_nbextension
except ImportError:
# `notebook` <= 6
from notebook.nbextensions import validate_nbextension

try:
from nbclassic.serverextensions import validate_serverextension
except ImportError:
# `notebook` <= 6
from notebook.serverextensions import validate_serverextension

# If there's a problem and we don't provide this, the validate function crashes :-(
logger = logging.getLogger('')
logger = logging.getLogger("")

if validate_nbextension('pywwt/extension', logger=logger) != []:
if validate_nbextension("pywwt/extension", logger=logger) != []:
print("Issue detected with nbextension")
sys.exit(1)

info = get_app_info()

if 'pywwt' not in info['extensions'] or 'pywwt' in info['disabled']:
if "pywwt" not in info["extensions"] or "pywwt" in info["disabled"]:
print("Issue detected with labextension")
sys.exit(1)

if validate_serverextension('pywwt', logger=logger) != []:
if validate_serverextension("pywwt", logger=logger) != []:
print("Issue detected with serverextension")
sys.exit(1)
1 change: 1 addition & 0 deletions .readthedocs_env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ dependencies:
- krb5
- lxml
- matplotlib
- nbclassic
- nodejs
- notebook
- numpydoc
Expand Down
6 changes: 3 additions & 3 deletions ci/azure-build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ jobs:
source activate-conda.sh
conda activate build
set -x
\conda install -y jupyterlab jupyter_contrib_nbextensions
jupyter nbextension list
jupyter serverextension list
\conda install -y jupyterlab nbclassic
jupyter nbclassic-extension list
jupyter nbclassic-serverextension list
jupyter labextension list
displayName: Print Jupyter extension status
Expand Down
19 changes: 12 additions & 7 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -244,13 +244,18 @@ this repository and install the package manually (note that this requires `npm
cd pywwt
pip install -e .

If you want to use the Jupyter widget, you will also need to run::

jupyter nbextension install --py --symlink --sys-prefix pywwt
jupyter nbextension enable --py --sys-prefix pywwt
jupyter nbextension list # check that the output shows pywwt as enabled and OK
jupyter serverextension enable --py --sys-prefix pywwt
jupyter serverextension list # check that the output shows pywwt as enabled and OK
If you want to use the Jupyter widget with a recent installation of the Jupyter
stack, you will also need to run::

jupyter nbclassic-extension install --py --symlink --sys-prefix pywwt
jupyter nbclassic-extension enable --py --sys-prefix pywwt
jupyter nbclassic-extension list # check that the output shows pywwt as enabled and OK
jupyter nbclassic-serverextension enable --py --sys-prefix pywwt
jupyter nbclassic-serverextension list # check that the output shows pywwt as enabled and OK

On older versions of Jupyter, use the ``nbextension`` subcommand instead of
``nbclassic-extension``, and use just ``serverextension`` instead of
``nbclassic-serverextension``.

And if you additionally want to use the widget in JupyterLab, run::

Expand Down
2 changes: 1 addition & 1 deletion pywwt/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ def instruments(self):
).tag(wwt="showEclipticGrid", wwt_reset=True)

ecliptic_grid_color = Color(
"blue", help="The color of the ecliptic grid " "(`str` or `tuple`)"
"green", help="The color of the ecliptic grid " "(`str` or `tuple`)"
).tag(wwt="eclipticGridColor", wwt_reset=True)

ecliptic_text = Bool(
Expand Down
7 changes: 6 additions & 1 deletion pywwt/jupyter_relay.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,11 +519,16 @@ def get_relay_hub(kernel=None):
def _list_running_servers_jl3():
import io
import json
from notebook.utils import check_pid
from jupyter_core.paths import jupyter_runtime_dir
import os.path
import re

try:
from jupyter_server.utils import check_pid
except ImportError:
# `notebook` <= 6
from notebook.utils import check_pid

runtime_dir = jupyter_runtime_dir()

if not os.path.isdir(runtime_dir):
Expand Down
17 changes: 13 additions & 4 deletions pywwt/jupyter_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,21 @@
# so let's try to fail gracefully if Jupyter modules are missing. `tornado` is a
# hard requirement appearing in setup.py.
try:
from notebook.utils import url_path_join
from notebook.base.handlers import IPythonHandler
try:
from jupyter_server.utils import url_path_join
except ImportError:
# `notebook` <= 6
from notebook.utils import url_path_join

try:
from jupyter_server.base.handlers import JupyterHandler
except ImportError:
# `notebook` <= 6
from notebook.base.handlers import IPythonHandler as JupyterHandler

HAVE_NOTEBOOK = True
except ImportError:
IPythonHandler = object
JupyterHandler = object
HAVE_NOTEBOOK = False

__all__ = [
Expand All @@ -35,7 +44,7 @@
STATIC_DIR = os.path.join(os.path.dirname(__file__), "web_static")


class WWTStaticFileHandler(IPythonHandler):
class WWTStaticFileHandler(JupyterHandler):
def get(self, filename):
static_path = os.path.join(STATIC_DIR, filename)

Expand Down

0 comments on commit 449f88a

Please sign in to comment.