From 8155376b0c6741f332d92442790b9bfe1345cec6 Mon Sep 17 00:00:00 2001 From: Alex Hadley Date: Tue, 16 Apr 2024 15:26:19 -0700 Subject: [PATCH] Rename from jupyterlab-datalogger to jupyterlab-datalogs --- .github/workflows/github-pages.yml | 4 +- CHANGELOG.md | 23 ++++++---- README.md | 25 ++++++----- install.json | 4 +- .../__init__.py | 4 +- package.json | 8 ++-- pyproject.toml | 14 +++--- ...in.json => datalogs-load-code-plugin.json} | 10 ++--- src/constants.ts | 2 +- src/index.ts | 4 +- ...odePlugin.ts => datalogsLoadCodePlugin.ts} | 44 +++++++++---------- src/plugins/index.ts | 2 +- yarn.lock | 4 +- 13 files changed, 77 insertions(+), 71 deletions(-) rename {jupyterlab_datalogger => jupyterlab_datalogs}/__init__.py (80%) rename schema/{datalogger-load-code-plugin.json => datalogs-load-code-plugin.json} (70%) rename src/plugins/{dataloggerLoadCodePlugin.ts => datalogsLoadCodePlugin.ts} (72%) diff --git a/.github/workflows/github-pages.yml b/.github/workflows/github-pages.yml index 9f0f83c..8f07067 100644 --- a/.github/workflows/github-pages.yml +++ b/.github/workflows/github-pages.yml @@ -5,8 +5,8 @@ on: workflow_dispatch env: HATCH_VERSION: "1.9.1" PACKAGE_VERSION: "0.4.1" - PACKAGE_NAME: "jupyterlab-datalogger" - PYTHON_PACKAGE_NAME: "jupyterlab_datalogger" + PACKAGE_NAME: "jupyterlab-datalogs" + PYTHON_PACKAGE_NAME: "jupyterlab_datalogs" jobs: build: diff --git a/CHANGELOG.md b/CHANGELOG.md index af088ba..23dd0e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Changed + +- Renamed package from `jupyterlab-datalogger` to `jupyterlab-datalogs` to be consistent + with the renamed DataLogs package. + ## [0.4.1] (Jan 19 2024) ### Fixed @@ -53,12 +58,12 @@ project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ### Added - JupyterLab plugin to add NetCDF mimetype and file icon. -- JupyterLab plugin that adds shortcuts to generate code that loads logs with DataLogger. - -[unreleased]: https://github.com/PainterQubits/jupyterlab-datalogger/compare/v0.4.1...main -[0.4.1]: https://github.com/PainterQubits/jupyterlab-datalogger/releases/tag/v0.4.1 -[0.4.0]: https://github.com/PainterQubits/jupyterlab-datalogger/releases/tag/v0.4.0 -[0.3.1]: https://github.com/PainterQubits/jupyterlab-datalogger/releases/tag/v0.3.1 -[0.3.0]: https://github.com/PainterQubits/jupyterlab-datalogger/releases/tag/v0.3.0 -[0.2.0]: https://github.com/PainterQubits/jupyterlab-datalogger/releases/tag/v0.2.0 -[0.1.0]: https://github.com/PainterQubits/jupyterlab-datalogger/releases/tag/v0.1.0 +- JupyterLab plugin that adds shortcuts to generate code that loads logs with DataLogs. + +[unreleased]: https://github.com/PainterQubits/jupyterlab-datalogs/compare/v0.4.1...main +[0.4.1]: https://github.com/PainterQubits/jupyterlab-datalogs/releases/tag/v0.4.1 +[0.4.0]: https://github.com/PainterQubits/jupyterlab-datalogs/releases/tag/v0.4.0 +[0.3.1]: https://github.com/PainterQubits/jupyterlab-datalogs/releases/tag/v0.3.1 +[0.3.0]: https://github.com/PainterQubits/jupyterlab-datalogs/releases/tag/v0.3.0 +[0.2.0]: https://github.com/PainterQubits/jupyterlab-datalogs/releases/tag/v0.2.0 +[0.1.0]: https://github.com/PainterQubits/jupyterlab-datalogs/releases/tag/v0.1.0 diff --git a/README.md b/README.md index ba7d1ee..e6371d4 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,25 @@ -# DataLogger JupyterLab +# DataLogs JupyterLab -JupyterLab extension for DataLogger. +JupyterLab extension for DataLogs. ## Installation -Install the latest version of DataLogger JupyterLab using pip: +Install the latest version of JupyterLab DataLogs using pip: ``` -pip install -U jupyterlab-datalogger --extra-index-url https://painterqubits.github.io/jupyterlab-datalogger/releases +pip install -U jupyterlab-datalogs --extra-index-url https://painterqubits.github.io/jupyterlab-datalogs/releases ``` This extension should run alongside [JupyterLab](https://jupyterlab.readthedocs.io/en/stable/getting_started/installation.html) version 4 (included with the `jupyterlab` extra). There are also a set of packages -required for analysis using DataLogger notebooks (included with the `analysis` extra), and +required for analysis using DataLogs notebooks (included with the `analysis` extra), and a set of recommended JupyterLab plugins (included with the `plugins` extra). To automatically install with all of these extras, use the `all` extra: ``` -pip install -U "jupyterlab-datalogger[all]" --extra-index-url https://painterqubits.github.io/jupyterlab-datalogger/releases +pip install -U "jupyterlab-datalogs[all]" --extra-index-url https://painterqubits.github.io/jupyterlab-datalogs/releases ``` While the Real-Time Collaboration extension is included in the `plugins` extra for @@ -43,13 +43,13 @@ To develop, the following dependencies must be installed: Then, run ```bash -yarn +hatch run ci:jlpm ``` to install Node.js dependencies, and ```bash -yarn dev +hatch run dev ``` to build the extension and start up a JupyterLab server. The first time you do this, also @@ -59,9 +59,10 @@ changes, it should automatically rebuild, and the updated extension will be used page is reloaded. > [!NOTE] -> On Windows, symbolic links must be activated for `yarn dev` to work. On Windows 10 or -> above for Python version 3.8 or higher, this can be done by +> On Windows, symbolic links must be activated for `hatch run dev` to work. On Windows 10 +> or above for Python version 3.8 or higher, this can be done by > [activating developer mode](https://learn.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development). > -> Alternatively, you can run `yarn preview` to rebuild and reinstall the extension each -> time the source code changes. +> Alternatively, you can run `hatch run build` to rebuild and reinstall the extension each +> time the source code changes, and `hatch run jupyter lab` to start a new JupyterLab +> server. diff --git a/install.json b/install.json index 29b4e31..74244a8 100644 --- a/install.json +++ b/install.json @@ -1,5 +1,5 @@ { "packageManager": "python", - "packageName": "jupyterlab-datalogger", - "uninstallInstructions": "Use your Python package manager (pip, conda, etc.) to uninstall the package jupyterlab-datalogger." + "packageName": "jupyterlab-datalogs", + "uninstallInstructions": "Use your Python package manager (pip, conda, etc.) to uninstall the package jupyterlab-datalogs." } diff --git a/jupyterlab_datalogger/__init__.py b/jupyterlab_datalogs/__init__.py similarity index 80% rename from jupyterlab_datalogger/__init__.py rename to jupyterlab_datalogs/__init__.py index c9ad351..ebbea07 100644 --- a/jupyterlab_datalogger/__init__.py +++ b/jupyterlab_datalogs/__init__.py @@ -1,6 +1,6 @@ -"""JupyterLab extension for DataLogger.""" +"""JupyterLab extension for DataLogs.""" # Required for symlinking in development ("jupyter labextension develop --overwrite .") def _jupyter_labextension_paths() -> list[dict[str, str]]: - return [{"src": "../labextension", "dest": "jupyterlab-datalogger"}] + return [{"src": "../labextension", "dest": "jupyterlab-datalogs"}] diff --git a/package.json b/package.json index 058dfbb..04471a5 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { - "name": "jupyterlab-datalogger", + "name": "jupyterlab-datalogs", "private": true, "version": "0.4.1", - "description": "JupyterLab extension for DataLogger.", + "description": "JupyterLab extension for DataLogs.", "contributors": [ { "name": "Alex Hadley", @@ -15,8 +15,8 @@ "jupyterlab", "jupyterlab-extension" ], - "homepage": "https://github.com/PainterQubits/jupyterlab-datalogger", - "repository": "github:PainterQubits/jupyterlab-datalogger", + "homepage": "https://github.com/PainterQubits/jupyterlab-datalogs", + "repository": "github:PainterQubits/jupyterlab-datalogs", "main": "lib/index.js", "jupyterlab": { "extension": true, diff --git a/pyproject.toml b/pyproject.toml index 0e72ff8..449391d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ requires = ["hatchling", "hatch-nodejs-version", "jupyterlab>=4.0.10,<5"] build-backend = "hatchling.build" [project] -name = "jupyterlab-datalogger" +name = "jupyterlab-datalogs" license = { file = "LICENSE" } readme = "README.md" classifiers = [ @@ -24,10 +24,10 @@ requires-python = ">=3.9" dynamic = ["version", "description", "authors", "urls", "keywords"] [project.optional-dependencies] -all = ["jupyterlab-datalogger[jupyterlab,analysis,plugins]"] +all = ["jupyterlab-datalogs[jupyterlab,analysis,plugins]"] jupyterlab = ["jupyterlab>=4.0.10,<5"] analysis = [ - "datalogger @ https://painterqubits.github.io/datalogger/latest.tar.gz", + "datalogs @ https://painterqubits.github.io/datalogs/latest.tar.gz", "numpy>=1.26.3,<2", "xarray>=2023.12.0", "matplotlib>=3.8.2,<4", @@ -51,8 +51,8 @@ fields = ["description", "authors", "urls", "keywords"] artifacts = ["labextension"] [tool.hatch.build.targets.wheel.shared-data] -"labextension" = "share/jupyter/labextensions/jupyterlab-datalogger" -"install.json" = "share/jupyter/labextensions/jupyterlab-datalogger/install.json" +"labextension" = "share/jupyter/labextensions/jupyterlab-datalogs" +"install.json" = "share/jupyter/labextensions/jupyterlab-datalogs/install.json" [tool.hatch.build.hooks.jupyter-builder] dependencies = ["hatch-jupyter-builder>=0.8.3"] @@ -69,14 +69,14 @@ description = "For running JupyterLab in development" dependencies = [ "jupyterlab>=4.0.10,<5", "jupyter-collaboration>=2.0.1,<3", - "datalogger>=0.3.0", + "datalogs>=0.3.0", "numpy>=1.26.3,<2", "xarray>=2023.12.0", "matplotlib>=3.8.2,<4", ] [tool.hatch.envs.default.env-vars] -PIP_EXTRA_INDEX_URL = "https://painterqubits.github.io/datalogger/releases" +PIP_EXTRA_INDEX_URL = "https://painterqubits.github.io/datalogs/releases" [tool.hatch.envs.default.scripts] dev = "jlpm dev" diff --git a/schema/datalogger-load-code-plugin.json b/schema/datalogs-load-code-plugin.json similarity index 70% rename from schema/datalogger-load-code-plugin.json rename to schema/datalogs-load-code-plugin.json index 315cd61..c40c7f2 100644 --- a/schema/datalogger-load-code-plugin.json +++ b/schema/datalogs-load-code-plugin.json @@ -1,6 +1,6 @@ { - "title": "DataLogger Load Code", - "description": "Shortcuts to generate code that loads logs with DataLogger.", + "title": "DataLogs Load Code", + "description": "Shortcuts to generate code that loads logs with DataLogs.", "jupyter.lab.menus": { "main": [ { @@ -12,7 +12,7 @@ "id": "jp-mainmenu-file-new", "items": [ { - "command": "jupyterlab-datalogger:datalogger-notebook-command", + "command": "jupyterlab-datalogs:datalogs-notebook-command", "rank": 20 } ] @@ -23,12 +23,12 @@ ], "context": [ { - "command": "jupyterlab-datalogger:add-datalogger-load-code-command", + "command": "jupyterlab-datalogs:add-datalogs-load-code-command", "selector": ".jp-DirListing-item[data-isdir=\"false\"]", "rank": 3 }, { - "command": "jupyterlab-datalogger:new-datalogger-notebook-command", + "command": "jupyterlab-datalogs:new-datalogs-notebook-command", "selector": ".jp-DirListing-content", "rank": 53 } diff --git a/src/constants.ts b/src/constants.ts index dc41de1..b7deab2 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -1,4 +1,4 @@ -export const PACKAGE_NAME = "jupyterlab-datalogger"; +export const PACKAGE_NAME = "jupyterlab-datalogs"; // Mimetypes export const JSON_MIMETYPE = "application/json"; diff --git a/src/index.ts b/src/index.ts index c4149a2..79a9618 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,3 +1,3 @@ -import { netcdfFileTypePlugin, dataloggerLoadCodePlugin } from "@/plugins"; +import { netcdfFileTypePlugin, datalogsLoadCodePlugin } from "@/plugins"; -export default [netcdfFileTypePlugin, dataloggerLoadCodePlugin]; +export default [netcdfFileTypePlugin, datalogsLoadCodePlugin]; diff --git a/src/plugins/dataloggerLoadCodePlugin.ts b/src/plugins/datalogsLoadCodePlugin.ts similarity index 72% rename from src/plugins/dataloggerLoadCodePlugin.ts rename to src/plugins/datalogsLoadCodePlugin.ts index b9ff560..760d724 100644 --- a/src/plugins/dataloggerLoadCodePlugin.ts +++ b/src/plugins/datalogsLoadCodePlugin.ts @@ -9,21 +9,21 @@ import { chartLineIcon, chartLineIconUrl } from "@/icons"; const logMimetypes = new Set([JSON_MIMETYPE, NETCDF_MIMETYPE]); -const dataloggerNotebookImports = [ +const datalogsNotebookImports = [ "import numpy as np", "import xarray as xr", "import matplotlib.pyplot as plt", - "from datalogger import load_log, DictLog, DataLog", + "from datalogs import load_log, DictLog, DataLog", ]; /** - * Along with its corresponding schema (schema/datalogger-load-code.json), this plugin + * Along with its corresponding schema (schema/datalogs-load-code.json), this plugin * adds items to the file browser context menu, the main menu, and the Launcher to - * add code to notebooks for loading log files using DataLogger. + * add code to notebooks for loading log files using DataLogs. */ -export const dataloggerLoadCodePlugin: JupyterFrontEndPlugin = { - id: `${PACKAGE_NAME}:datalogger-load-code-plugin`, - description: "Shortcuts to generate code that loads logs with DataLogger.", +export const datalogsLoadCodePlugin: JupyterFrontEndPlugin = { + id: `${PACKAGE_NAME}:datalogs-load-code-plugin`, + description: "Shortcuts to generate code that loads logs with DataLogs.", autoStart: true, requires: [ILauncher, IFileBrowserFactory, INotebookTracker], activate( @@ -32,8 +32,8 @@ export const dataloggerLoadCodePlugin: JupyterFrontEndPlugin = { { tracker: fileBrowserTracker }: IFileBrowserFactory, notebookTracker: INotebookTracker, ) { - commands.addCommand(`${PACKAGE_NAME}:add-datalogger-load-code-command`, { - label: "Add DataLogger Load Code", + commands.addCommand(`${PACKAGE_NAME}:add-datalogs-load-code-command`, { + label: "Add DataLogs Load Code", icon: addIcon, execute: async () => { const { currentWidget: fileBrowser } = fileBrowserTracker; @@ -63,7 +63,7 @@ export const dataloggerLoadCodePlugin: JupyterFrontEndPlugin = { }, }); - async function newDataloggerNotebook() { + async function newDatalogsNotebook() { // Create a new notebook const notebookPanel: NotebookPanel = await commands.execute("notebook:create-new"); await notebookPanel.context.ready; @@ -74,7 +74,7 @@ export const dataloggerLoadCodePlugin: JupyterFrontEndPlugin = { insertLocation: "currentCell", cellType: "markdown", }); - await addToNotebook(notebook, dataloggerNotebookImports.join("\n")); + await addToNotebook(notebook, datalogsNotebookImports.join("\n")); await addToNotebook(notebook, "## Load Logs", { cellType: "markdown" }); await addToNotebook(notebook); NotebookActions.renderAllMarkdown(notebook); @@ -84,32 +84,32 @@ export const dataloggerLoadCodePlugin: JupyterFrontEndPlugin = { } // Used in file browser context menu - commands.addCommand(`${PACKAGE_NAME}:new-datalogger-notebook-command`, { - label: "New DataLogger Notebook", + commands.addCommand(`${PACKAGE_NAME}:new-datalogs-notebook-command`, { + label: "New DataLogs Notebook", icon: chartLineIcon, - execute: newDataloggerNotebook, + execute: newDatalogsNotebook, }); // Used in main menu File > New - commands.addCommand(`${PACKAGE_NAME}:datalogger-notebook-command`, { - label: "DataLogger Notebook", + commands.addCommand(`${PACKAGE_NAME}:datalogs-notebook-command`, { + label: "DataLogs Notebook", icon: chartLineIcon, - execute: newDataloggerNotebook, + execute: newDatalogsNotebook, }); // Used in Launcher - commands.addCommand(`${PACKAGE_NAME}:datalogger-command`, { - label: "DataLogger", + commands.addCommand(`${PACKAGE_NAME}:datalogs-command`, { + label: "DataLogs", icon: chartLineIcon, - execute: newDataloggerNotebook, + execute: newDatalogsNotebook, }); launcher.add({ category: "Notebook", - command: `${PACKAGE_NAME}:datalogger-command`, + command: `${PACKAGE_NAME}:datalogs-command`, kernelIconUrl: chartLineIconUrl, }); }, }; -export default dataloggerLoadCodePlugin; +export default datalogsLoadCodePlugin; diff --git a/src/plugins/index.ts b/src/plugins/index.ts index 3658718..450d963 100644 --- a/src/plugins/index.ts +++ b/src/plugins/index.ts @@ -1,2 +1,2 @@ export * from "./netcdfFileTypePlugin"; -export * from "./dataloggerLoadCodePlugin"; +export * from "./datalogsLoadCodePlugin"; diff --git a/yarn.lock b/yarn.lock index b042f37..20b3a50 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3842,9 +3842,9 @@ __metadata: languageName: node linkType: hard -"jupyterlab-datalogger@workspace:.": +"jupyterlab-datalogs@workspace:.": version: 0.0.0-use.local - resolution: "jupyterlab-datalogger@workspace:." + resolution: "jupyterlab-datalogs@workspace:." dependencies: "@jupyterlab/application": ^4.1.0 "@jupyterlab/builder": ^4.1.0