Skip to content

Commit

Permalink
Remove PDF preview and open warning plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
alexhad6 committed Nov 9, 2023
1 parent 17da780 commit e98608f
Show file tree
Hide file tree
Showing 23 changed files with 776 additions and 2,769 deletions.
16 changes: 3 additions & 13 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,10 @@
"plugin:@typescript-eslint/recommended",
"plugin:import/recommended",
"plugin:import/typescript",
"plugin:react/recommended",
"plugin:react/jsx-runtime",
"plugin:react-hooks/recommended",
"plugin:jsx-a11y/recommended",
"prettier"
],
"rules": {
"@typescript-eslint/no-empty-function": "off",
"react/self-closing-comp": "error"
},
"settings": {
"import/resolver": "typescript",
"react": {
"version": "detect"
}
"import/resolver": "typescript"
},
"overrides": [
{
Expand All @@ -31,5 +20,6 @@
"@typescript-eslint/no-var-requires": "off"
}
}
]
],
"ignorePatterns": ["lib/", "labextension/"]
}
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added

- Recommended plugins (including the PDF preview and open warning plugins) can be
installed using the `plugins` extra.

### Changed

- Moved PDF preview plugin to https://github.com/PainterQubits/jupyterlab-pdf-preview.
- Moved open warning plugin to https://github.com/PainterQubits/jupyterlab-open-warning.

## [0.3.1] (Oct 30 2023)

### Fixed
Expand Down
5 changes: 0 additions & 5 deletions datalogger_jupyterlab/__init__.py

This file was deleted.

6 changes: 6 additions & 0 deletions jupyterlab_datalogger/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"""JupyterLab extension for DataLogger."""


# Required for symlinking in development ("jupyter labextension develop --overwrite .")
def _jupyter_labextension_paths() -> list[dict[str, str]]:
return [{"src": "../labextension", "dest": "jupyterlab-datalogger"}]
48 changes: 26 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,20 @@
"private": true,
"version": "0.3.1",
"description": "JupyterLab extension for DataLogger.",
"contributors": [
{
"name": "Alex Hadley",
"email": "contact@alexhadley.net"
}
],
"license": "BSD-3-Clause",
"keywords": [
"jupyter",
"jupyterlab",
"jupyterlab-extension"
],
"homepage": "https://github.com/PainterQubits/jupyterlab-datalogger",
"repository": "github:PainterQubits/jupyterlab-datalogger",
"main": "lib/index.js",
"jupyterlab": {
"extension": true,
Expand All @@ -12,30 +25,24 @@
"webpackConfig": "webpack.config.js"
},
"scripts": {
"dev": "yarn build && hatch run jupyterlab:develop && run-p watch:src watch:labextension jupyterlab",
"build": "run-s clean cp:icons && tsc && hatch run jupyter labextension build .",
"preview": "yarn build && hatch env remove jupyterlab && yarn jupyterlab",
"clean": "rm -rf lib tsconfig.tsbuildinfo labextension",
"dev": "run-s build symlink:labextension && run-p watch:lib watch:labextension jupyterlab",
"build": "run-s clean copy-icons build:lib build:labextension",
"clean": "rimraf lib tsconfig.tsbuildinfo labextension",
"lint": "tsc --noEmit && eslint . && prettier --check .",
"cp:icons": "mkdir -p lib/icons && cp src/icons/*.svg* lib/icons",
"watch:src": "yarn cp:icons && tsc -w",
"watch:labextension": "hatch run jupyter labextension watch .",
"jupyterlab": "hatch run jupyterlab:start"
"build:lib": "tsc",
"watch:lib": "tsc -w",
"build:labextension": "jupyter labextension build .",
"symlink:labextension": "jupyter labextension develop --overwrite .",
"watch:labextension": "jupyter labextension watch .",
"jupyterlab": "hatch run jupyter lab",
"copy-icons": "mkdir -p lib/icons && cp src/icons/*.svg* lib/icons"
},
"dependencies": {
"@jupyter/collaboration": "^1.2.0",
"@jupyterlab/application": "^4.0.8",
"@jupyterlab/apputils": "^4.1.8",
"@jupyterlab/docmanager": "^4.0.8",
"@jupyterlab/filebrowser": "^4.0.8",
"@jupyterlab/launcher": "^4.0.8",
"@jupyterlab/notebook": "^4.0.8",
"@jupyterlab/services": "^7.0.8",
"@jupyterlab/ui-components": "^4.0.8",
"@lumino/signaling": "^2.1.2",
"react": "^18.2.0",
"react-pdf": "^7.5.1",
"y-protocols": "^1.0.6"
"@jupyterlab/ui-components": "^4.0.8"
},
"devDependencies": {
"@jupyterlab/builder": "^4.0.8",
Expand All @@ -45,12 +52,9 @@
"eslint-config-prettier": "^9.0.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-jsx-a11y": "^6.8.0",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"npm-run-all": "^4.1.5",
"prettier": "^3.0.3",
"rimraf": "^5.0.5",
"typescript": "^5.2.2"
},
"packageManager": "yarn@4.0.1"
}
}
64 changes: 32 additions & 32 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[build-system]
requires = ["hatchling", "hatch-nodejs-version", "jupyterlab>=4.0.8,<5"]
build-backend = "hatchling.build"

