v 0.1.2
ci/woodpecker/push/woodpecker Pipeline failed Details

This commit is contained in:
Malte Grosse 2024-02-05 15:11:31 +00:00
parent 562afa5a7d
commit e0bf889864
37 changed files with 6090 additions and 8890 deletions

19
.copier-answers.yml Normal file
View File

@ -0,0 +1,19 @@
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
_commit: v4.2.5
_src_path: https://github.com/jupyterlab/extension-template
author_email: malte@hdm-stuttgart.de
author_name: jupyterlab-sandbox-announcement
data_format: string
file_extension: ''
has_binder: false
has_settings: false
kind: frontend
labextension_name: jupyterlab-sandbox-announcement
mimetype: ''
mimetype_name: ''
project_short_description: A Jupyterlab Sandbox customization
python_name: jupyterlab_sandbox_announcement
repository: https://git.sandbox.iuk.hdm-stuttgart.de/grosse/jupyterlab-sandbox-announcement
test: false
viewer_name: ''

View File

@ -0,0 +1,4 @@
{
"image": "quay.io/jupyter/scipy-notebook:lab-4.0.12",
"postCreateCommand": "pip install 'copier~=7.2' jinja2-time 'pydantic<2.0.0'"
}

View File

@ -1,8 +0,0 @@
node_modules
dist
coverage
**/*.d.ts
tests
**/__tests__
ui-tests

View File

@ -1,39 +0,0 @@
module.exports = {
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended'
],
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
sourceType: 'module'
},
plugins: ['@typescript-eslint'],
rules: {
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'interface',
format: ['PascalCase'],
custom: {
regex: '^I[A-Z]',
match: true
}
}
],
'@typescript-eslint/no-unused-vars': ['warn', { args: 'none' }],
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-namespace': 'off',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/quotes': [
'error',
'single',
{ avoidEscape: true, allowTemplateLiterals: false }
],
curly: ['error', 'all'],
eqeqeq: 'error',
'prefer-arrow-callback': 'error'
}
};

View File

@ -6,6 +6,10 @@ on:
pull_request:
branches: '*'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
@ -18,18 +22,13 @@ jobs:
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- name: Install dependencies
run: python -m pip install -U jupyterlab~=3.1
run: python -m pip install -U "jupyterlab>=4.0.0,<5"
- name: Lint the extension
run: |
set -eux
jlpm
jlpm run lint:check
- name: Test the extension
run: |
set -eux
jlpm run test
- name: Build the extension
run: |
@ -46,13 +45,13 @@ jobs:
pip install build
python -m build
pip uninstall -y "jupyterlab-sandbox-announcement" jupyterlab
pip uninstall -y "jupyterlab_sandbox_announcement" jupyterlab
- name: Upload extension packages
uses: actions/upload-artifact@v3
with:
name: extension-artifacts
path: dist/jupyterlab-sandbox-announcement*
path: dist/jupyterlab_sandbox_announcement*
if-no-files-found: error
test_isolated:
@ -60,8 +59,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Python
uses: actions/setup-python@v4
with:
@ -77,68 +74,13 @@ jobs:
sudo rm -rf $(which node)
sudo rm -rf $(which node)
pip install "jupyterlab~=3.1" jupyterlab-sandbox-announcement*.whl
pip install "jupyterlab>=4.0.0,<5" jupyterlab_sandbox_announcement*.whl
jupyter labextension list
jupyter labextension list 2>&1 | grep -ie "jupyterlab-sandbox-announcement.*OK"
python -m jupyterlab.browser_check --no-chrome-test
python -m jupyterlab.browser_check --no-browser-test
integration-tests:
name: Integration tests
needs: build
runs-on: ubuntu-latest
env:
PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/pw-browsers
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- name: Download extension package
uses: actions/download-artifact@v3
with:
name: extension-artifacts
- name: Install the extension
run: |
set -eux
python -m pip install "jupyterlab~=3.1" jupyterlab-sandbox-announcement*.whl
- name: Install dependencies
working-directory: ui-tests
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
run: jlpm install
- name: Set up browser cache
uses: actions/cache@v3
with:
path: |
${{ github.workspace }}/pw-browsers
key: ${{ runner.os }}-${{ hashFiles('ui-tests/yarn.lock') }}
- name: Install browser
run: jlpm playwright install chromium
working-directory: ui-tests
- name: Execute integration tests
working-directory: ui-tests
run: |
jlpm playwright test
- name: Upload Playwright Test report
if: always()
uses: actions/upload-artifact@v3
with:
name: jupyterlab-sandbox-announcement-playwright-tests
path: |
ui-tests/test-results
ui-tests/playwright-report
check_links:
name: Check Links

View File

@ -5,6 +5,10 @@ on:
pull_request:
branches: ["*"]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
check_release:
runs-on: ubuntu-latest
@ -13,9 +17,6 @@ jobs:
uses: actions/checkout@v3
- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- name: Install Dependencies
run: |
pip install -e .
- name: Check Release
uses: jupyter-server/jupyter_releaser/.github/actions/check-release@v2
with:
@ -25,5 +26,5 @@ jobs:
- name: Upload Distributions
uses: actions/upload-artifact@v3
with:
name: jupyterlab-sandbox-announcement-releaser-dist-${{ github.run_number }}
name: jupyterlab_sandbox_announcement-releaser-dist-${{ github.run_number }}
path: .jupyter_releaser_checkout/dist

