From 6f7573b7b932e8ac07644a506feee7095dce46f6 Mon Sep 17 00:00:00 2001 From: Jeremy Tuloup Date: Mon, 21 Jun 2021 11:41:28 +0200 Subject: [PATCH] Make package importable --- .gitignore | 2 +- .prettierignore | 2 +- MANIFEST.in | 2 +- .../__init__.py | 0 .../_version.py | 0 package.json | 4 ++-- pyproject.toml | 6 +++--- setup.py | 9 ++++----- 8 files changed, 12 insertions(+), 13 deletions(-) rename {jupyterlab-python-file => jupyterlab_python_file}/__init__.py (100%) rename {jupyterlab-python-file => jupyterlab_python_file}/_version.py (100%) diff --git a/.gitignore b/.gitignore index dab9f9f..1702bf0 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,7 @@ node_modules/ *.egg-info/ .ipynb_checkpoints *.tsbuildinfo -jupyterlab-python-file/labextension +jupyterlab_python_file/labextension # Created by https://www.gitignore.io/api/python # Edit at https://www.gitignore.io/?templates=python diff --git a/.prettierignore b/.prettierignore index c7da825..38e8a8a 100644 --- a/.prettierignore +++ b/.prettierignore @@ -2,4 +2,4 @@ node_modules **/node_modules **/lib **/package.json -jupyterlab-python-file +jupyterlab_python_file diff --git a/MANIFEST.in b/MANIFEST.in index fb214d8..e7bce63 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -10,7 +10,7 @@ include ts*.json include yarn.lock include *.md -graft jupyterlab-python-file/labextension +graft jupyterlab_python_file/labextension # Javascript files graft src diff --git a/jupyterlab-python-file/__init__.py b/jupyterlab_python_file/__init__.py similarity index 100% rename from jupyterlab-python-file/__init__.py rename to jupyterlab_python_file/__init__.py diff --git a/jupyterlab-python-file/_version.py b/jupyterlab_python_file/_version.py similarity index 100% rename from jupyterlab-python-file/_version.py rename to jupyterlab_python_file/_version.py diff --git a/package.json b/package.json index eb0c9dc..7fa5b88 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "build:prod": "jlpm run clean && jlpm run build:lib && jlpm run build:labextension", "clean": "jlpm run clean:lib", "clean:all": "jlpm run clean:lib && jlpm run clean:labextension", - "clean:labextension": "rimraf jupyterlab-python-file/labextension", + "clean:labextension": "rimraf jupyterlab_python_file/labextension", "clean:lib": "rimraf lib tsconfig.tsbuildinfo", "eslint": "eslint . --ext .ts,.tsx --fix", "eslint:check": "eslint . --ext .ts,.tsx", @@ -67,7 +67,7 @@ }, "jupyterlab": { "extension": true, - "outputDir": "jupyterlab-python-file/labextension" + "outputDir": "jupyterlab_python_file/labextension" }, "jupyter-releaser": { "hooks": { diff --git a/pyproject.toml b/pyproject.toml index c71e41d..8cdaad8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,8 +3,8 @@ requires = ["jupyter_packaging~=0.10,<2", "jupyterlab~=3.0"] build-backend = "jupyter_packaging.build_api" [tool.jupyter-packaging.options] -skip-if-exists = ["jupyterlab-python-file/labextension/static/style.js"] -ensured-targets = ["jupyterlab-python-file/labextension/static/style.js", "jupyterlab-python-file/labextension/package.json"] +skip-if-exists = ["jupyterlab_python_file/labextension/static/style.js"] +ensured-targets = ["jupyterlab_python_file/labextension/static/style.js", "jupyterlab_python_file/labextension/package.json"] [tool.jupyter-packaging.builder] factory = "jupyter_packaging.npm_builder" @@ -14,4 +14,4 @@ build_cmd = "build:prod" npm = ["jlpm"] [tool.check-manifest] -ignore = ["jupyterlab-python-file/labextension/**", "yarn.lock", ".*", "package-lock.json"] +ignore = ["jupyterlab_python_file/labextension/**", "yarn.lock", ".*", "package-lock.json"] diff --git a/setup.py b/setup.py index f59d9ec..8651e35 100644 --- a/setup.py +++ b/setup.py @@ -10,8 +10,9 @@ # The name of the project name = "jupyterlab-python-file" +package = name.replace('-', '_') -lab_path = HERE / name / "labextension" +lab_path = HERE / package / "labextension" # Representative files that should exist after a successful build ensured_targets = [ @@ -19,11 +20,9 @@ str(lab_path / "static/style.js") ] -labext_name = "jupyterlab-python-file" - data_files_spec = [ - ("share/jupyter/labextensions/%s" % labext_name, str(lab_path), "**"), - ("share/jupyter/labextensions/%s" % labext_name, str(HERE), "install.json"), + ("share/jupyter/labextensions/%s" % name, str(lab_path), "**"), + ("share/jupyter/labextensions/%s" % name, str(HERE), "install.json"), ] long_description = (HERE / "README.md").read_text()