[project]
name = "jupyterlab-datalogger"
version = "0.3.1"
description = "JupyterLab extension for DataLogger."
authors = [{ name = "Alex Hadley", email = "contact@alexhadley.net" }]
license = { file = "LICENSE" }
readme = "README.md"
keywords = ["jupyter", "jupyterlab", "jupyterlab-extension"]
classifiers = [
"Framework :: Jupyter",
"Framework :: Jupyter :: JupyterLab",
Expand All @@ -21,51 +21,51 @@ classifiers = [
"Programming Language :: Python :: 3.12",
]
requires-python = ">=3.9"
dependencies = []
dynamic = ["version", "description", "authors", "urls", "keywords"]

[project.optional-dependencies]
jupyterlab = ["jupyterlab>=4.0.8,<5", "jupyter-collaboration>=1.2.0,<2"]
[tool.hatch.version]
source = "nodejs"

[project.urls]
Homepage = "https://github.com/PainterQubits/jupyterlab-datalogger"
Repository = "https://github.com/PainterQubits/jupyterlab-datalogger"
[tool.hatch.metadata.hooks.nodejs]
fields = ["description", "authors", "urls", "keywords"]

[tool.hatch.build.targets.sdist]
artifacts = ["/datalogger_jupyterlab", "/labextension"]
exclude = ["**/*"]
artifacts = ["labextension"]

[tool.hatch.build.targets.wheel.shared-data]
"labextension" = "share/jupyter/labextensions/jupyterlab-datalogger"
"install.json" = "share/jupyter/labextensions/jupyterlab-datalogger/install.json"

# For building and linting
[tool.hatch.envs.default]
dependencies = [
"jupyterlab>=4.0.7,<5",
"flake8>=6.1.0,<7",
"pylint>=3.0.2,<4",
"mypy>=1.6.1,<2",
"black>=23.10.1,<24",
]
[tool.hatch.build.hooks.jupyter-builder]
dependencies = ["hatch-jupyter-builder>=0.8.3"]
build-function = "hatch_jupyter_builder.npm_builder"
ensured-targets = ["labextension/package.json"]
skip-if-exists = ["labextension/package.json"]

[tool.hatch.build.hooks.jupyter-builder.build-kwargs]
build_cmd = "build"
npm = ["jlpm"]

# For running JupterLab in development
[tool.hatch.envs.jupyterlab]
[tool.hatch.envs.default]
description = "For running JupyterLab in development"
dependencies = [
"jupyterlab>=4.0.7,<5",
"jupyter-collaboration>=1.2.0,<2",
"jupyterlab>=4.0.8,<5",
"datalogger>=0.2.0",
"numpy>=1.26.1,<2",
"xarray>=2023.10.1",
"matplotlib>=3.8.0,<4",
]

[tool.hatch.envs.jupyterlab.env-vars]
[tool.hatch.envs.default.env-vars]
PIP_EXTRA_INDEX_URL = "https://painterqubits.github.io/datalogger/releases"

[tool.hatch.envs.jupyterlab.scripts]
start = "jupyter lab"
develop = "jupyter labextension develop --overwrite ."
[tool.hatch.envs.default.scripts]
dev = "jlpm dev"
build = "jlpm build"
clean = "jlpm clean"
lint = "jlpm lint"

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.hatch.envs.ci]
description = "For running jlpm in CI without building and installing this package"
detached = true
dependencies = ["jupyterlab>=4.0.8,<5"]
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"id": "jp-mainmenu-file-new",
"items": [
{
"command": "jupyterlab-datalogger:datalogger-notebook",
"command": "jupyterlab-datalogger:datalogger-notebook-command",
"rank": 20
}
]
Expand All @@ -23,12 +23,12 @@
],
"context": [
{
"command": "jupyterlab-datalogger:add-datalogger-load-code",
"command": "jupyterlab-datalogger:add-datalogger-load-code-command",
"selector": ".jp-DirListing-item[data-isdir=\"false\"]",
"rank": 3
},
{
"command": "jupyterlab-datalogger:new-datalogger-notebook",
"command": "jupyterlab-datalogger:new-datalogger-notebook-command",
"selector": ".jp-DirListing-content",
"rank": 53
}
Expand Down
8 changes: 2 additions & 6 deletions src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
export const PACKAGE_NAME = "jupyterlab-datalogger";

// Mimetypes
export const PDF_MIMETYPE = "application/pdf";
export const JSON_MIMETYPE = "application/json";
export const NETCDF_MIMETYPE = "application/x-netcdf";

// PDF preview parameters
export const PDF_PREVIEW_WIDTH = 250;
export const PDF_PREVIEW_BORDER_WIDTH = 1;
export const PDF_PREVIEW_GAP = 10;
7 changes: 4 additions & 3 deletions src/icons/index.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import { LabIcon } from "@jupyterlab/ui-components";
import { PACKAGE_NAME } from "@/constants";
import borderAllSvgstring from "./border-all.svg";
import chartLineSvgstring from "./chart-line.svg";

export const borderAllIcon = new LabIcon({
name: "jupyterlab-datalogger:border-all",
name: `${PACKAGE_NAME}:border-all-icon`,
svgstr: borderAllSvgstring,
});

export const chartLineIcon = new LabIcon({
name: "jupyterlab-datalogger:chart-line",
name: `${PACKAGE_NAME}:chart-line-icon`,
svgstr: chartLineSvgstring,
});

export { default as chartLineIconUrl } from "./chart-line.svg?url";
export { default as chartLineIconUrl } from "./chart-line.svg?data-url";
17 changes: 2 additions & 15 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
import applyModifications from "@/modifications";
import {
netcdfFileTypePlugin,
dataloggerLoadCodePlugin,
pdfPreviewPlugin,
openWarningPlugin,
} from "@/plugins";
import { netcdfFileTypePlugin, dataloggerLoadCodePlugin } from "@/plugins";

applyModifications();

export default [
netcdfFileTypePlugin,
dataloggerLoadCodePlugin,
pdfPreviewPlugin,
openWarningPlugin,
];
export default [netcdfFileTypePlugin, dataloggerLoadCodePlugin];
42 changes: 0 additions & 42 deletions src/modifications.ts

This file was deleted.

Loading

0 comments on commit e98608f

Please sign in to comment.