13
.github/workflows/enforce-label.yml vendored Normal file
View File

@ -0,0 +1,13 @@
name: Enforce PR label
on:
pull_request:
types: [labeled, unlabeled, opened, edited, synchronize]
jobs:
enforce-label:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: enforce-triage-label
uses: jupyterlab/maintainer-tools/.github/actions/enforce-label@v1

46
.github/workflows/prep-release.yml vendored Normal file
View File

@ -0,0 +1,46 @@
name: "Step 1: Prep Release"
on:
workflow_dispatch:
inputs:
version_spec:
description: "New Version Specifier"
default: "next"
required: false
branch:
description: "The branch to target"
required: false
post_version_spec:
description: "Post Version Specifier"
required: false
# silent:
# description: "Set a placeholder in the changelog and don't publish the release."
# required: false
# type: boolean
since:
description: "Use PRs with activity since this date or git reference"
required: false
since_last_stable:
description: "Use PRs with activity since the last stable git tag"
required: false
type: boolean
jobs:
prep_release:
runs-on: ubuntu-latest
steps:
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- name: Prep Release
id: prep-release
uses: jupyter-server/jupyter_releaser/.github/actions/prep-release@v2
with:
token: ${{ secrets.ADMIN_GITHUB_TOKEN }}
version_spec: ${{ github.event.inputs.version_spec }}
post_version_spec: ${{ github.event.inputs.post_version_spec }}
branch: ${{ github.event.inputs.branch }}
# silent: ${{ github.event.inputs.silent }}
since: ${{ github.event.inputs.since }}
since_last_stable: ${{ github.event.inputs.since_last_stable }}
- name: "** Next Step **"
run: |
echo "Optional): Review Draft Release: ${{ steps.prep-release.outputs.release_url }}"

57
.github/workflows/publish-release.yml vendored Normal file
View File

@ -0,0 +1,57 @@
name: "Step 2: Publish Release"
on:
workflow_dispatch:
inputs:
branch:
description: "The target branch"
required: false
release_url:
description: "The URL of the draft GitHub release"
required: false
steps_to_skip:
description: "Comma separated list of steps to skip"
required: false
jobs:
publish_release:
runs-on: ubuntu-latest
permissions:
# This is useful if you want to use PyPI trusted publisher
# and NPM provenance
id-token: write
steps:
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- name: Populate Release
id: populate-release
uses: jupyter-server/jupyter_releaser/.github/actions/populate-release@v2
with:
token: ${{ secrets.ADMIN_GITHUB_TOKEN }}
branch: ${{ github.event.inputs.branch }}
release_url: ${{ github.event.inputs.release_url }}
steps_to_skip: ${{ github.event.inputs.steps_to_skip }}
- name: Finalize Release
id: finalize-release
env:
# The following are needed if you use legacy PyPI set up
# PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
# PYPI_TOKEN_MAP: ${{ secrets.PYPI_TOKEN_MAP }}
# TWINE_USERNAME: __token__
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
uses: jupyter-server/jupyter_releaser/.github/actions/finalize-release@v2
with:
token: ${{ secrets.ADMIN_GITHUB_TOKEN }}
release_url: ${{ steps.populate-release.outputs.release_url }}
- name: "** Next Step **"
if: ${{ success() }}
run: |
echo "Verify the final release"
echo ${{ steps.finalize-release.outputs.release_url }}
- name: "** Failure Message **"
if: ${{ failure() }}
run: |
echo "Failed to Publish the Draft Release Url:"
echo ${{ steps.populate-release.outputs.release_url }}

View File

