diff --git a/.gitignore b/.gitignore index d1ba641..dd6acbe 100644 --- a/.gitignore +++ b/.gitignore @@ -7,12 +7,12 @@ node_modules/ *.egg-info/ .ipynb_checkpoints *.tsbuildinfo -datalayer/labextension +datalayer_core/labextension # Version file is handled by hatchling datalayer/_version.py -datalayer/static/*.js -datalayer/static/*.css +datalayer_core/static/*.js +datalayer_core/static/*.css coverage diff --git a/.licenserc.yaml b/.licenserc.yaml new file mode 100644 index 0000000..649fe0b --- /dev/null +++ b/.licenserc.yaml @@ -0,0 +1,49 @@ +header: + license: + spdx-id: Datalayer + copyright-owner: Datalayer, Inc. + copyright-year: 2023-2024 + content: | + Copyright (c) [year] [owner] + + Datalayer License + + paths-ignore: + - '**/*.apt' + - '**/*.cedar' + - '**/*.dash' + - '**/*.fga' + - '**/*.ipynb' + - '**/*.j2' + - '**/*.json' + - '**/*.mamba' + - '**/*.md' + - '**/*.mod' + - '**/*.nblink' + - '**/*.rego' + - '**/*.sum' + - '**/*.svg' + - '**/*.template' + - '**/*.tsbuildinfo' + - '**/*.txt' + - '**/*.yaml' + - '**/*.yml' + - '**/*_key' + - '**/*_key.pub' + - '**/.*' + - '**/LICENSE.txt' + - '**/MANIFEST.in' + - '**/build' + - '**/lib' + - '**/node_modules' + - '**/schemas' + - '**/ssh/*' + - '**/static' + - '**/themes' + - '**/typings' + - '**/*.patch' + - '**/*.bundle.js' + - '**/*.map.js' + - 'LICENSE' + + comment: on-failure \ No newline at end of file diff --git a/README.md b/README.md index 5f2abf3..506db62 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,9 @@ [![Become a Sponsor](https://img.shields.io/static/v1?label=Become%20a%20Sponsor&message=%E2%9D%A4&logo=GitHub&style=flat&color=1ABC9C)](https://github.com/sponsors/datalayer) -# Ξ Datalayer +# Ξ Datalayer Core -> Datalayer core. - -Datalayer is the base foundation package used by many other Datalayer packages. It contains base application classes and configuration inherited by other projects. +Datalayer Core is the base foundation package used by many other Datalayer packages. It contains base application classes and configuration inherited by other projects. It is also the meta package to get the other Datalayer packages installed. diff --git a/conftest.py b/conftest.py index 27c6988..1d17540 100644 --- a/conftest.py +++ b/conftest.py @@ -5,4 +5,4 @@ @pytest.fixture def jp_server_config(jp_server_config): - return {"ServerApp": {"jpserver_extensions": {"datalayer": True}}} + return {"ServerApp": {"jpserver_extensions": {"datalayer_core": True}}} diff --git a/datalayer/static/README.md b/datalayer/static/README.md deleted file mode 100644 index 5cde08f..0000000 --- a/datalayer/static/README.md +++ /dev/null @@ -1 +0,0 @@ -[![Datalayer](https://assets.datalayer.tech/datalayer-25.svg)](https://datalayer.io) diff --git a/datalayer/tests/__init__.py b/datalayer/tests/__init__.py deleted file mode 100644 index abe4c9e..0000000 --- a/datalayer/tests/__init__.py +++ /dev/null @@ -1 +0,0 @@ -"""Python unit tests for datalayer.""" diff --git a/datalayer/__init__.py b/datalayer_core/__init__.py similarity index 72% rename from datalayer/__init__.py rename to datalayer_core/__init__.py index b8e5ce8..23e35bf 100644 --- a/datalayer/__init__.py +++ b/datalayer_core/__init__.py @@ -1,7 +1,7 @@ from typing import Any, Dict, List -from datalayer._version import __version__ -from datalayer.serverapplication import DatalayerExtensionApp +from datalayer_core._version import __version__ +from datalayer_core.serverapplication import DatalayerExtensionApp try: from .lab import DatalayerLabApp @@ -12,11 +12,11 @@ def _jupyter_server_extension_points() -> List[Dict[str, Any]]: return [{ - "module": "datalayer", + "module": "datalayer_core", "app": DatalayerExtensionApp, }, { - "module": "datalayer", + "module": "datalayer_core", "app": DatalayerLabApp, }] diff --git a/datalayer/__main__.py b/datalayer_core/__main__.py similarity index 58% rename from datalayer/__main__.py rename to datalayer_core/__main__.py index df2ea16..654e427 100644 --- a/datalayer/__main__.py +++ b/datalayer_core/__main__.py @@ -1,6 +1,6 @@ """The main for Datalayer.""" -from datalayer.serverapplication import main +from datalayer_core.serverapplication import main if __name__ == "__main__": main() diff --git a/datalayer_core/_version.py b/datalayer_core/_version.py new file mode 100644 index 0000000..d35816b --- /dev/null +++ b/datalayer_core/_version.py @@ -0,0 +1,4 @@ +# This file is auto-generated by Hatchling. As such, do not: +# - modify +# - track in version control e.g. be sure to add to .gitignore +__version__ = VERSION = '1.1.2' diff --git a/datalayer/about/about.md b/datalayer_core/about/about.md similarity index 100% rename from datalayer/about/about.md rename to datalayer_core/about/about.md diff --git a/datalayer/about/aboutapp.py b/datalayer_core/about/aboutapp.py similarity index 87% rename from datalayer/about/aboutapp.py rename to datalayer_core/about/aboutapp.py index af36fcf..2f0ea5e 100644 --- a/datalayer/about/aboutapp.py +++ b/datalayer_core/about/aboutapp.py @@ -3,11 +3,11 @@ from pathlib import Path -from datalayer.application import NoStart +from datalayer_core.application import NoStart from rich.console import Console from rich.markdown import Markdown -from datalayer.cli.base import DatalayerCLIBaseApp +from datalayer_core.cli.base import DatalayerCLIBaseApp HERE = Path(__file__).parent diff --git a/datalayer/application.py b/datalayer_core/application.py similarity index 99% rename from datalayer/application.py rename to datalayer_core/application.py index bd5d328..da0bd47 100644 --- a/datalayer/application.py +++ b/datalayer_core/application.py @@ -66,7 +66,7 @@ class NoStart(Exception): # noqa class DatalayerApp(Application): """Base class for Datalayer applications""" - name = "datalayer" # override in subclasses + name = "datalayer_core" # override in subclasses description = "A Datalayer Application" aliases = base_aliases diff --git a/datalayer/authn/__init__.py b/datalayer_core/authn/__init__.py similarity index 100% rename from datalayer/authn/__init__.py rename to datalayer_core/authn/__init__.py diff --git a/datalayer/authn/__main__.py b/datalayer_core/authn/__main__.py similarity index 91% rename from datalayer/authn/__main__.py rename to datalayer_core/authn/__main__.py index 9925120..9175dc1 100644 --- a/datalayer/authn/__main__.py +++ b/datalayer_core/authn/__main__.py @@ -5,7 +5,7 @@ import logging -from datalayer.authn.http_server import get_token +from datalayer_core.authn.http_server import get_token logging.basicConfig(level=logging.INFO) diff --git a/datalayer/authn/apps/__init__.py b/datalayer_core/authn/apps/__init__.py similarity index 100% rename from datalayer/authn/apps/__init__.py rename to datalayer_core/authn/apps/__init__.py diff --git a/datalayer/authn/apps/loginapp.py b/datalayer_core/authn/apps/loginapp.py similarity index 93% rename from datalayer/authn/apps/loginapp.py rename to datalayer_core/authn/apps/loginapp.py index 74633a7..7c9065c 100644 --- a/datalayer/authn/apps/loginapp.py +++ b/datalayer_core/authn/apps/loginapp.py @@ -3,7 +3,7 @@ import warnings -from datalayer.cli.base import DatalayerCLIBaseApp +from datalayer_core.cli.base import DatalayerCLIBaseApp class DatalayerLoginApp(DatalayerCLIBaseApp): diff --git a/datalayer/authn/apps/logoutapp.py b/datalayer_core/authn/apps/logoutapp.py similarity index 93% rename from datalayer/authn/apps/logoutapp.py rename to datalayer_core/authn/apps/logoutapp.py index 56257c1..eedaeae 100644 --- a/datalayer/authn/apps/logoutapp.py +++ b/datalayer_core/authn/apps/logoutapp.py @@ -3,7 +3,7 @@ import warnings -from datalayer.cli.base import DatalayerCLIBaseApp +from datalayer_core.cli.base import DatalayerCLIBaseApp class DatalayerLogoutApp(DatalayerCLIBaseApp): diff --git a/datalayer/authn/apps/whoamiapp.py b/datalayer_core/authn/apps/whoamiapp.py similarity index 93% rename from datalayer/authn/apps/whoamiapp.py rename to datalayer_core/authn/apps/whoamiapp.py index 00dab33..544d721 100644 --- a/datalayer/authn/apps/whoamiapp.py +++ b/datalayer_core/authn/apps/whoamiapp.py @@ -3,7 +3,7 @@ import warnings -from datalayer.cli.base import DatalayerCLIBaseApp +from datalayer_core.cli.base import DatalayerCLIBaseApp from ...kernels.utils import display_me diff --git a/datalayer/authn/http_server.py b/datalayer_core/authn/http_server.py similarity index 95% rename from datalayer/authn/http_server.py rename to datalayer_core/authn/http_server.py index 78fef23..3a760fd 100644 --- a/datalayer/authn/http_server.py +++ b/datalayer_core/authn/http_server.py @@ -18,17 +18,17 @@ from pathlib import Path from socketserver import BaseRequestHandler -from datalayer.authn.state import set_server_port -from datalayer.authn.keys import ( +from datalayer_core.authn.state import set_server_port +from datalayer_core.authn.keys import ( DATALAYER_IAM_TOKEN_KEY, DATALAYER_IAM_USER_KEY ) -from datalayer.authn.pages import ( +from datalayer_core.authn.pages import ( LANDING_PAGE, AUTH_SUCCESS_PAGE, OAUTH_ERROR_PAGE ) -from datalayer.utils.utils import find_http_port -from datalayer.serverapplication import launch_new_instance -from datalayer._version import __version__ +from datalayer_core.utils.utils import find_http_port +from datalayer_core.serverapplication import launch_new_instance +from datalayer_core._version import __version__ HERE = Path(__file__).parent diff --git a/datalayer/authn/keys.py b/datalayer_core/authn/keys.py similarity index 100% rename from datalayer/authn/keys.py rename to datalayer_core/authn/keys.py diff --git a/datalayer/authn/pages.py b/datalayer_core/authn/pages.py similarity index 97% rename from datalayer/authn/pages.py rename to datalayer_core/authn/pages.py index 4f57540..ea7ede3 100644 --- a/datalayer/authn/pages.py +++ b/datalayer_core/authn/pages.py @@ -13,7 +13,7 @@ {config} - + diff --git a/datalayer/authn/state.py b/datalayer_core/authn/state.py similarity index 100% rename from datalayer/authn/state.py rename to datalayer_core/authn/state.py diff --git a/datalayer/cli/__init__.py b/datalayer_core/cli/__init__.py similarity index 100% rename from datalayer/cli/__init__.py rename to datalayer_core/cli/__init__.py diff --git a/datalayer/cli/base.py b/datalayer_core/cli/base.py similarity index 97% rename from datalayer/cli/base.py rename to datalayer_core/cli/base.py index 8739583..e61590e 100644 --- a/datalayer/cli/base.py +++ b/datalayer_core/cli/base.py @@ -15,13 +15,13 @@ from rich.console import Console -from datalayer.application import DatalayerApp, base_aliases, base_flags +from datalayer_core.application import DatalayerApp, base_aliases, base_flags from traitlets import Bool, Unicode -from datalayer.authn.http_server import get_token, USE_JUPYTER_SERVER -from datalayer.utils.utils import fetch, find_http_port +from datalayer_core.authn.http_server import get_token, USE_JUPYTER_SERVER +from datalayer_core.utils.utils import fetch, find_http_port -from datalayer._version import __version__ +from datalayer_core._version import __version__ REQUEST_TIMEOUT = 5 @@ -44,7 +44,7 @@ class DatalayerCLIBaseApp(DatalayerApp): - name = "datalayer" + name = "datalayer_core" version = __version__ diff --git a/datalayer/cli/datalayer.py b/datalayer_core/cli/datalayer.py similarity index 71% rename from datalayer/cli/datalayer.py rename to datalayer_core/cli/datalayer.py index 07d2a31..5282e49 100644 --- a/datalayer/cli/datalayer.py +++ b/datalayer_core/cli/datalayer.py @@ -3,17 +3,17 @@ from pathlib import Path -from datalayer.authn.apps.loginapp import DatalayerLoginApp -from datalayer.authn.apps.logoutapp import DatalayerLogoutApp -from datalayer.authn.apps.whoamiapp import KernelWhoamiApp +from datalayer_core.authn.apps.loginapp import DatalayerLoginApp +from datalayer_core.authn.apps.logoutapp import DatalayerLogoutApp +from datalayer_core.authn.apps.whoamiapp import KernelWhoamiApp -from datalayer.about.aboutapp import DatalayerAboutApp +from datalayer_core.about.aboutapp import DatalayerAboutApp -from datalayer.kernels.kernelsapp import JupyterKernelsApp +from datalayer_core.kernels.kernelsapp import JupyterKernelsApp -from datalayer.cli.base import DatalayerCLIBaseApp +from datalayer_core.cli.base import DatalayerCLIBaseApp -from datalayer._version import __version__ +from datalayer_core._version import __version__ HERE = Path(__file__).parent diff --git a/datalayer/command.py b/datalayer_core/command.py similarity index 98% rename from datalayer/command.py rename to datalayer_core/command.py index 2e14d71..77f71d1 100644 --- a/datalayer/command.py +++ b/datalayer_core/command.py @@ -161,7 +161,7 @@ def _path_with_self(): path_list = (os.environ.get("PATH") or os.defpath).split(os.pathsep) # Insert the "scripts" directory for this Python installation - # This allows the "datalayer" command to be relocated, while still + # This allows the "datalayer_core" command to be relocated, while still # finding subcommands that have been installed in the default # location. # We put the scripts directory at the *end* of PATH, so that @@ -239,7 +239,7 @@ def main() -> None: # noqa if args.version: print("Selected Datalayer core packages...") for package in [ - "datalayer", + "datalayer_core", "IPython", "ipykernel", "ipywidgets", @@ -255,7 +255,7 @@ def main() -> None: # noqa "traitlets", ]: try: - if package == "datalayer": # We're already here + if package == "datalayer_core": # We're already here version = __version__ else: mod = __import__(package) diff --git a/datalayer/config.py b/datalayer_core/config.py similarity index 86% rename from datalayer/config.py rename to datalayer_core/config.py index e8fc9a0..a7ba5f1 100644 --- a/datalayer/config.py +++ b/datalayer_core/config.py @@ -18,7 +18,7 @@ class DatalayerConfig(DatalayerApp): def start(self): """Start the application.""" - with open(Path.home() / ".datalayer/datalayer.conf", "rb") as toml: + with open(Path.home() / ".datalayer/datalayer_core.conf", "rb") as toml: config = tomllib.load(toml) self.log.info(config) self.log.info(config["title"]) diff --git a/datalayer/handlers/__init__.py b/datalayer_core/handlers/__init__.py similarity index 100% rename from datalayer/handlers/__init__.py rename to datalayer_core/handlers/__init__.py diff --git a/datalayer/handlers/base.py b/datalayer_core/handlers/base.py similarity index 100% rename from datalayer/handlers/base.py rename to datalayer_core/handlers/base.py diff --git a/datalayer/handlers/config/__init__.py b/datalayer_core/handlers/config/__init__.py similarity index 100% rename from datalayer/handlers/config/__init__.py rename to datalayer_core/handlers/config/__init__.py diff --git a/datalayer/handlers/config/handler.py b/datalayer_core/handlers/config/handler.py similarity index 91% rename from datalayer/handlers/config/handler.py rename to datalayer_core/handlers/config/handler.py index 5cf785b..b00597d 100644 --- a/datalayer/handlers/config/handler.py +++ b/datalayer_core/handlers/config/handler.py @@ -9,7 +9,7 @@ ExtensionHandlerMixin, ) -from datalayer._version import __version__ +from datalayer_core._version import __version__ @@ -22,7 +22,7 @@ def get(self): settings = self.settings["datalayer_config"] res = json.dumps( { - "extension": "datalayer", + "extension": "datalayer_core", "version": __version__, "settings": dict( run_url=settings.run_url, diff --git a/datalayer/handlers/index/__init__.py b/datalayer_core/handlers/index/__init__.py similarity index 100% rename from datalayer/handlers/index/__init__.py rename to datalayer_core/handlers/index/__init__.py diff --git a/datalayer/handlers/index/handler.py b/datalayer_core/handlers/index/handler.py similarity index 86% rename from datalayer/handlers/index/handler.py rename to datalayer_core/handlers/index/handler.py index 0c41f3f..0e94223 100644 --- a/datalayer/handlers/index/handler.py +++ b/datalayer_core/handlers/index/handler.py @@ -5,7 +5,7 @@ import tornado -from datalayer.handlers.base import BaseTemplateHandler +from datalayer_core.handlers.base import BaseTemplateHandler # pylint: disable=W0223 diff --git a/datalayer/handlers/login/__init__.py b/datalayer_core/handlers/login/__init__.py similarity index 100% rename from datalayer/handlers/login/__init__.py rename to datalayer_core/handlers/login/__init__.py diff --git a/datalayer/handlers/login/handler.py b/datalayer_core/handlers/login/handler.py similarity index 92% rename from datalayer/handlers/login/handler.py rename to datalayer_core/handlers/login/handler.py index db00b6b..3e8d93a 100644 --- a/datalayer/handlers/login/handler.py +++ b/datalayer_core/handlers/login/handler.py @@ -9,7 +9,7 @@ from jupyter_server.base.handlers import APIHandler from jupyter_server.extension.handler import ExtensionHandlerMixin -from datalayer._version import __version__ +from datalayer_core._version import __version__ # pylint: disable=W0223 diff --git a/datalayer/kernels/__init__.py b/datalayer_core/kernels/__init__.py similarity index 100% rename from datalayer/kernels/__init__.py rename to datalayer_core/kernels/__init__.py diff --git a/datalayer/kernels/client.py b/datalayer_core/kernels/client.py similarity index 100% rename from datalayer/kernels/client.py rename to datalayer_core/kernels/client.py diff --git a/datalayer/kernels/console/__init__.py b/datalayer_core/kernels/console/__init__.py similarity index 100% rename from datalayer/kernels/console/__init__.py rename to datalayer_core/kernels/console/__init__.py diff --git a/datalayer/kernels/console/consoleapp.py b/datalayer_core/kernels/console/consoleapp.py similarity index 99% rename from datalayer/kernels/console/consoleapp.py rename to datalayer_core/kernels/console/consoleapp.py index 5bc5125..43b6e0e 100644 --- a/datalayer/kernels/console/consoleapp.py +++ b/datalayer_core/kernels/console/consoleapp.py @@ -9,7 +9,7 @@ from ..._version import __version__ -from datalayer.cli.base import ( +from datalayer_core.cli.base import ( DatalayerCLIBaseApp, datalayer_aliases, datalayer_flags, diff --git a/datalayer/kernels/console/shell.py b/datalayer_core/kernels/console/shell.py similarity index 91% rename from datalayer/kernels/console/shell.py rename to datalayer_core/kernels/console/shell.py index 8770c4d..5778d35 100644 --- a/datalayer/kernels/console/shell.py +++ b/datalayer_core/kernels/console/shell.py @@ -14,10 +14,10 @@ class WSTerminalInteractiveShell(ZMQTerminalInteractiveShell): manager = Instance( - "datalayer.kernels.manager.KernelManager", allow_none=True + "datalayer_core.kernels.manager.KernelManager", allow_none=True ) client = Instance( - "datalayer.kernels.client.KernelClient", allow_none=True + "datalayer_core.kernels.client.KernelClient", allow_none=True ) @default("banner") diff --git a/datalayer/kernels/create/createapp.py b/datalayer_core/kernels/create/createapp.py similarity index 97% rename from datalayer/kernels/create/createapp.py rename to datalayer_core/kernels/create/createapp.py index 22c8f21..d49c4a9 100644 --- a/datalayer/kernels/create/createapp.py +++ b/datalayer_core/kernels/create/createapp.py @@ -6,7 +6,7 @@ from rich import print_json from traitlets import Dict, Float, Unicode -from datalayer.cli.base import DatalayerCLIBaseApp, datalayer_aliases +from datalayer_core.cli.base import DatalayerCLIBaseApp, datalayer_aliases from ..utils import display_kernels diff --git a/datalayer/kernels/envs/envssapp.py b/datalayer_core/kernels/envs/envssapp.py similarity index 97% rename from datalayer/kernels/envs/envssapp.py rename to datalayer_core/kernels/envs/envssapp.py index b474811..7a03d8b 100644 --- a/datalayer/kernels/envs/envssapp.py +++ b/datalayer_core/kernels/envs/envssapp.py @@ -7,7 +7,7 @@ from rich.console import Console from rich.table import Table -from datalayer.cli.base import DatalayerCLIBaseApp +from datalayer_core.cli.base import DatalayerCLIBaseApp def new_kernel_table(): diff --git a/datalayer/kernels/exec/execapp.py b/datalayer_core/kernels/exec/execapp.py similarity index 99% rename from datalayer/kernels/exec/execapp.py rename to datalayer_core/kernels/exec/execapp.py index f74cf0e..f8ebe29 100644 --- a/datalayer/kernels/exec/execapp.py +++ b/datalayer_core/kernels/exec/execapp.py @@ -12,7 +12,7 @@ from ..._version import __version__ -from datalayer.cli.base import ( +from datalayer_core.cli.base import ( DatalayerCLIBaseApp, datalayer_aliases, datalayer_flags, diff --git a/datalayer/kernels/kernelsapp.py b/datalayer_core/kernels/kernelsapp.py similarity index 59% rename from datalayer/kernels/kernelsapp.py rename to datalayer_core/kernels/kernelsapp.py index f5e5ffd..9447c64 100644 --- a/datalayer/kernels/kernelsapp.py +++ b/datalayer_core/kernels/kernelsapp.py @@ -3,22 +3,22 @@ from pathlib import Path -from datalayer.authn.apps.loginapp import DatalayerLoginApp -from datalayer.authn.apps.logoutapp import DatalayerLogoutApp - -from datalayer.kernels.console.consoleapp import KernelConsoleApp -from datalayer.kernels.create.createapp import KernelCreateApp -from datalayer.kernels.exec.execapp import KernelExecApp -from datalayer.kernels.list.listapp import KernelListApp -from datalayer.kernels.pause.pauseapp import KernelPauseApp -from datalayer.kernels.envs.envssapp import KernelEnvironmentsApp -from datalayer.kernels.start.startapp import KernelStartApp -from datalayer.kernels.stop.stopapp import KernelStopApp -from datalayer.kernels.terminate.terminateapp import KernelTerminateApp - -from datalayer.cli.base import DatalayerCLIBaseApp - -from datalayer._version import __version__ +from datalayer_core.authn.apps.loginapp import DatalayerLoginApp +from datalayer_core.authn.apps.logoutapp import DatalayerLogoutApp + +from datalayer_core.kernels.console.consoleapp import KernelConsoleApp +from datalayer_core.kernels.create.createapp import KernelCreateApp +from datalayer_core.kernels.exec.execapp import KernelExecApp +from datalayer_core.kernels.list.listapp import KernelListApp +from datalayer_core.kernels.pause.pauseapp import KernelPauseApp +from datalayer_core.kernels.envs.envssapp import KernelEnvironmentsApp +from datalayer_core.kernels.start.startapp import KernelStartApp +from datalayer_core.kernels.stop.stopapp import KernelStopApp +from datalayer_core.kernels.terminate.terminateapp import KernelTerminateApp + +from datalayer_core.cli.base import DatalayerCLIBaseApp + +from datalayer_core._version import __version__ class JupyterKernelsApp(DatalayerCLIBaseApp): diff --git a/datalayer/kernels/list/listapp.py b/datalayer_core/kernels/list/listapp.py similarity index 93% rename from datalayer/kernels/list/listapp.py rename to datalayer_core/kernels/list/listapp.py index afa0ba3..606062f 100644 --- a/datalayer/kernels/list/listapp.py +++ b/datalayer_core/kernels/list/listapp.py @@ -3,7 +3,7 @@ import warnings -from datalayer.cli.base import DatalayerCLIBaseApp +from datalayer_core.cli.base import DatalayerCLIBaseApp from ..utils import display_kernels diff --git a/datalayer/kernels/manager.py b/datalayer_core/kernels/manager.py similarity index 96% rename from datalayer/kernels/manager.py rename to datalayer_core/kernels/manager.py index 4bfd3b9..f8aaeeb 100644 --- a/datalayer/kernels/manager.py +++ b/datalayer_core/kernels/manager.py @@ -13,8 +13,8 @@ from traitlets import DottedObjectName, Type from traitlets.config import LoggingConfigurable -from datalayer.kernels.utils import timestamp_to_local_date -from datalayer.utils.utils import fetch +from datalayer_core.kernels.utils import timestamp_to_local_date +from datalayer_core.utils.utils import fetch HTTP_PROTOCOL_REGEXP = re.compile(r"^http") @@ -42,8 +42,8 @@ def has_kernel(self): """Has a kernel been started that we are managing.""" return self.kernel is not None - client_class = DottedObjectName("datalayer.kernels.client.KernelClient") - client_factory = Type(klass="datalayer.kernels.client.KernelClient") + client_class = DottedObjectName("datalayer_core.kernels.client.KernelClient") + client_factory = Type(klass="datalayer_core.kernels.client.KernelClient") # -------------------------------------------------------------------------- # create a Client connected to our Kernel diff --git a/datalayer/kernels/pause/pauseapp.py b/datalayer_core/kernels/pause/pauseapp.py similarity index 81% rename from datalayer/kernels/pause/pauseapp.py rename to datalayer_core/kernels/pause/pauseapp.py index 46d4eb8..b476003 100644 --- a/datalayer/kernels/pause/pauseapp.py +++ b/datalayer_core/kernels/pause/pauseapp.py @@ -1,9 +1,9 @@ # Copyright (c) Datalayer Development Team. # Distributed under the terms of the Modified BSD License. -from datalayer.application import NoStart +from datalayer_core.application import NoStart -from datalayer.cli.base import DatalayerCLIBaseApp +from datalayer_core.cli.base import DatalayerCLIBaseApp class KernelPauseApp(DatalayerCLIBaseApp): diff --git a/datalayer/kernels/start/startapp.py b/datalayer_core/kernels/start/startapp.py similarity index 81% rename from datalayer/kernels/start/startapp.py rename to datalayer_core/kernels/start/startapp.py index dc94ae0..8af696a 100644 --- a/datalayer/kernels/start/startapp.py +++ b/datalayer_core/kernels/start/startapp.py @@ -1,9 +1,9 @@ # Copyright (c) Datalayer Development Team. # Distributed under the terms of the Modified BSD License. -from datalayer.application import NoStart +from datalayer_core.application import NoStart -from datalayer.cli.base import DatalayerCLIBaseApp +from datalayer_core.cli.base import DatalayerCLIBaseApp class KernelStartApp(DatalayerCLIBaseApp): diff --git a/datalayer/kernels/stop/stopapp.py b/datalayer_core/kernels/stop/stopapp.py similarity index 81% rename from datalayer/kernels/stop/stopapp.py rename to datalayer_core/kernels/stop/stopapp.py index fcce836..6ce2862 100644 --- a/datalayer/kernels/stop/stopapp.py +++ b/datalayer_core/kernels/stop/stopapp.py @@ -1,9 +1,9 @@ # Copyright (c) Datalayer Development Team. # Distributed under the terms of the Modified BSD License. -from datalayer.application import NoStart +from datalayer_core.application import NoStart -from datalayer.cli.base import DatalayerCLIBaseApp +from datalayer_core.cli.base import DatalayerCLIBaseApp class KernelStopApp(DatalayerCLIBaseApp): diff --git a/datalayer/kernels/terminate/terminateapp.py b/datalayer_core/kernels/terminate/terminateapp.py similarity index 93% rename from datalayer/kernels/terminate/terminateapp.py rename to datalayer_core/kernels/terminate/terminateapp.py index 204099e..6ef5d36 100644 --- a/datalayer/kernels/terminate/terminateapp.py +++ b/datalayer_core/kernels/terminate/terminateapp.py @@ -3,7 +3,7 @@ import warnings -from datalayer.cli.base import DatalayerCLIBaseApp +from datalayer_core.cli.base import DatalayerCLIBaseApp class KernelTerminateApp(DatalayerCLIBaseApp): diff --git a/datalayer/kernels/utils.py b/datalayer_core/kernels/utils.py similarity index 100% rename from datalayer/kernels/utils.py rename to datalayer_core/kernels/utils.py diff --git a/datalayer/lab.py b/datalayer_core/lab.py similarity index 97% rename from datalayer/lab.py rename to datalayer_core/lab.py index dadff63..d7f93cf 100644 --- a/datalayer/lab.py +++ b/datalayer_core/lab.py @@ -13,7 +13,7 @@ class DatalayerLabApp(LabApp): """ flags = flags - flags["datalayer"] = ( + flags["datalayer_core"] = ( {"IdentityProvider": {"token": "test"}}, "The server token.", ) diff --git a/datalayer/migrate.py b/datalayer_core/migrate.py similarity index 100% rename from datalayer/migrate.py rename to datalayer_core/migrate.py diff --git a/datalayer/paths.py b/datalayer_core/paths.py similarity index 99% rename from datalayer/paths.py rename to datalayer_core/paths.py index 40b90c4..0ae4e31 100644 --- a/datalayer/paths.py +++ b/datalayer_core/paths.py @@ -26,7 +26,7 @@ pjoin = os.path.join # Capitalize Datalayer in paths only on Windows and MacOS -APPNAME = "Datalayer" if sys.platform in ("win32", "darwin") else "datalayer" +APPNAME = "Datalayer" if sys.platform in ("win32", "darwin") else "datalayer_core" # UF_HIDDEN is a stat flag not defined in the stat module. # It is used by BSD to indicate hidden files. @@ -173,7 +173,7 @@ def datalayer_data_dir() -> str: elif os.name == "nt": appdata = os.environ.get("APPDATA", None) if appdata: - return str(Path(appdata, "datalayer").resolve()) + return str(Path(appdata, "datalayer_core").resolve()) else: return pjoin(datalayer_config_dir(), "data") else: @@ -181,7 +181,7 @@ def datalayer_data_dir() -> str: xdg = env.get("XDG_DATA_HOME", None) if not xdg: xdg = pjoin(home, ".local", "share") - return pjoin(xdg, "datalayer") + return pjoin(xdg, "datalayer_core") def datalayer_runtime_dir() -> str: @@ -215,16 +215,16 @@ def datalayer_runtime_dir() -> str: if os.name == "nt": programdata = os.environ.get("PROGRAMDATA", None) if programdata: - SYSTEM_DATALAYER_PATH = [pjoin(programdata, "datalayer")] + SYSTEM_DATALAYER_PATH = [pjoin(programdata, "datalayer_core")] else: # PROGRAMDATA is not defined by default on XP. - SYSTEM_DATALAYER_PATH = [os.path.join(sys.prefix, "share", "datalayer")] + SYSTEM_DATALAYER_PATH = [os.path.join(sys.prefix, "share", "datalayer_core")] else: SYSTEM_DATALAYER_PATH = [ "/usr/local/share/datalayer", "/usr/share/datalayer", ] -ENV_DATALAYER_PATH: List[str] = [os.path.join(sys.prefix, "share", "datalayer")] +ENV_DATALAYER_PATH: List[str] = [os.path.join(sys.prefix, "share", "datalayer_core")] def datalayer_path(*subdirs: str) -> List[str]: @@ -264,7 +264,7 @@ def datalayer_path(*subdirs: str) -> List[str]: userbase = site.getuserbase() if hasattr(site, "getuserbase") else site.USER_BASE if userbase: - userdir = os.path.join(userbase, "share", "datalayer") + userdir = os.path.join(userbase, "share", "datalayer_core") if userdir not in user: user.append(userdir) @@ -294,7 +294,7 @@ def datalayer_path(*subdirs: str) -> List[str]: if os.name == "nt": # noqa programdata = os.environ.get("PROGRAMDATA", None) if programdata: # noqa - SYSTEM_CONFIG_PATH = [os.path.join(programdata, "datalayer")] + SYSTEM_CONFIG_PATH = [os.path.join(programdata, "datalayer_core")] else: # PROGRAMDATA is not defined by default on XP. SYSTEM_CONFIG_PATH = [] else: @@ -302,7 +302,7 @@ def datalayer_path(*subdirs: str) -> List[str]: "/usr/local/etc/datalayer", "/etc/datalayer", ] -ENV_CONFIG_PATH: List[str] = [os.path.join(sys.prefix, "etc", "datalayer")] +ENV_CONFIG_PATH: List[str] = [os.path.join(sys.prefix, "etc", "datalayer_core")] def datalayer_config_path() -> List[str]: @@ -334,7 +334,7 @@ def datalayer_config_path() -> List[str]: userbase = site.getuserbase() if hasattr(site, "getuserbase") else site.USER_BASE if userbase: - userdir = os.path.join(userbase, "etc", "datalayer") + userdir = os.path.join(userbase, "etc", "datalayer_core") if userdir not in user: user.append(userdir) diff --git a/datalayer/serverapplication.py b/datalayer_core/serverapplication.py similarity index 83% rename from datalayer/serverapplication.py rename to datalayer_core/serverapplication.py index 42021a0..12715e0 100644 --- a/datalayer/serverapplication.py +++ b/datalayer_core/serverapplication.py @@ -1,4 +1,4 @@ -"""The Datalayer Server application.""" +"""The Datalayer Core Server application.""" import os import typing as t @@ -9,13 +9,13 @@ from jupyter_server.utils import url_path_join from jupyter_server.extension.application import ExtensionApp, ExtensionAppJinjaMixin -from datalayer.handlers.index.handler import IndexHandler -from datalayer.handlers.config.handler import ConfigHandler -from datalayer.handlers.login.handler import LoginHandler +from datalayer_core.handlers.index.handler import IndexHandler +from datalayer_core.handlers.config.handler import ConfigHandler +from datalayer_core.handlers.login.handler import LoginHandler -from datalayer.authn.state import get_server_port +from datalayer_core.authn.state import get_server_port -from datalayer._version import __version__ +from datalayer_core._version import __version__ DEFAULT_STATIC_FILES_PATH = os.path.join(os.path.dirname(__file__), "./static") @@ -24,9 +24,9 @@ class DatalayerExtensionApp(ExtensionAppJinjaMixin, ExtensionApp): - """The Datalayer Server extension.""" + """The Datalayer Core Server extension.""" - name = "datalayer" + name = "datalayer_core" extension_url = "/datalayer" @@ -106,9 +106,9 @@ def initialize_templates(self): def initialize_handlers(self): handlers = [ - ("datalayer", IndexHandler), - (url_path_join("datalayer", "config"), ConfigHandler), - (url_path_join("datalayer", "login"), LoginHandler), + ("datalayer_core", IndexHandler), + (url_path_join("datalayer_core", "config"), ConfigHandler), + (url_path_join("datalayer_core", "login"), LoginHandler), ] self.handlers.extend(handlers) diff --git a/datalayer_core/static/README.md b/datalayer_core/static/README.md new file mode 100644 index 0000000..b071dcf --- /dev/null +++ b/datalayer_core/static/README.md @@ -0,0 +1 @@ +[![Datalayer](https://assets.datalayer_core.tech/datalayer-25.svg)](https://datalayer_core.io) diff --git a/datalayer/templates/index.html b/datalayer_core/templates/index.html similarity index 98% rename from datalayer/templates/index.html rename to datalayer_core/templates/index.html index 846ab9b..0cb25f4 100644 --- a/datalayer/templates/index.html +++ b/datalayer_core/templates/index.html @@ -26,7 +26,7 @@ } - +
diff --git a/datalayer_core/tests/__init__.py b/datalayer_core/tests/__init__.py new file mode 100644 index 0000000..58d643c --- /dev/null +++ b/datalayer_core/tests/__init__.py @@ -0,0 +1 @@ +"""Python unit tests for datalayer_core.""" diff --git a/datalayer/tests/test_handlers.py b/datalayer_core/tests/test_handlers.py similarity index 71% rename from datalayer/tests/test_handlers.py rename to datalayer_core/tests/test_handlers.py index a2a1b34..50a5c00 100644 --- a/datalayer/tests/test_handlers.py +++ b/datalayer_core/tests/test_handlers.py @@ -5,12 +5,12 @@ async def test_config(jp_fetch): # When - response = await jp_fetch("datalayer", "config") + response = await jp_fetch("datalayer_core", "config") # Then assert response.code == 200 payload = json.loads(response.body) assert payload == { - "extension": "datalayer", + "extension": "datalayer_core", "version": __version__, } diff --git a/datalayer/troubleshoot.py b/datalayer_core/troubleshoot.py similarity index 96% rename from datalayer/troubleshoot.py rename to datalayer_core/troubleshoot.py index f88103d..28dc67f 100755 --- a/datalayer/troubleshoot.py +++ b/datalayer_core/troubleshoot.py @@ -34,10 +34,10 @@ def get_data() -> Dict[str, Any]: env["platform"] = platform.platform() # FIXME: which on Windows? if sys.platform == "win32": - env["where"] = subs(["where", "datalayer"]) + env["where"] = subs(["where", "datalayer_core"]) env["which"] = None else: - env["which"] = subs(["which", "-a", "datalayer"]) + env["which"] = subs(["which", "-a", "datalayer_core"]) env["where"] = None env["pip"] = subs([sys.executable, "-m", "pip", "list"]) env["conda"] = subs(["conda", "list"]) diff --git a/datalayer/utils/__init__.py b/datalayer_core/utils/__init__.py similarity index 100% rename from datalayer/utils/__init__.py rename to datalayer_core/utils/__init__.py diff --git a/datalayer/utils/utils.py b/datalayer_core/utils/utils.py similarity index 100% rename from datalayer/utils/utils.py rename to datalayer_core/utils/utils.py diff --git a/hatch_build.py b/hatch_build.py index fc4cac9..1face78 100644 --- a/hatch_build.py +++ b/hatch_build.py @@ -23,7 +23,7 @@ def build_javascript(): for file in glob.glob(r'./dist/*.js'): shutil.copy( file, - './datalayer/static/' + './datalayer_core/static/' ) diff --git a/install.json b/install.json index 1ba517b..b42d1d4 100644 --- a/install.json +++ b/install.json @@ -1,5 +1,5 @@ { "packageManager": "python", - "packageName": "datalayer", + "packageName": "datalayer_core", "uninstallInstructions": "Use your Python package manager (pip, conda, etc.) to uninstall the package datalayer" } diff --git a/jupyter-config/nb-config/datalayer.json b/jupyter-config/nb-config/datalayer_core.json similarity index 68% rename from jupyter-config/nb-config/datalayer.json rename to jupyter-config/nb-config/datalayer_core.json index 0972a53..b664e95 100644 --- a/jupyter-config/nb-config/datalayer.json +++ b/jupyter-config/nb-config/datalayer_core.json @@ -1,7 +1,7 @@ { "NotebookApp": { "nbserver_extensions": { - "datalayer": true + "datalayer_core": true } } } diff --git a/jupyter-config/server-config/datalayer.json b/jupyter-config/server-config/datalayer_core.json similarity index 67% rename from jupyter-config/server-config/datalayer.json rename to jupyter-config/server-config/datalayer_core.json index 52bcc28..614aba3 100644 --- a/jupyter-config/server-config/datalayer.json +++ b/jupyter-config/server-config/datalayer_core.json @@ -1,7 +1,7 @@ { "ServerApp": { "jpserver_extensions": { - "datalayer": true + "datalayer_core": true } } } diff --git a/package.json b/package.json index 5b26c06..00ca8bf 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "build:webpack": "webpack-cli build", "clean": "jlpm clean:lib", "clean:all": "jlpm clean:lib && jlpm clean:labextension && jlpm clean:lintcache", - "clean:labextension": "rimraf datalayer/labextension", + "clean:labextension": "rimraf datalayer_core/labextension", "clean:lib": "rimraf lib tsconfig.tsbuildinfo", "clean:lintcache": "rimraf .eslintcache .stylelintcache", "eslint": "jlpm eslint:check --fix", @@ -222,12 +222,12 @@ "pip" ], "base": { - "name": "datalayer" + "name": "datalayer_core" } } }, "extension": "./lib/jupyterlab/index.js", - "outputDir": "datalayer/labextension", + "outputDir": "datalayer_core/labextension", "schemaDir": "schema", "webpackConfig": "./webpack.lab-config.js", "sharedPackages": { diff --git a/pyproject.toml b/pyproject.toml index 9e941c5..908f221 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ requires = ["hatchling==1.21.1", "jupyterlab==4.0.9", "hatch-nodejs-version"] build-backend = "hatchling.build" [project] -name = "datalayer" +name = "datalayer_core" readme = "README.md" license = { file = "LICENSE" } requires-python = ">=3.9" @@ -24,8 +24,7 @@ classifiers = [ "Programming Language :: Python :: 3.11", ] dependencies = [ - "jupyter_iam>=1.2.0", - "jupyter_kernels>=1.2.7", + "jupyterlab", "jupyter_server>=2,<3", "rich", ] @@ -40,27 +39,25 @@ test = [ "pytest_jupyter", "pytest-tornasync", ] -run = [ -] [project.scripts] -# dla = "datalayer.command:main" -# datalayer = "datalayer.command:main" -dla = "datalayer.cli.datalayer:main" -datalayer = "datalayer.cli.datalayer:main" -datalayer-config = "datalayer.config:main" -datalayer-lab = "datalayer.lab:main" -datalayer-migrate = "datalayer.migrate:main" -datalayer-server = "datalayer.serverapplication:main" -datalayer-troubleshoot = "datalayer.troubleshoot:main" +# dla = "datalayer_core.command:main" +# datalayer = "datalayer_core.command:main" +dla = "datalayer_core.cli.datalayer:main" +datalayer = "datalayer_core.cli.datalayer:main" +datalayer-config = "datalayer_core.config:main" +datalayer-lab = "datalayer_core.lab:main" +datalayer-migrate = "datalayer_core.migrate:main" +datalayer-server = "datalayer_core.serverapplication:main" +datalayer-troubleshoot = "datalayer_core.troubleshoot:main" [tool.hatch.version] source = "nodejs" [tool.hatch.build] artifacts = [ - "datalayer/static", - "datalayer/templates" + "datalayer_core/static", + "datalayer_core/templates" ] [tool.hatch.build.hooks.custom] @@ -70,36 +67,36 @@ fields = ["description", "authors", "urls"] [tool.hatch.build.targets.sdist] artifacts = [ - "datalayer/static", - "datalayer/labextension", - "datalayer/about/about.md", + "datalayer_core/static", + "datalayer_core/labextension", + "datalayer_core/about/about.md", ] exclude = [".github", "binder", ".yarn"] [tool.hatch.build.targets.wheel] artifacts = [ - "datalayer/static", - "datalayer/labextension", - "datalayer/about/about.md", + "datalayer_core/static", + "datalayer_core/labextension", + "datalayer_core/about/about.md", ] [tool.hatch.build.targets.wheel.shared-data] -"datalayer/labextension" = "share/jupyter/labextensions/@datalayer/core" -"install.json" = "share/jupyter/labextensions/@datalayer/core/install.json" +"datalayer_core/labextension" = "share/jupyter/labextensions/@datalayer_core/core" +"install.json" = "share/jupyter/labextensions/@datalayer_core/core/install.json" "jupyter-config/server-config" = "etc/jupyter/jupyter_server_config.d" "jupyter-config/nb-config" = "etc/jupyter/jupyter_notebook_config.d" [tool.hatch.build.hooks.version] -path = "datalayer/_version.py" +path = "datalayer_core/_version.py" [tool.hatch.build.hooks.jupyter-builder] dependencies = ["hatch-jupyter-builder>=0.5"] build-function = "hatch_jupyter_builder.npm_builder" ensured-targets = [ - "datalayer/labextension/static/style.js", - "datalayer/labextension/package.json", + "datalayer_core/labextension/static/style.js", + "datalayer_core/labextension/package.json", ] -skip-if-exists = ["datalayer/labextension/static/style.js"] +skip-if-exists = ["datalayer_core/labextension/static/style.js"] [tool.hatch.build.hooks.jupyter-builder.build-kwargs] build_cmd = "build:prod" @@ -109,7 +106,7 @@ npm = ["jlpm"] build_cmd = "install:extension" npm = ["jlpm"] source_dir = "src" -build_dir = "datalayer/labextension" +build_dir = "datalayer_core/labextension" [tool.jupyter-releaser.options] version_cmd = "hatch version" diff --git a/webpack.config.js b/webpack.config.js index cb308c4..ada72c9 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -22,7 +22,7 @@ const mode = IS_PRODUCTION ? 'production' : 'development'; const devtool = IS_PRODUCTION ? false : 'inline-cheap-source-map'; const minimize = IS_PRODUCTION ? true : false; const publicPath = IS_PRODUCTION - ? '/static/datalayer/' + ? '/static/datalayer_core/' : 'http://localhost:3063/'; const commonOptions = { @@ -151,7 +151,7 @@ module.exports = [ output: { publicPath, // filename: '[name].[contenthash].datalayer.js', - filename: '[name].datalayer.js' + filename: '[name].datalayer-core.js' }, plugins: [ !IS_PRODUCTION @@ -183,7 +183,7 @@ module.exports = [ ...commonOptions, entry: './src/LoginCLIApp', output: { - path: path.resolve(__dirname, 'datalayer', 'login', 'static'), + path: path.resolve(__dirname, 'datalayer_core', 'login', 'static'), filename: 'login-cli.js', }, plugins: [