From b05fb78096f5f5fc5e2e401da8dd4308e2cb847e Mon Sep 17 00:00:00 2001 From: krassowski <5832902+krassowski@users.noreply.github.com> Date: Tue, 19 Dec 2023 22:14:15 +0000 Subject: [PATCH] Fix failing tests/local installation with hatch CI: remove unused `[test]`, bump jupyterlab version Add missing setup.py Remove unused manifest file Remove unused travis config Fix incomplete migration to hatch versioning Update lab version in pyproject Make the python package importable --- .github/workflows/build.yml | 4 ++-- .prettierignore | 2 +- .travis.yml | 5 ----- MANIFEST.in | 24 ------------------------ jupyterlab-skip-traceback/__init__.py | 13 ------------- jupyterlab-skip-traceback/_version.py | 4 ---- jupyterlab_skip_traceback/__init__.py | 13 +++++++++++++ package.json | 4 ++-- pyproject.toml | 18 +++++++++--------- setup.py | 1 + 10 files changed, 28 insertions(+), 60 deletions(-) delete mode 100644 .travis.yml delete mode 100644 MANIFEST.in delete mode 100644 jupyterlab-skip-traceback/__init__.py delete mode 100644 jupyterlab-skip-traceback/_version.py create mode 100644 jupyterlab_skip_traceback/__init__.py create mode 100644 setup.py diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d0a6993..4c86e63 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,7 +18,7 @@ jobs: uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 - name: Install dependencies - run: python -m pip install -U "jupyterlab>=4.0.0b0,<5" + run: python -m pip install -U "jupyterlab>=4.1.0a4,<5" - name: Lint the extension run: | @@ -29,7 +29,7 @@ jobs: - name: Build the extension run: | set -eux - python -m pip install .[test] + python -m pip install . jupyter labextension list jupyter labextension list 2>&1 | grep -ie "jupyterlab-skip-traceback.*OK" diff --git a/.prettierignore b/.prettierignore index 8dd8702..25b9ccc 100644 --- a/.prettierignore +++ b/.prettierignore @@ -3,4 +3,4 @@ node_modules **/lib **/package.json !/package.json -jupyterlab-skip-traceback +jupyterlab_skip_traceback diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 5a39a9e..0000000 --- a/.travis.yml +++ /dev/null @@ -1,5 +0,0 @@ -language: javascript -node_js: - - '12' -script: - - yarn run lint diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 401c5c7..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1,24 +0,0 @@ -include LICENSE.txt -include README.md -include pyproject.toml -include jupyter-config/jupyterlab-skip-traceback.json - -include package.json -include install.json -include ts*.json -include yarn.lock - -graft jupyterlab-skip-traceback/labextension - -# Javascript files -graft src -graft style -prune **/node_modules -prune lib - -# Patterns to exclude from any directory -global-exclude *~ -global-exclude *.pyc -global-exclude *.pyo -global-exclude .git -global-exclude .ipynb_checkpoints diff --git a/jupyterlab-skip-traceback/__init__.py b/jupyterlab-skip-traceback/__init__.py deleted file mode 100644 index 360f7cc..0000000 --- a/jupyterlab-skip-traceback/__init__.py +++ /dev/null @@ -1,13 +0,0 @@ -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) - - -def _jupyter_labextension_paths(): - return [{"src": "labextension", "dest": data["name"]}] diff --git a/jupyterlab-skip-traceback/_version.py b/jupyterlab-skip-traceback/_version.py deleted file mode 100644 index c6a8d72..0000000 --- a/jupyterlab-skip-traceback/_version.py +++ /dev/null @@ -1,4 +0,0 @@ -# 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 = '5.0.0' diff --git a/jupyterlab_skip_traceback/__init__.py b/jupyterlab_skip_traceback/__init__.py new file mode 100644 index 0000000..e703f43 --- /dev/null +++ b/jupyterlab_skip_traceback/__init__.py @@ -0,0 +1,13 @@ +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_skip_traceback' outside a proper installation.") + __version__ = "dev" + + +def _jupyter_labextension_paths(): + return [{"src": "labextension", "dest": "jupyterlab_skip_traceback"}] diff --git a/package.json b/package.json index 7e71184..c3d1cd5 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "jupyterlab": { "extension": true, "schemaDir": "schema", - "outputDir": "jupyterlab-skip-traceback/labextension" + "outputDir": "jupyterlab_skip_traceback/labextension" }, "scripts": { "build": "jlpm build:lib && jlpm build:labextension:dev", @@ -42,7 +42,7 @@ "build:prod": "jlpm clean && jlpm build:lib:prod && jlpm build:labextension", "clean": "jlpm clean:lib", "clean:all": "jlpm clean:lib && jlpm clean:labextension && jlpm clean:lintcache", - "clean:labextension": "rimraf jupyterlab-skip-traceback/labextension jupyterlab-skip-traceback/_version.py", + "clean:labextension": "rimraf jupyterlab_skip_traceback/labextension jupyterlab_skip_traceback/_version.py", "clean:lib": "rimraf lib tsconfig.tsbuildinfo", "clean:lintcache": "rimraf .eslintcache .stylelintcache", "eslint": "jlpm eslint:check --fix", diff --git a/pyproject.toml b/pyproject.toml index bba2a5b..312b02e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["hatchling>=1.5.0", "jupyterlab>=4.0.0,<5", "hatch-nodejs-version"] +requires = ["hatchling>=1.5.0", "jupyterlab>=4.1.0a4,<5", "hatch-nodejs-version>=0.3.2"] build-backend = "hatchling.build" [project] @@ -32,24 +32,24 @@ source = "nodejs" fields = ["description", "authors", "urls"] [tool.hatch.build.targets.sdist] -artifacts = ["jupyterlab-skip-traceback/labextension"] +artifacts = ["jupyterlab_skipNtraceback/labextension"] exclude = [".github", "binder"] [tool.hatch.build.targets.wheel.shared-data] -"jupyterlab-skip-traceback/labextension" = "share/jupyter/labextensions/jupyterlab-skip-traceback" +"jupyterlab_skip_traceback/labextension" = "share/jupyter/labextensions/jupyterlab-skip-traceback" "install.json" = "share/jupyter/labextensions/jupyterlab-skip-traceback/install.json" [tool.hatch.build.hooks.version] -path = "jupyterlab-skip-traceback/_version.py" +path = "jupyterlab_skip_traceback/_version.py" [tool.hatch.build.hooks.jupyter-builder] dependencies = ["hatch-jupyter-builder>=0.5"] build-function = "hatch_jupyter_builder.npm_builder" ensured-targets = [ - "jupyterlab-skip-traceback/labextension/static/style.js", - "jupyterlab-skip-traceback/labextension/package.json", + "jupyterlab_skip_traceback/labextension/static/style.js", + "jupyterlab_skip_traceback/labextension/package.json", ] -skip-if-exists = ["jupyterlab-skip-traceback/labextension/static/style.js"] +skip-if-exists = ["jupyterlab_skip_traceback/labextension/static/style.js"] [tool.hatch.build.hooks.jupyter-builder.build-kwargs] build_cmd = "build:prod" @@ -59,14 +59,14 @@ npm = ["jlpm"] build_cmd = "install:extension" npm = ["jlpm"] source_dir = "src" -build_dir = "jupyterlab-skip-traceback/labextension" +build_dir = "jupyterlab_skip_traceback/labextension" [tool.jupyter-releaser.options] version_cmd = "hatch version" [tool.jupyter-releaser.hooks] before-build-npm = [ - "python -m pip install 'jupyterlab>=4.0.0b0,<5'", + "python -m pip install 'jupyterlab>=4.1.0a4,<5'", "jlpm", "jlpm build:prod" ] diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..aefdf20 --- /dev/null +++ b/setup.py @@ -0,0 +1 @@ +__import__("setuptools").setup()