@ -1,50 +0,0 @@
name: Update Playwright Snapshots
on:
issue_comment:
types: [created, edited]
permissions:
contents: write
pull-requests: write
jobs:
update-snapshots:
if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, 'please update playwright snapshots') }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Configure git to use https
run: git config --global hub.protocol https
- name: Checkout the branch from the PR that triggered the job
run: hub pr checkout ${{ github.event.issue.number }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- name: Install dependencies
run: python -m pip install -U jupyterlab~=3.1
- name: Install extension
run: |
set -eux
jlpm
python -m pip install .
- uses: jupyterlab/maintainer-tools/.github/actions/update-snapshots@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
# Playwright knows how to start JupyterLab server
start_server_script: 'null'
test_folder: ui-tests

11
.gitignore vendored
View File

@ -7,13 +7,9 @@ node_modules/
*.egg-info/
.ipynb_checkpoints
*.tsbuildinfo
jupyterlab-sandbox-announcement/labextension
jupyterlab_sandbox_announcement/labextension
# Version file is handled by hatchling
jupyterlab-sandbox-announcement/_version.py
# Integration tests
ui-tests/test-results/
ui-tests/playwright-report/
jupyterlab_sandbox_announcement/_version.py
# Created by https://www.gitignore.io/api/python
# Edit at https://www.gitignore.io/?templates=python
@ -120,3 +116,6 @@ dmypy.json
# OSX files
.DS_Store
# Yarn cache
.yarn/

View File

@ -3,4 +3,4 @@ node_modules
**/lib
**/package.json
!/package.json
jupyterlab-sandbox-announcement
jupyterlab_sandbox_announcement

View File

@ -1,6 +0,0 @@
{
"singleQuote": true,
"trailingComma": "none",
"arrowParens": "avoid",
"endOfLine": "auto"
}

View File

@ -1,12 +0,0 @@
{
"extends": [
"stylelint-config-recommended",
"stylelint-config-standard",
"stylelint-prettier/recommended"
],
"rules": {
"property-no-vendor-prefix": null,
"selector-no-vendor-prefix": null,
"value-no-vendor-prefix": null
}
}

View File

@ -1,9 +1,9 @@
pipeline:
steps:
build-package:
image: nikolaik/python-nodejs:python3.7-nodejs19
commands:
- apt update && apt install build-essential -y
- python -m pip install -U jupyterlab~=3.5.2 build twine
- python -m build -s
- python -m twine upload dist/* --repository-url=$TWINE_REPOSITORY_URL
secrets: [ TWINE_USERNAME, TWINE_PASSWORD, TWINE_REPOSITORY, TWINE_REPOSITORY_URL]
image: nikolaik/python-nodejs:python3.7-nodejs19
commands:
- apt update && apt install build-essential -y
- python -m pip install -U jupyterlab~=4.0.12 build twine
- python -m build -s
- python -m twine upload dist/* --repository-url=$TWINE_REPOSITORY_URL
secrets: [ TWINE_USERNAME, TWINE_PASSWORD, TWINE_REPOSITORY, TWINE_REPOSITORY_URL]

1
.yarnrc.yml Normal file
View File

@ -0,0 +1 @@
nodeLinker: node-modules

View File

@ -1,6 +1,6 @@
BSD 3-Clause License
Copyright (c) 2023, Malte Grosse
Copyright (c) 2024, jupyterlab-sandbox-announcement
All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@ -1,18 +1,18 @@
# jupyterlab-sandbox-announcement
# jupyterlab_sandbox_announcement
[![Github Actions Status](https://git.sandbox.iuk.hdm-stuttgart.de/grosse/jupyterlab-sandbox-announcement/workflows/Build/badge.svg)](https://git.sandbox.iuk.hdm-stuttgart.de/grosse/jupyterlab-sandbox-announcement/actions/workflows/build.yml)
Sandbox announcements for Jupyterlab
A Jupyterlab Sandbox customization
## Requirements
- JupyterLab >= 3.0
- JupyterLab >= 4.0.0
## Install
To install the extension, execute:
```bash
pip install jupyterlab-sandbox-announcement
pip install jupyterlab_sandbox_announcement
```
## Uninstall
@ -20,7 +20,7 @@ pip install jupyterlab-sandbox-announcement
To remove the extension, execute:
```bash
pip uninstall jupyterlab-sandbox-announcement
pip uninstall jupyterlab_sandbox_announcement
```
## Contributing
@ -35,7 +35,7 @@ The `jlpm` command is JupyterLab's pinned version of
```bash
# Clone the repo to your local environment
# Change directory to the jupyterlab-sandbox-announcement directory
# Change directory to the jupyterlab_sandbox_announcement directory
# Install package in development mode
pip install -e "."
# Link your development version of the extension with JupyterLab
@ -64,33 +64,13 @@ jupyter lab build --minimize=False
### Development uninstall
```bash
pip uninstall jupyterlab-sandbox-announcement
pip uninstall jupyterlab_sandbox_announcement
```
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-sandbox-announcement` within that folder.
### Testing the extension
#### Frontend tests
This extension is using [Jest](https://jestjs.io/) for JavaScript code testing.
To execute them, execute:
```sh
jlpm
jlpm test
```
#### Integration tests
This extension uses [Playwright](https://playwright.dev/docs/intro/) for the integration tests (aka user level tests).
More precisely, the JupyterLab helper [Galata](https://github.com/jupyterlab/jupyterlab/tree/master/galata) is used to handle testing the extension in JupyterLab.
More information are provided within the [ui-tests](./ui-tests/README.md) README.
### Packaging the extension
See [RELEASE](RELEASE.md)

View File

@ -1,4 +1,4 @@
# Making a new release of jupyterlab-sandbox-announcement
# Making a new release of jupyterlab_sandbox_announcement
The extension can be published to `PyPI` and `npm` manually or using the [Jupyter Releaser](https://github.com/jupyter-server/jupyter_releaser).
@ -6,10 +6,9 @@ The extension can be published to `PyPI` and `npm` manually or using the [Jupyte
### Python package
This extension can be distributed as Python
packages. All of the Python
packaging instructions in the `pyproject.toml` file to wrap your extension in a
Python package. Before generating a package, we first need to install `build`.
This extension can be distributed as Python packages. All of the Python
packaging instructions are in the `pyproject.toml` file to wrap your extension in a
Python package. Before generating a package, you first need to install some tools:
```bash
pip install build twine hatch
@ -22,6 +21,18 @@ See the docs on [hatch-nodejs-version](https://github.com/agoose77/hatch-nodejs-
hatch version <new-version>
```
Make sure to clean up all the development files before building the package:
```bash
jlpm clean:all
```
You could also clean up the local git repository:
```bash
git clean -dfX
```
To create a Python source package (`.tar.gz`) and the binary package (`.whl`) in the `dist/` directory, do:
```bash
@ -49,17 +60,49 @@ npm publish --access public
The extension repository should already be compatible with the Jupyter Releaser.
Check out the [workflow documentation](https://github.com/jupyter-server/jupyter_releaser#typical-workflow) for more information.
Check out the [workflow documentation](https://jupyter-releaser.readthedocs.io/en/latest/get_started/making_release_from_repo.html) for more information.
Here is a summary of the steps to cut a new release:
- Fork the [`jupyter-releaser` repo](https://github.com/jupyter-server/jupyter_releaser)
- Add `ADMIN_GITHUB_TOKEN`, `PYPI_TOKEN` and `NPM_TOKEN` to the Github Secrets in the fork
- Add tokens to the [Github Secrets](https://docs.github.com/en/actions/security-guides/encrypted-secrets) in the repository:
- `ADMIN_GITHUB_TOKEN` (with "public_repo" and "repo:status" permissions); see the [documentation](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token)
- `NPM_TOKEN` (with "automation" permission); see the [documentation](https://docs.npmjs.com/creating-and-viewing-access-tokens)
- Set up PyPI
<details><summary>Using PyPI trusted publisher (modern way)</summary>
- Set up your PyPI project by [adding a trusted publisher](https://docs.pypi.org/trusted-publishers/adding-a-publisher/)
- The _workflow name_ is `publish-release.yml` and the _environment_ should be left blank.
- Ensure the publish release job as `permissions`: `id-token : write` (see the [documentation](https://docs.pypi.org/trusted-publishers/using-a-publisher/))
</details>
<details><summary>Using PyPI token (legacy way)</summary>
- If the repo generates PyPI release(s), create a scoped PyPI [token](https://packaging.python.org/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/#saving-credentials-on-github). We recommend using a scoped token for security reasons.
- You can store the token as `PYPI_TOKEN` in your fork's `Secrets`.
- Advanced usage: if you are releasing multiple repos, you can create a secret named `PYPI_TOKEN_MAP` instead of `PYPI_TOKEN` that is formatted as follows:
```text
owner1/repo1,token1
owner2/repo2,token2
```
If you have multiple Python packages in the same repository, you can point to them as follows:
```text
owner1/repo1/path/to/package1,token1
owner1/repo1/path/to/package2,token2
```
</details>
- Go to the Actions panel
- Run the "Draft Changelog" workflow
- Merge the Changelog PR
- Run the "Draft Release" workflow
- Run the "Publish Release" workflow
- Run the "Step 1: Prep Release" workflow
- Check the draft changelog
- Run the "Step 2: Publish Release" workflow
## Publishing to `conda-forge`

View File

@ -1 +0,0 @@
module.exports = require('@jupyterlab/testutils/lib/babel.config');

View File

@ -1,5 +1,5 @@
{
"packageManager": "python",
"packageName": "jupyterlab-sandbox-announcement",
"uninstallInstructions": "Use your Python package manager (pip, conda, etc.) to uninstall the package jupyterlab-sandbox-announcement"
"packageName": "jupyterlab_sandbox_announcement",
"uninstallInstructions": "Use your Python package manager (pip, conda, etc.) to uninstall the package jupyterlab_sandbox_announcement"
}

View File

@ -1,46 +0,0 @@
const jestJupyterLab = require('@jupyterlab/testutils/lib/jest-config');
const esModules = [
'@jupyterlab/',
'lib0',
'y\\-protocols',
'y\\-websocket',
'yjs'
].join('|');
const jlabConfig = jestJupyterLab(__dirname);
const {
moduleFileExtensions,
moduleNameMapper,
preset,
setupFilesAfterEnv,
setupFiles,
testPathIgnorePatterns,
transform
} = jlabConfig;
module.exports = {
moduleFileExtensions,
moduleNameMapper,
preset,
setupFilesAfterEnv,
setupFiles,
testPathIgnorePatterns,
transform,
automock: false,
collectCoverageFrom: [
'src/**/*.{ts,tsx}',
'!src/**/*.d.ts',
'!src/**/.ipynb_checkpoints/*'
],
coverageDirectory: 'coverage',
coverageReporters: ['lcov', 'text'],
globals: {
'ts-jest': {
tsconfig: 'tsconfig.json'
}
},
testRegex: 'src/.*/.*.spec.ts[x]?$',
transformIgnorePatterns: [`/node_modules/(?!${esModules}).+`]
};

