From 49e1a5988e36f92e7af26dd6bc9fc77726be1663 Mon Sep 17 00:00:00 2001 From: April Wang from ETHZ Date: Thu, 22 Aug 2024 09:48:43 +0200 Subject: [PATCH] fix build --- .copier-answers.yml | 4 +- .github/workflows/build.yml | 14 +-- .github/workflows/check-release.yml | 2 +- .gitignore | 4 +- .prettierignore | 2 +- DEPLOYMENT.md | 18 ++++ Dockerfile | 7 ++ README.md | 12 +-- RELEASE.md | 2 +- binder/environment.yml | 2 +- binder/postBuild | 4 +- {jupyterlab_apod => cluster_viz}/__init__.py | 4 +- install.json | 4 +- package.json | 14 +-- pyproject.toml | 19 ++-- src/__tests__/jupyterlab_apod.spec.ts | 2 +- ui-tests/package.json | 4 +- ui-tests/tests/jupyterlab_apod.spec.ts | 2 +- yarn.lock | 108 +++++++++---------- 19 files changed, 127 insertions(+), 101 deletions(-) create mode 100644 DEPLOYMENT.md create mode 100644 Dockerfile rename {jupyterlab_apod => cluster_viz}/__init__.py (80%) diff --git a/.copier-answers.yml b/.copier-answers.yml index e2f51d1..5ab8476 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -6,12 +6,12 @@ author_name: My Name has_binder: true has_settings: false kind: frontend -labextension_name: jupyterlab_apod +labextension_name: cluster_viz project_short_description: ' Show a random NASA Astronomy Picture of the Day in a JupyterLab panel ' -python_name: jupyterlab_apod +python_name: cluster_viz repository: '' test: true diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 28129b9..64ff06c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -41,7 +41,7 @@ jobs: python -m pip install .[test] jupyter labextension list - jupyter labextension list 2>&1 | grep -ie "jupyterlab_apod.*OK" + jupyter labextension list 2>&1 | grep -ie "cluster_viz.*OK" python -m jupyterlab.browser_check - name: Package the extension @@ -50,13 +50,13 @@ jobs: pip install build python -m build - pip uninstall -y "jupyterlab_apod" jupyterlab + pip uninstall -y "cluster_viz" jupyterlab - name: Upload extension packages uses: actions/upload-artifact@v4 with: name: extension-artifacts - path: dist/jupyterlab_apod* + path: dist/cluster_viz* if-no-files-found: error test_isolated: @@ -79,11 +79,11 @@ jobs: sudo rm -rf $(which node) sudo rm -rf $(which node) - pip install "jupyterlab>=4.0.0,<5" jupyterlab_apod*.whl + pip install "jupyterlab>=4.0.0,<5" cluster_viz*.whl jupyter labextension list - jupyter labextension list 2>&1 | grep -ie "jupyterlab_apod.*OK" + jupyter labextension list 2>&1 | grep -ie "cluster_viz.*OK" python -m jupyterlab.browser_check --no-browser-test integration-tests: @@ -109,7 +109,7 @@ jobs: - name: Install the extension run: | set -eux - python -m pip install "jupyterlab>=4.0.0,<5" jupyterlab_apod*.whl + python -m pip install "jupyterlab>=4.0.0,<5" cluster_viz*.whl - name: Install dependencies working-directory: ui-tests @@ -138,7 +138,7 @@ jobs: if: always() uses: actions/upload-artifact@v4 with: - name: jupyterlab_apod-playwright-tests + name: cluster_viz-playwright-tests path: | ui-tests/test-results ui-tests/playwright-report diff --git a/.github/workflows/check-release.yml b/.github/workflows/check-release.yml index dea5378..aad2da2 100644 --- a/.github/workflows/check-release.yml +++ b/.github/workflows/check-release.yml @@ -26,5 +26,5 @@ jobs: - name: Upload Distributions uses: actions/upload-artifact@v4 with: - name: jupyterlab_apod-releaser-dist-${{ github.run_number }} + name: cluster_viz-releaser-dist-${{ github.run_number }} path: .jupyter_releaser_checkout/dist diff --git a/.gitignore b/.gitignore index 8d60b68..1e7c4ad 100644 --- a/.gitignore +++ b/.gitignore @@ -10,9 +10,9 @@ backend/api_key.txt *.egg-info/ .ipynb_checkpoints *.tsbuildinfo -jupyterlab_apod/labextension +cluster_viz/labextension # Version file is handled by hatchling -jupyterlab_apod/_version.py +cluster_viz/_version.py /secrets # Integration tests ui-tests/test-results/ diff --git a/.prettierignore b/.prettierignore index 2a5f4b3..1751637 100644 --- a/.prettierignore +++ b/.prettierignore @@ -3,5 +3,5 @@ node_modules **/lib **/package.json !/package.json -jupyterlab_apod +cluster_viz backend \ No newline at end of file diff --git a/DEPLOYMENT.md b/DEPLOYMENT.md new file mode 100644 index 0000000..f5c3ebb --- /dev/null +++ b/DEPLOYMENT.md @@ -0,0 +1,18 @@ +# Using the GitHub Container Registry for Deployment + +1. Create a personal token: https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens + +``` +docker login ghcr.io --username github-account +[Paste your GitHub token on this prompt] +``` +2. Build the image for the server +``` +docker image build --platform linux/amd64 -t cluster-jupyter . +``` + +2. Tag and push your Docker images +``` +docker tag cluster-jupyter ghcr.io/eth-peach-lab/datascience-visualisation/cluster-jupyter:latest +docker push ghcr.io/eth-peach-lab/datascience-visualisation/cluster-jupyter:latest +``` \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..666e491 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM quay.io/jupyter/minimal-notebook:hub-5.1.0 +USER root +RUN pip install --no-cache -U cluster_viz +EXPOSE 8000 +EXPOSE 8888 +USER ${NB_USER} +CMD ["/bin/bash","-c", "jupyterhub-singleuser"] \ No newline at end of file diff --git a/README.md b/README.md index 1f75c44..ba0f79a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# jupyterlab_apod +# cluster_Viz [![Github Actions Status](/workflows/Build/badge.svg)](/actions/workflows/build.yml) @@ -16,7 +16,7 @@ To install the extension, execute: ```bash -pip install jupyterlab_apod +pip install cluster_viz ``` ## Uninstall @@ -24,7 +24,7 @@ pip install jupyterlab_apod To remove the extension, execute: ```bash -pip uninstall jupyterlab_apod +pip uninstall cluster_viz ``` ## Contributing @@ -39,7 +39,7 @@ The `jlpm` command is JupyterLab's pinned version of ```bash # Clone the repo to your local environment -# Change directory to the jupyterlab_apod directory +# Change directory to the cluster_viz directory # Install package in development mode pip install -e "." # Link your development version of the extension with JupyterLab @@ -68,12 +68,12 @@ jupyter lab build --minimize=False ### Development uninstall ```bash -pip uninstall jupyterlab_apod +pip uninstall cluster_viz ``` In development mode, you will also need to remove the symlink created by `jupyter labextension develop` command. To find its location, you can run `jupyter labextension list` to figure out where the `labextensions` -folder is located. Then you can remove the symlink named `jupyterlab_apod` within that folder. +folder is located. Then you can remove the symlink named `cluster_viz` within that folder. ### Testing the extension diff --git a/RELEASE.md b/RELEASE.md index 4861789..1de8831 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,4 +1,4 @@ -# Making a new release of jupyterlab_apod +# Making a new release of cluster_viz The extension can be published to `PyPI` and `npm` manually or using the [Jupyter Releaser](https://github.com/jupyter-server/jupyter_releaser). diff --git a/binder/environment.yml b/binder/environment.yml index 7359a31..4ff0f8d 100644 --- a/binder/environment.yml +++ b/binder/environment.yml @@ -1,4 +1,4 @@ -# a mybinder.org-ready environment for demoing jupyterlab_apod +# a mybinder.org-ready environment for demoing cluster_viz # this environment may also be used locally on Linux/MacOS/Windows, e.g. # # conda env update --file binder/environment.yml diff --git a/binder/postBuild b/binder/postBuild index 5866b85..9cfc133 100755 --- a/binder/postBuild +++ b/binder/postBuild @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -""" perform a development install of jupyterlab_apod +""" perform a development install of cluster_viz On Binder, this will run _after_ the environment has been fully created from the environment.yml in this directory. @@ -43,5 +43,5 @@ _("jupyter", "server", "extension", "list") _("jupyter", "labextension", "list") -print("JupyterLab with jupyterlab_apod is ready to run with:\n") +print("JupyterLab with cluster_viz is ready to run with:\n") print("\tjupyter lab\n") diff --git a/jupyterlab_apod/__init__.py b/cluster_viz/__init__.py similarity index 80% rename from jupyterlab_apod/__init__.py rename to cluster_viz/__init__.py index 6e31c55..13410bc 100644 --- a/jupyterlab_apod/__init__.py +++ b/cluster_viz/__init__.py @@ -5,12 +5,12 @@ # 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_apod' outside a proper installation.") + warnings.warn("Importing 'cluster_viz' outside a proper installation.") __version__ = "dev" def _jupyter_labextension_paths(): return [{ "src": "labextension", - "dest": "jupyterlab_apod" + "dest": "cluster_viz" }] diff --git a/install.json b/install.json index 3a658ac..166052f 100644 --- a/install.json +++ b/install.json @@ -1,5 +1,5 @@ { "packageManager": "python", - "packageName": "jupyterlab_apod", - "uninstallInstructions": "Use your Python package manager (pip, conda, etc.) to uninstall the package jupyterlab_apod" + "packageName": "cluster_viz", + "uninstallInstructions": "Use your Python package manager (pip, conda, etc.) to uninstall the package cluster_viz" } diff --git a/package.json b/package.json index ba8bab3..c1b0970 100644 --- a/package.json +++ b/package.json @@ -1,15 +1,15 @@ { - "name": "jupyterlab_apod", - "version": "0.1.0", + "name": "cluster_viz", + "version": "0.2.1", "description": "Show a random NASA Astronomy Picture of the Day in a JupyterLab panel", "keywords": [ "jupyter", "jupyterlab", "jupyterlab-extension" ], - "homepage": "", + "homepage": "https://github.com/ETH-PEACH-Lab/datascience-visualisation", "bugs": { - "url": "/issues" + "url": "https://github.com/ETH-PEACH-Lab/datascience-visualisation/issues" }, "license": "BSD-3-Clause", "author": "My Name", @@ -23,7 +23,7 @@ "style": "style/index.css", "repository": { "type": "git", - "url": ".git" + "url": "https://github.com/ETH-PEACH-Lab/datascience-visualisation" }, "scripts": { "build": "jlpm build:lib && jlpm build:labextension:dev", @@ -35,7 +35,7 @@ "clean": "jlpm clean:lib", "clean:lib": "rimraf lib tsconfig.tsbuildinfo", "clean:lintcache": "rimraf .eslintcache .stylelintcache", - "clean:labextension": "rimraf jupyterlab_apod/labextension jupyterlab_apod/_version.py", + "clean:labextension": "rimraf cluster_viz/labextension cluster_viz/_version.py", "clean:all": "jlpm clean:lib && jlpm clean:labextension && jlpm clean:lintcache", "eslint": "jlpm eslint:check --fix", "eslint:check": "eslint . --cache --ext .ts,.tsx", @@ -119,7 +119,7 @@ }, "jupyterlab": { "extension": true, - "outputDir": "jupyterlab_apod/labextension", + "outputDir": "cluster_viz/labextension", "sharedPackages": { "@jupyter-widgets/base": { "bundled": false, diff --git a/pyproject.toml b/pyproject.toml index fbff3f1..d774361 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,8 +3,9 @@ requires = ["hatchling>=1.5.0", "jupyterlab>=4.0.0,<5", "hatch-nodejs-version>=0 build-backend = "hatchling.build" [project] -name = "jupyterlab_apod" +name = "cluster_viz" readme = "README.md" +homepage = "https://github.com/ETH-PEACH-Lab/datascience-visualisation" # Add your repository or website URL here license = { file = "LICENSE" } requires-python = ">=3.8" classifiers = [ @@ -33,24 +34,24 @@ source = "nodejs" fields = ["description", "authors", "urls"] [tool.hatch.build.targets.sdist] -artifacts = ["jupyterlab_apod/labextension"] +artifacts = ["cluster_viz/labextension"] exclude = [".github", "binder"] [tool.hatch.build.targets.wheel.shared-data] -"jupyterlab_apod/labextension" = "share/jupyter/labextensions/jupyterlab_apod" -"install.json" = "share/jupyter/labextensions/jupyterlab_apod/install.json" +"cluster_viz/labextension" = "share/jupyter/labextensions/cluster_viz" +"install.json" = "share/jupyter/labextensions/cluster_viz/install.json" [tool.hatch.build.hooks.version] -path = "jupyterlab_apod/_version.py" +path = "cluster_viz/_version.py" [tool.hatch.build.hooks.jupyter-builder] dependencies = ["hatch-jupyter-builder>=0.5"] build-function = "hatch_jupyter_builder.npm_builder" ensured-targets = [ - "jupyterlab_apod/labextension/static/style.js", - "jupyterlab_apod/labextension/package.json", + "cluster_viz/labextension/static/style.js", + "cluster_viz/labextension/package.json", ] -skip-if-exists = ["jupyterlab_apod/labextension/static/style.js"] +skip-if-exists = ["cluster_viz/labextension/static/style.js"] [tool.hatch.build.hooks.jupyter-builder.build-kwargs] build_cmd = "build:prod" @@ -60,7 +61,7 @@ npm = ["jlpm"] build_cmd = "install:extension" npm = ["jlpm"] source_dir = "src" -build_dir = "jupyterlab_apod/labextension" +build_dir = "cluster_viz/labextension" [tool.jupyter-releaser.options] version_cmd = "hatch version" diff --git a/src/__tests__/jupyterlab_apod.spec.ts b/src/__tests__/jupyterlab_apod.spec.ts index 715e124..57a4f6a 100644 --- a/src/__tests__/jupyterlab_apod.spec.ts +++ b/src/__tests__/jupyterlab_apod.spec.ts @@ -2,7 +2,7 @@ * Example of [Jest](https://jestjs.io/docs/getting-started) unit tests */ -describe('jupyterlab_apod', () => { +describe('cluster_viz', () => { it('should be tested', () => { expect(1 + 1).toEqual(2); }); diff --git a/ui-tests/package.json b/ui-tests/package.json index b082a7b..dd6074a 100644 --- a/ui-tests/package.json +++ b/ui-tests/package.json @@ -1,7 +1,7 @@ { - "name": "jupyterlab_apod-ui-tests", + "name": "cluster_viz-ui-tests", "version": "1.0.0", - "description": "JupyterLab jupyterlab_apod Integration Tests", + "description": "JupyterLab cluster_viz Integration Tests", "private": true, "scripts": { "start": "jupyter lab --config jupyter_server_test_config.py", diff --git a/ui-tests/tests/jupyterlab_apod.spec.ts b/ui-tests/tests/jupyterlab_apod.spec.ts index 6b520d2..f44ca17 100644 --- a/ui-tests/tests/jupyterlab_apod.spec.ts +++ b/ui-tests/tests/jupyterlab_apod.spec.ts @@ -16,6 +16,6 @@ test('should emit an activation console message', async ({ page }) => { await page.goto(); expect( - logs.filter(s => s === 'JupyterLab extension jupyterlab_apod is activated!') + logs.filter(s => s === 'JupyterLab extension cluster_viz is activated!') ).toHaveLength(1); }); diff --git a/yarn.lock b/yarn.lock index fc53ddf..48d61aa 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5058,6 +5058,60 @@ __metadata: languageName: node linkType: hard +"cluster_viz@workspace:.": + version: 0.0.0-use.local + resolution: "cluster_viz@workspace:." + dependencies: + "@codemirror/lang-python": ^6.1.6 + "@jupyterlab/application": ^4.2.1 + "@jupyterlab/apputils": ^4.3.1 + "@jupyterlab/builder": ^4.0.0 + "@jupyterlab/launcher": ^4.2.3 + "@jupyterlab/launcher\n": ^4.2.3 + "@jupyterlab/testutils": ^4.0.0 + "@lumino/widgets": ^2.3.2 + "@types/cytoscape": ^3.21.4 + "@types/d3": ^7.4.3 + "@types/jest": ^29.2.0 + "@types/json-schema": ^7.0.11 + "@types/react": ^18.3.3 + "@types/react-addons-linked-state-mixin": ^0.14.22 + "@types/react-dom": ^18.3.0 + "@types/three": ^0.166.0 + "@typescript-eslint/eslint-plugin": ^6.1.0 + "@typescript-eslint/parser": ^6.1.0 + codemirror: ^6.0.1 + css-loader: ^6.7.1 + cytoscape: ^3.30.0 + d3: ^7.9.0 + eslint: ^8.36.0 + eslint-config-prettier: ^8.8.0 + eslint-plugin-prettier: ^5.0.0 + express: ^4.19.2 + fs: ^0.0.1-security + graphology-types: ^0.24.7 + jest: ^29.2.0 + npm-run-all: ^4.1.5 + prettier: ^3.0.0 + react: ^18.3.1 + react-dom: ^18.3.1 + reagraph: ^4.19.2 + rimraf: ^5.0.1 + source-map-loader: ^1.0.2 + style-loader: ^3.3.1 + stylelint: ^15.10.1 + stylelint-config-recommended: ^13.0.0 + stylelint-config-standard: ^34.0.0 + stylelint-csstree-validator: ^3.0.0 + stylelint-prettier: ^4.0.0 + three: ^0.166.1 + types: ^0.1.1 + typescript: ^5.5.3 + webpack: ^5.93.0 + yjs: ^13.5.0 + languageName: unknown + linkType: soft + "co@npm:^4.6.0": version: 4.6.0 resolution: "co@npm:4.6.0" @@ -8715,60 +8769,6 @@ __metadata: languageName: node linkType: hard -"jupyterlab_apod@workspace:.": - version: 0.0.0-use.local - resolution: "jupyterlab_apod@workspace:." - dependencies: - "@codemirror/lang-python": ^6.1.6 - "@jupyterlab/application": ^4.2.1 - "@jupyterlab/apputils": ^4.3.1 - "@jupyterlab/builder": ^4.0.0 - "@jupyterlab/launcher": ^4.2.3 - "@jupyterlab/launcher\n": ^4.2.3 - "@jupyterlab/testutils": ^4.0.0 - "@lumino/widgets": ^2.3.2 - "@types/cytoscape": ^3.21.4 - "@types/d3": ^7.4.3 - "@types/jest": ^29.2.0 - "@types/json-schema": ^7.0.11 - "@types/react": ^18.3.3 - "@types/react-addons-linked-state-mixin": ^0.14.22 - "@types/react-dom": ^18.3.0 - "@types/three": ^0.166.0 - "@typescript-eslint/eslint-plugin": ^6.1.0 - "@typescript-eslint/parser": ^6.1.0 - codemirror: ^6.0.1 - css-loader: ^6.7.1 - cytoscape: ^3.30.0 - d3: ^7.9.0 - eslint: ^8.36.0 - eslint-config-prettier: ^8.8.0 - eslint-plugin-prettier: ^5.0.0 - express: ^4.19.2 - fs: ^0.0.1-security - graphology-types: ^0.24.7 - jest: ^29.2.0 - npm-run-all: ^4.1.5 - prettier: ^3.0.0 - react: ^18.3.1 - react-dom: ^18.3.1 - reagraph: ^4.19.2 - rimraf: ^5.0.1 - source-map-loader: ^1.0.2 - style-loader: ^3.3.1 - stylelint: ^15.10.1 - stylelint-config-recommended: ^13.0.0 - stylelint-config-standard: ^34.0.0 - stylelint-csstree-validator: ^3.0.0 - stylelint-prettier: ^4.0.0 - three: ^0.166.1 - types: ^0.1.1 - typescript: ^5.5.3 - webpack: ^5.93.0 - yjs: ^13.5.0 - languageName: unknown - linkType: soft - "keyv@npm:^4.5.3": version: 4.5.4 resolution: "keyv@npm:4.5.4"