Skip to content

Commit

Permalink
Upgrade init file
Browse files Browse the repository at this point in the history
  • Loading branch information
fcollonval authored Oct 9, 2023
1 parent e4a6523 commit 23bcf7e
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions jupyterlab_search_replace/__init__.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import json
from pathlib import Path

from ._version import __version__

HERE = Path(__file__).parent.resolve()

with (HERE / "labextension" / "package.json").open() as fid:
data = json.load(fid)
try:
from ._version import __version__
except ImportError:
# Fallback when using the package in dev mode without installing
# in editable mode with pip. It is highly recommended to install
# the package from a stable release or in editable mode: https://pip.pypa.io/en/stable/topics/local-project-installs/#editable-installs
import warnings
warnings.warn("Importing 'jupyterlab_search_replace' outside a proper installation.")
__version__ = "dev"


def _jupyter_labextension_paths():
return [{"src": "labextension", "dest": data["name"]}]
return [{"src": "labextension", "dest": "jupyterlab-search-replace"}]


from .handlers import setup_handlers
Expand All @@ -30,7 +30,3 @@ def _load_jupyter_server_extension(server_app):
"""
setup_handlers(server_app.web_app)
server_app.log.info("Registered search-replace extension")


# For backward compatibility with notebook server - useful for Binder/JupyterHub
load_jupyter_server_extension = _load_jupyter_server_extension

0 comments on commit 23bcf7e

Please sign in to comment.