View File

@ -1,9 +0,0 @@
from ._version import __version__
def _jupyter_labextension_paths():
return [{
"src": "labextension",
"dest": "jupyterlab-sandbox-announcement"
}]

View File

@ -0,0 +1,16 @@
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_sandbox_announcement' outside a proper installation.")
__version__ = "dev"
def _jupyter_labextension_paths():
return [{
"src": "labextension",
"dest": "jupyterlab-sandbox-announcement"
}]

View File

@ -1,95 +1,187 @@
{
"name": "jupyterlab-sandbox-announcement",
"version": "0.1.1",
"description": "Sandbox announcements for Jupyterlab",
"keywords": [
"jupyter",
"jupyterlab",
"jupyterlab-extension"
],
"homepage": "https://git.sandbox.iuk.hdm-stuttgart.de/grosse/jupyterlab-sandbox-announcement",
"bugs": {
"url": "https://git.sandbox.iuk.hdm-stuttgart.de/grosse/jupyterlab-sandbox-announcement/issues"
},
"license": "BSD-3-Clause",
"author": {
"name": "Malte Grosse",
"email": "grosse@hdm-stuttgart.de"
},
"files": [
"lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf}",
"style/**/*.{css,js,eot,gif,html,jpg,json,png,svg,woff2,ttf}"
],
"main": "lib/index.js",
"types": "lib/index.d.ts",
"style": "style/index.css",
"repository": {
"type": "git",
"url": "https://git.sandbox.iuk.hdm-stuttgart.de/grosse/jupyterlab-sandbox-announcement.git"
},
"scripts": {
"build": "jlpm build:lib && jlpm build:labextension:dev",
"build:prod": "jlpm clean && jlpm build:lib:prod && jlpm build:labextension",
"build:labextension": "jupyter labextension build .",
"build:labextension:dev": "jupyter labextension build --development True .",
"build:lib": "tsc --sourceMap",
"build:lib:prod": "tsc",
"clean": "jlpm clean:lib",
"clean:lib": "rimraf lib tsconfig.tsbuildinfo",
"clean:lintcache": "rimraf .eslintcache .stylelintcache",
"clean:labextension": "rimraf jupyterlab-sandbox-announcement/labextension jupyterlab-sandbox-announcement/_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",
"install:extension": "jlpm build",
"lint": "jlpm stylelint && jlpm prettier && jlpm eslint",
"lint:check": "jlpm stylelint:check && jlpm prettier:check && jlpm eslint:check",
"prettier": "jlpm prettier:base --write --list-different",
"prettier:base": "prettier \"**/*{.ts,.tsx,.js,.jsx,.css,.json,.md}\"",
"prettier:check": "jlpm prettier:base --check",
"stylelint": "jlpm stylelint:check --fix",
"stylelint:check": "stylelint --cache \"style/**/*.css\"",
"test": "jest --coverage",
"watch": "run-p watch:src watch:labextension",
"watch:src": "tsc -w",
"watch:labextension": "jupyter labextension watch ."
},
"dependencies": {
"@jupyterlab/application": "^3.1.0"
},
"devDependencies": {
"@babel/core": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@jupyterlab/builder": "^3.1.0",
"@jupyterlab/testutils": "^3.0.0",
"@types/jest": "^26.0.0",
"@typescript-eslint/eslint-plugin": "^4.8.1",
"@typescript-eslint/parser": "^4.8.1",
"eslint": "^7.14.0",
"eslint-config-prettier": "^6.15.0",
"eslint-plugin-prettier": "^3.1.4",
"jest": "^26.0.0",
"npm-run-all": "^4.1.5",
"prettier": "^2.1.1",
"rimraf": "^3.0.2",
"stylelint": "^14.3.0",
"stylelint-config-prettier": "^9.0.4",
"stylelint-config-recommended": "^6.0.0",
"stylelint-config-standard": "~24.0.0",
"stylelint-prettier": "^2.0.0",
"typescript": "~4.1.3",
"ts-jest": "^26.0.0"
},
"sideEffects": [
"style/*.css",
"style/index.js"
],
"styleModule": "style/index.js",
"publishConfig": {
"access": "public"
},
"jupyterlab": {
"extension": true,
"outputDir": "jupyterlab-sandbox-announcement/labextension"
}
"name": "jupyterlab-sandbox-announcement",
"version": "0.1.2",
"description": "A Jupyterlab Sandbox customization",
"keywords": [
"jupyter",
"jupyterlab",
"jupyterlab-extension"
],
"homepage": "https://git.sandbox.iuk.hdm-stuttgart.de/grosse/jupyterlab-sandbox-announcement",
"bugs": {
"url": "https://git.sandbox.iuk.hdm-stuttgart.de/grosse/jupyterlab-sandbox-announcement/issues"
},
"license": "BSD-3-Clause",
"author": {
"name": "jupyterlab-sandbox-announcement",
"email": "grosse@hdm-stuttgart.de"
},
"files": [
"lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf}",
"style/**/*.{css,js,eot,gif,html,jpg,json,png,svg,woff2,ttf}",
"src/**/*.{ts,tsx}"
],
"main": "lib/index.js",
"types": "lib/index.d.ts",
"style": "style/index.css",
"repository": {
"type": "git",
"url": "https://git.sandbox.iuk.hdm-stuttgart.de/grosse/jupyterlab-sandbox-announcement.git"
},
"scripts": {
"build": "jlpm build:lib && jlpm build:labextension:dev",
"build:prod": "jlpm clean && jlpm build:lib:prod && jlpm build:labextension",
"build:labextension": "jupyter labextension build .",
"build:labextension:dev": "jupyter labextension build --development True .",
"build:lib": "tsc --sourceMap",
"build:lib:prod": "tsc",
"clean": "jlpm clean:lib",
"clean:lib": "rimraf lib tsconfig.tsbuildinfo",
"clean:lintcache": "rimraf .eslintcache .stylelintcache",
"clean:labextension": "rimraf jupyterlab_sandbox_announcement/labextension jupyterlab_sandbox_announcement/_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",
"install:extension": "jlpm build",
"lint": "jlpm stylelint && jlpm prettier && jlpm eslint",
"lint:check": "jlpm stylelint:check && jlpm prettier:check && jlpm eslint:check",
"prettier": "jlpm prettier:base --write --list-different",
"prettier:base": "prettier \"**/*{.ts,.tsx,.js,.jsx,.css,.json,.md}\"",
"prettier:check": "jlpm prettier:base --check",
"stylelint": "jlpm stylelint:check --fix",
"stylelint:check": "stylelint --cache \"style/**/*.css\"",
"watch": "run-p watch:src watch:labextension",
"watch:src": "tsc -w --sourceMap",
"watch:labextension": "jupyter labextension watch ."
},
"dependencies": {
"@jupyterlab/application": "^4.0.0"
},
"devDependencies": {
"@jupyterlab/builder": "^4.0.0",
"@types/json-schema": "^7.0.11",
"@types/react": "^18.0.26",
"@types/react-addons-linked-state-mixin": "^0.14.22",
"@typescript-eslint/eslint-plugin": "^6.1.0",
"@typescript-eslint/parser": "^6.1.0",
"css-loader": "^6.7.1",
"eslint": "^8.36.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-prettier": "^5.0.0",
"npm-run-all": "^4.1.5",
"prettier": "^3.0.0",
"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",
"typescript": "~5.0.2",
"yjs": "^13.5.0"
},
"sideEffects": [
"style/*.css",
"style/index.js"
],
"styleModule": "style/index.js",
"publishConfig": {
"access": "public"
},
"jupyterlab": {
"extension": true,
"outputDir": "jupyterlab_sandbox_announcement/labextension"
},
"eslintIgnore": [
"node_modules",
"dist",
"coverage",
"**/*.d.ts"
],
"eslintConfig": {
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "tsconfig.json",
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
"@typescript-eslint/naming-convention": [
"error",
{
"selector": "interface",
"format": [
"PascalCase"
],
"custom": {
"regex": "^I[A-Z]",
"match": true
}
}
],
"@typescript-eslint/no-unused-vars": [
"warn",
{
"args": "none"
}
],
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-namespace": "off",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/quotes": [
"error",
"single",
{
"avoidEscape": true,
"allowTemplateLiterals": false
}
],
"curly": [
"error",
"all"
],
"eqeqeq": "error",
"prefer-arrow-callback": "error"
}
},
"prettier": {
"singleQuote": true,
"trailingComma": "none",
"arrowParens": "avoid",
"endOfLine": "auto",
"overrides": [
{
"files": "package.json",
"options": {
"tabWidth": 4
}
}
]
},
"stylelint": {
"extends": [
"stylelint-config-recommended",
"stylelint-config-standard",
"stylelint-prettier/recommended"
],
"plugins": [
"stylelint-csstree-validator"
],
"rules": {
"csstree/validator": true,
"property-no-vendor-prefix": null,
"selector-class-pattern": "^([a-z][A-z\\d]*)(-[A-z\\d]+)*$",
"selector-no-vendor-prefix": null,
"value-no-vendor-prefix": null
}
}
}

