Skip to content
This repository was archived by the owner on Feb 3, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,16 @@ module.exports = {
},
plugins: ['@typescript-eslint'],
rules: {
'@typescript-eslint/interface-name-prefix': [
'@typescript-eslint/naming-convention': [
'error',
{ prefixWithI: 'always' }
{
'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',
Expand Down
82 changes: 69 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Build

on:
push:
branches: [ main ]
branches: main
pull_request:
branches: '*'

Expand All @@ -19,21 +19,77 @@ jobs:
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: '3.7'
python-version: '3.8'
architecture: 'x64'

- name: Setup pip cache
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: pip-3.8-${{ hashFiles('package.json') }}
restore-keys: |
pip-3.8-
pip-

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Setup yarn cache
uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
yarn-

- name: Install dependencies
run: python -m pip install -U jupyterlab~=3.0 check-manifest jupyter-packaging~=0.10
- name: Build the extension
run: |
python -m pip install --upgrade pip
python -m pip install jupyter_packaging
python -m pip install --pre jupyterlab
- name: Install the extension
run: |
set -eux
jlpm
jlpm run eslint:check
python -m pip install .
jupyter labextension develop . --overwrite
jupyter labextension list 2>&1 | grep -ie "jupyterlab-python-file.*enabled.*ok" -

jupyter labextension list 2>&1 | grep -ie "jupyterlab-python-file.*OK"
python -m jupyterlab.browser_check
- name: Lint

check-manifest -v

pip install build
python -m build --sdist
cp dist/*.tar.gz myextension.tar.gz
pip uninstall -y myextension jupyterlab
rm -rf myextension

- uses: actions/upload-artifact@v2
with:
name: myextension-sdist
path: myextension.tar.gz

test_isolated:
needs: build
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
architecture: 'x64'
- uses: actions/download-artifact@v2
with:
name: myextension-sdist
- name: Install and Test
run: |
jlpm
jlpm run eslint:check
jlpm run prettier:check
set -eux
# Remove NodeJS, twice to take care of system and locally installed node versions.
sudo rm -rf $(which node)
sudo rm -rf $(which node)
pip install myextension.tar.gz
pip install jupyterlab
jupyter labextension list 2>&1 | grep -ie "jupyterlab-python-file.*OK"
python -m jupyterlab.browser_check --no-chrome-test
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ node_modules/
*.egg-info/
.ipynb_checkpoints
*.tsbuildinfo
jupyterlab-python-file/static
jupyterlab-python-file/labextension

# Created by https://www.gitignore.io/api/python
# Edit at https://www.gitignore.io/?templates=python
Expand Down Expand Up @@ -107,3 +107,6 @@ dmypy.json
.pyre/

# End of https://www.gitignore.io/api/python

# OSX files
.DS_Store
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ node_modules
**/node_modules
**/lib
**/package.json
**/static/
jupyterlab-python-file
4 changes: 3 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{
"singleQuote": true
"singleQuote": true,
"trailingComma": "none",
"arrowParens": "avoid"
}
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Changelog

<!-- <START NEW CHANGELOG ENTRY> -->

## 0.5.2

- Add `install.json` to provide more information about the extension: https://github.com/jtpio/jupyterlab-python-file/pull/27

```bash
$ jupyter labextension list
JupyterLab v3.0.0rc13
/home/username/miniforge3/envs/jupyterlab-python-file/share/jupyter/labextensions
jupyterlab-python-file v0.5.1 enabled OK (python, jupyterlab-python-file)
```

<!-- <END NEW CHANGELOG ENTRY> -->
10 changes: 7 additions & 3 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
include LICENSE
include README.md
include pyproject.toml
include jupyter-config/jupyterlab-python-file.json
recursive-include jupyter-config *.json
recursive-include doc *.png

include install.json
include package.json
include install.json
include ts*.json
include yarn.lock
include *.md

graft jupyterlab-python-file/static
graft jupyterlab-python-file/labextension

# Javascript files
graft src
graft style
prune **/node_modules
prune lib
prune binder

# Patterns to exclude from any directory
global-exclude *~
Expand Down
14 changes: 7 additions & 7 deletions jupyterlab-python-file/__init__.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@

import json
import os.path as osp
from pathlib import Path

HERE = osp.abspath(osp.dirname(__file__))
from ._version import __version__

with open(osp.join(HERE, 'static', 'package.json')) as fid:
HERE = Path(__file__).parent.resolve()

with (HERE / "labextension" / "package.json").open() as fid:
data = json.load(fid)

def _jupyter_labextension_paths():
return [{
'src': 'static',
'dest': data['name']
"src": "labextension",
"dest": data["name"]
}]



18 changes: 18 additions & 0 deletions jupyterlab-python-file/_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import json
from pathlib import Path

__all__ = ["__version__"]

def _fetchVersion():
HERE = Path(__file__).parent.resolve()

for settings in HERE.rglob("package.json"):
try:
with settings.open() as f:
return json.load(f)["version"]
except FileNotFoundError:
pass

raise FileNotFoundError(f"Could not find package.json under dir {HERE!s}")

__version__ = _fetchVersion()
44 changes: 25 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@
"url": "https://github.com/jtpio/jupyterlab-python-file/issues"
},
"license": "BSD-3-Clause",
"author": "Jeremy Tuloup",
"author": {
"name": "Jeremy Tuloup",
"email": ""
},
"files": [
"lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf}",
"style/**/*.{css,eot,gif,html,jpg,json,png,svg,woff2,ttf}"
"style/**/*.{css,eot,gif,html,jpg,json,png,svg,woff2,ttf}",
"style/index.js"
],
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand All @@ -24,17 +28,18 @@
"url": "https://github.com/jtpio/jupyterlab-python-file.git"
},
"scripts": {
"build": "jlpm run build:lib && jlpm run build:labextension",
"build": "jlpm run build:lib && jlpm run build:labextension:dev",
"build:labextension": "jupyter labextension build .",
"build:labextension:dev": "jupyter labextension build --development True .",
"build:lib": "tsc",
"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/static",
"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",
"install:extension": "jupyter labextension develop --overwrite .",
"install:extension": "jlpm run build",
"prepare": "jlpm run clean && jlpm run build",
"prettier": "prettier --write '**/*{.ts,.tsx,.js,.jsx,.css,.json,.md}'",
"prettier:check": "prettier --list-different '**/*{.ts,.tsx,.js,.jsx,.css,.json,.md}'",
Expand All @@ -43,25 +48,26 @@
"watch:src": "tsc -w"
},
"dependencies": {
"@jupyterlab/application": "^3.0.0-rc.0",
"@jupyterlab/filebrowser": "^3.0.0-rc.0",
"@jupyterlab/launcher": "^3.0.0-rc.0",
"@jupyterlab/mainmenu": "^3.0.0-rc.0"
"@jupyterlab/application": "^3.0.11",
"@jupyterlab/filebrowser": "^3.0.11",
"@jupyterlab/launcher": "^3.0.9",
"@jupyterlab/mainmenu": "^3.0.9"
},
"devDependencies": {
"@jupyterlab/builder": "^3.0.0-rc.0",
"@typescript-eslint/eslint-plugin": "^2.27.0",
"@typescript-eslint/parser": "^2.27.0",
"eslint": "^7.5.0",
"eslint-config-prettier": "^6.10.1",
"eslint-plugin-prettier": "^3.1.2",
"@jupyterlab/builder": "^3.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",
"npm-run-all": "^4.1.5",
"prettier": "^1.19.0",
"prettier": "^2.1.1",
"rimraf": "^3.0.2",
"typescript": "^3.9.0"
"typescript": "~4.3.0"
},
"jupyterlab": {
"extension": true,
"outputDir": "jupyterlab-python-file/static"
}
"outputDir": "jupyterlab-python-file/labextension"
},
"styleModule": "style/index.js"
}
18 changes: 16 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
[build-system]
requires = ["jupyter_packaging~=0.7.0", "jupyterlab>=3.0.0rc0,==3.*", "setuptools>=40.8.0", "wheel"]
build-backend = "setuptools.build_meta"
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"]

[tool.jupyter-packaging.builder]
factory = "jupyter_packaging.npm_builder"

[tool.jupyter-packaging.build-args]
build_cmd = "build:prod"
npm = ["jlpm"]

[tool.check-manifest]
ignore = ["jupyterlab-python-file/labextension/**", "yarn.lock", ".*", "package-lock.json"]
Loading