View File

@ -1,26 +1,26 @@
[build-system]
requires = ["hatchling>=1.4.0", "jupyterlab>=3.4.7,<4.0.0", "hatch-nodejs-version"]
requires = ["hatchling>=1.5.0", "jupyterlab>=4.0.0,<5", "hatch-nodejs-version>=0.3.2"]
build-backend = "hatchling.build"
[project]
name = "jupyterlab-sandbox-announcement"
name = "jupyterlab_sandbox_announcement"
readme = "README.md"
license = { file = "LICENSE" }
requires-python = ">=3.7"
requires-python = ">=3.8"
classifiers = [
"Framework :: Jupyter",
"Framework :: Jupyter :: JupyterLab",
"Framework :: Jupyter :: JupyterLab :: 3",
"Framework :: Jupyter :: JupyterLab :: 4",
"Framework :: Jupyter :: JupyterLab :: Extensions",
"Framework :: Jupyter :: JupyterLab :: Extensions :: Prebuilt",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
dependencies = [
]
@ -33,24 +33,24 @@ source = "nodejs"
fields = ["description", "authors", "urls"]
[tool.hatch.build.targets.sdist]
artifacts = ["jupyterlab-sandbox-announcement/labextension"]
artifacts = ["jupyterlab_sandbox_announcement/labextension"]
exclude = [".github", "binder"]
[tool.hatch.build.targets.wheel.shared-data]
"jupyterlab-sandbox-announcement/labextension" = "share/jupyter/labextensions/jupyterlab-sandbox-announcement"
"jupyterlab_sandbox_announcement/labextension" = "share/jupyter/labextensions/jupyterlab-sandbox-announcement"
"install.json" = "share/jupyter/labextensions/jupyterlab-sandbox-announcement/install.json"
[tool.hatch.build.hooks.version]
path = "jupyterlab-sandbox-announcement/_version.py"
path = "jupyterlab_sandbox_announcement/_version.py"
[tool.hatch.build.hooks.jupyter-builder]
dependencies = ["hatch-jupyter-builder>=0.5"]
build-function = "hatch_jupyter_builder.npm_builder"
ensured-targets = [
"jupyterlab-sandbox-announcement/labextension/static/style.js",
"jupyterlab-sandbox-announcement/labextension/package.json",
"jupyterlab_sandbox_announcement/labextension/static/style.js",
"jupyterlab_sandbox_announcement/labextension/package.json",
]
skip-if-exists = ["jupyterlab-sandbox-announcement/labextension/static/style.js"]
skip-if-exists = ["jupyterlab_sandbox_announcement/labextension/static/style.js"]
[tool.hatch.build.hooks.jupyter-builder.build-kwargs]
build_cmd = "build:prod"
@ -60,13 +60,17 @@ npm = ["jlpm"]
build_cmd = "install:extension"
npm = ["jlpm"]
source_dir = "src"
build_dir = "jupyterlab-sandbox-announcement/labextension"
build_dir = "jupyterlab_sandbox_announcement/labextension"
[tool.jupyter-releaser.options]
version_cmd = "hatch version"
[tool.jupyter-releaser.hooks]
before-build-npm = ["python -m pip install jupyterlab~=3.1", "jlpm", "jlpm build:prod"]
before-build-npm = [
"python -m pip install 'jupyterlab>=4.0.0,<5'",
"jlpm",
"jlpm build:prod"
]
before-build-python = ["jlpm clean:all"]
[tool.check-wheel-contents]

View File

@ -1 +1 @@
__import__('setuptools').setup()
__import__("setuptools").setup()

View File

@ -1,9 +0,0 @@
/**
* Example of [Jest](https://jestjs.io/docs/getting-started) unit tests
*/
describe('jupyterlab-sandbox-announcement', () => {
it('should be tested', () => {
expect(1 + 1).toEqual(2);
});
});

View File

@ -1,16 +1,10 @@
import {
JupyterFrontEnd,
JupyterFrontEndPlugin,
JupyterFrontEndPlugin
} from '@jupyterlab/application';
import { ICommandPalette } from '@jupyterlab/apputils';
import { Widget } from '@lumino/widgets';
import { MainAreaWidget } from '@jupyterlab/apputils';
import { LogoAnnounce} from './images';
/**
* Generate whatever content to render in `contentHeader`
*
* @returns string
*/
import { MainAreaWidget } from '@jupyterlab/apputils';
function generateContent(): string {
return 'Welcome to Sandbox Playground';
}
@ -30,16 +24,15 @@ function createNode(): HTMLElement {
node.appendChild(content);
return node;
}
/**
* Initialization data for the contentheader extension.
* Initialization data for the jupyterlab-sandbox-announcement extension.
*/
const plugin: JupyterFrontEndPlugin<void> = {
id: 'jupyterlab-sandbox-announcement:plugin',
description: 'A Jupyterlab Sandbox customization',
autoStart: true,
optional: [ICommandPalette],
activate: (app: JupyterFrontEnd, pal?: ICommandPalette) => {
activate: (app: JupyterFrontEnd) => {
console.log('JupyterLab extension jupyterlab-sandbox-announcement is activated!');
const widget = new Widget();
widget.id = "sandbox-announce"
widget.addClass('sandbox-announcement-contentheader-widget');
@ -48,6 +41,10 @@ const plugin: JupyterFrontEndPlugin<void> = {
widget.node.appendChild(createNode())
setInterval(() => {
const main = app.shell.currentWidget;
if (main !=null){
console.log(main);
}
if (main instanceof MainAreaWidget) {
// if (main.title.label == 'Launcher'){
@ -62,15 +59,15 @@ const plugin: JupyterFrontEndPlugin<void> = {
}
});
if (add){
console.log("add")
main.contentHeader.addWidget(widget);
}
}
}, 200);
},
}
};
export default plugin;
export default plugin;

View File

@ -1,4 +1,3 @@
.sandbox-announcement-contentheader-widget {
margin-left: 0.5rem;
margin-top: 0.5rem;

View File

@ -17,8 +17,7 @@
"rootDir": "src",
"strict": true,
"strictNullChecks": true,
"target": "ES2018",
"types": ["jest"]
"target": "ES2018"
},
"include": ["src/*"]
}

View File

@ -1,148 +0,0 @@
# Integration Testing
This folder contains the integration tests of the extension.
They are defined using [Playwright](https://playwright.dev/docs/intro) test runner
and [Galata](https://github.com/jupyterlab/jupyterlab/tree/master/galata) helper.
The Playwright configuration is defined in [playwright.config.js](./playwright.config.js).
The JupyterLab server configuration to use for the integration test is defined
in [jupyter_server_test_config.py](./jupyter_server_test_config.py).
The default configuration will produce video for failing tests and an HTML report.
## Run the tests
> All commands are assumed to be executed from the root directory
To run the tests, you need to:
1. Compile the extension:
```sh
jlpm install
jlpm build:prod
```
> Check the extension is installed in JupyterLab.
2. Install test dependencies (needed only once):
```sh
cd ./ui-tests
jlpm install
jlpm playwright install
cd ..
```
3. Execute the [Playwright](https://playwright.dev/docs/intro) tests:
```sh
cd ./ui-tests
jlpm playwright test
```
Test results will be shown in the terminal. In case of any test failures, the test report
will be opened in your browser at the end of the tests execution; see
[Playwright documentation](https://playwright.dev/docs/test-reporters#html-reporter)
for configuring that behavior.
## Update the tests snapshots
> All commands are assumed to be executed from the root directory
If you are comparing snapshots to validate your tests, you may need to update
the reference snapshots stored in the repository. To do that, you need to:
1. Compile the extension:
```sh
jlpm install
jlpm build:prod
```
> Check the extension is installed in JupyterLab.
2. Install test dependencies (needed only once):
```sh
cd ./ui-tests
jlpm install
jlpm playwright install
cd ..
```
3. Execute the [Playwright](https://playwright.dev/docs/intro) command:
```sh
cd ./ui-tests
jlpm playwright test -u
```
> Some discrepancy may occurs between the snapshots generated on your computer and
> the one generated on the CI. To ease updating the snapshots on a PR, you can
> type `please update playwright snapshots` to trigger the update by a bot on the CI.
> Once the bot has computed new snapshots, it will commit them to the PR branch.
## Create tests
> All commands are assumed to be executed from the root directory
To create tests, the easiest way is to use the code generator tool of playwright:
1. Compile the extension:
```sh
jlpm install
jlpm build:prod
```
> Check the extension is installed in JupyterLab.
2. Install test dependencies (needed only once):
```sh
cd ./ui-tests
jlpm install
jlpm playwright install
cd ..
```
3. Execute the [Playwright code generator](https://playwright.dev/docs/codegen):
```sh
cd ./ui-tests
jlpm playwright codegen localhost:8888
```
## Debug tests
> All commands are assumed to be executed from the root directory
To debug tests, a good way is to use the inspector tool of playwright:
1. Compile the extension:
```sh
jlpm install
jlpm build:prod
```
> Check the extension is installed in JupyterLab.
2. Install test dependencies (needed only once):
```sh
cd ./ui-tests
jlpm install
jlpm playwright install
cd ..
```
3. Execute the Playwright tests in [debug mode](https://playwright.dev/docs/debug):
```sh
cd ./ui-tests
PWDEBUG=1 jlpm playwright test
```

View File

@ -1,20 +0,0 @@
"""Server configuration for integration tests.
!! Never use this configuration in production because it
opens the server to the world and provide access to JupyterLab
JavaScript objects through the global window variable.
"""
from tempfile import mkdtemp
c.ServerApp.port = 8888
c.ServerApp.port_retries = 0
c.ServerApp.open_browser = False
c.ServerApp.root_dir = mkdtemp(prefix='galata-test-')
c.ServerApp.token = ""
c.ServerApp.password = ""
c.ServerApp.disable_check_xsrf = True
c.LabApp.expose_app_in_browser = True
# Uncomment to set server log level to debug level
# c.ServerApp.log_level = "DEBUG"

View File

@ -1,14 +0,0 @@
{
"name": "jupyterlab-sandbox-announcement-ui-tests",
"version": "1.0.0",
"description": "JupyterLab jupyterlab-sandbox-announcement Integration Tests",
"private": true,
"scripts": {
"start": "jupyter lab --config jupyter_server_test_config.py",
"test": "jlpm playwright test",
"test:update": "jlpm playwright test --update-snapshots"
},
"devDependencies": {
"@jupyterlab/galata": "^4.3.0"
}
}

View File

@ -1,14 +0,0 @@
/**
* Configuration for Playwright using default from @jupyterlab/galata
*/
const baseConfig = require('@jupyterlab/galata/lib/playwright-config');
module.exports = {
...baseConfig,
webServer: {
command: 'jlpm start',
url: 'http://localhost:8888/lab',
timeout: 120 * 1000,
reuseExistingServer: !process.env.CI
}
};

View File

@ -1,21 +0,0 @@
import { expect, test } from '@jupyterlab/galata';
/**
* Don't load JupyterLab webpage before running the tests.
* This is required to ensure we capture all log messages.
*/
test.use({ autoGoto: false });
test('should emit an activation console message', async ({ page }) => {
const logs: string[] = [];
page.on('console', message => {
logs.push(message.text());
});
await page.goto();
expect(
logs.filter(s => s === 'JupyterLab extension jupyterlab-sandbox-announcement is activated!')
).toHaveLength(1);
});

13861
yarn.lock

File diff suppressed because it is too large Load Diff