Skip to content
Closed
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
24 changes: 24 additions & 0 deletions SwanFileBrowser/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
include README.md
include pyproject.toml

include package.json
include install.json
include ts*.json
include yarn.lock
include typedoc.json
graft swanfilebrowser/labextension

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

# Patterns to exclude from any directory
global-exclude *~
global-exclude *.pyc
global-exclude *.pyo
global-exclude .git
global-exclude .ipynb_checkpoints
3 changes: 3 additions & 0 deletions SwanFileBrowser/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# @swan/filebrowser-extension

An extension for JupyterLab which provides an entry point, commands, and keyboard shortcuts for the filebrowser.
5 changes: 5 additions & 0 deletions SwanFileBrowser/install.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"packageManager": "python",
"packageName": "swanfilebrowser",
"uninstallInstructions": "Use your Python package manager (pip, conda, etc.) to uninstall the package swanfilebrowser"
}
95 changes: 95 additions & 0 deletions SwanFileBrowser/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
{
"name": "@swan/filebrowser-extension",
"version": "0.1.0",
"description": "JupyterLab - SWAN Filebrowser Widget Extension",
"homepage": "https://github.com/swan-cern/jupyter-extensions",
"bugs": {
"url": "https://github.com/swan-cern/jupyter-extensions/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/swan-cern/jupyter-extensions.git"
},
"license": "AGPL-3.0",
"author": "SWAN Team",
"files": [
"lib/*.d.ts",
"lib/*.js.map",
"lib/*.js",
"src/*.ts",
"schema/*.json",
"style/**/*.css",
"style/index.js"
],
"sideEffects": [
"style/**/*.css",
"style/index.js"
],
"main": "lib/index.js",
"types": "lib/index.d.ts",
"style": "style/index.css",
"directories": {
"lib": "lib/"
},
"scripts": {
"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 swanfilebrowser/labextension",
"clean:lib": "rimraf lib tsconfig.tsbuildinfo",
"docs": "typedoc src",
"eslint": "eslint . --ext .ts,.tsx --fix",
"eslint:check": "eslint . --ext .ts,.tsx",
"install:extension": "jlpm run build",
"prepublishOnly": "npm run build",
"watch": "run-p watch:src watch:labextension",
"watch:labextension": "jupyter labextension watch .",
"watch:src": "tsc -w"
},
"dependencies": {
"@jupyterlab/application": "^3.0.11",
"@jupyterlab/apputils": "^3.0.9",
"@jupyterlab/coreutils": "^5.0.6",
"@jupyterlab/docmanager": "^3.0.11",
"@jupyterlab/filebrowser": "^3.0.11",
"@jupyterlab/mainmenu": "^3.0.9",
"@jupyterlab/services": "^6.0.9",
"@jupyterlab/settingregistry": "^3.0.6",
"@jupyterlab/statedb": "^3.0.6",
"@jupyterlab/statusbar": "^3.0.9",
"@jupyterlab/ui-components": "^3.0.7",
"@lumino/algorithm": "^1.3.3",
"@lumino/commands": "^1.12.0",
"@lumino/messaging": "^1.4.3",
"@lumino/widgets": "^1.16.1"
},
"devDependencies": {
"@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": "^2.1.1",
"rimraf": "^3.0.2",
"typedoc": "^0.15.4",
"typescript": "~4.1.3"
},
"publishConfig": {
"access": "public"
},
"jupyterlab": {
"extension": true,
"schemaDir": "schema",
"outputDir": "swanfilebrowser/labextension",
"disabledExtensions": [
"@jupyterlab/filebrowser-extension"
]
},
"styleModule": "style/index.js"
}
17 changes: 17 additions & 0 deletions SwanFileBrowser/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[build-system]
requires = ["jupyter_packaging~=0.10,<2", "jupyterlab~=3.0"]
build-backend = "jupyter_packaging.build_api"

[tool.jupyter-packaging.options]
skip-if-exists = ["swanfilebrowser/labextension/static/style.js"]
ensured-targets = ["swanfilebrowser/labextension/static/style.js", "swanfilebrowser/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 = ["swanfilebrowser/labextension/**", "yarn.lock", ".*", "package-lock.json"]
28 changes: 28 additions & 0 deletions SwanFileBrowser/schema/browser.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"jupyter.lab.setting-icon": "ui-components:folder",
"jupyter.lab.setting-icon-label": "File Browser",
"title": "File Browser",
"description": "File Browser settings.",
"jupyter.lab.shortcuts": [
{
"command": "filebrowser:create-main-launcher",
"keys": ["Accel Shift L"],
"selector": "body"
},
{
"command": "filebrowser:toggle-main",
"keys": ["Accel Shift F"],
"selector": "body"
}
],
"properties": {
"navigateToCurrentDirectory": {
"type": "boolean",
"title": "Navigate to current directory",
"description": "Whether to automatically navigate to a document's current directory",
"default": false
}
},
"additionalProperties": false,
"type": "object"
}
87 changes: 87 additions & 0 deletions SwanFileBrowser/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
"""
swanfilebrowser setup
"""
import site
import json
import sys
from pathlib import Path

import setuptools

HERE = Path(__file__).parent.resolve()

# The name of the project
name = "swanfilebrowser"

lab_path = (HERE / name.replace("-", "_") / "labextension")

# Representative files that should exist after a successful build
ensured_targets = [
str(lab_path / "package.json"),
str(lab_path / "static/style.js")
]

labext_name = "@swan/filebrowser-extension"

data_files_spec = [
("share/jupyter/labextensions/%s" % labext_name, str(lab_path.relative_to(HERE)), "**"),
("share/jupyter/labextensions/%s" % labext_name, str("."), "install.json"),
]

long_description = (HERE / "README.md").read_text()

# Get the package info from package.json
pkg_json = json.loads((HERE / "package.json").read_bytes())

setup_args = dict(
name=name,
version=pkg_json["version"],
url=pkg_json["homepage"],
author=pkg_json["author"],
description=pkg_json["description"],
license=pkg_json["license"],
long_description=long_description,
long_description_content_type="text/markdown",
packages=setuptools.find_packages(),
install_requires=[],
zip_safe=False,
include_package_data=True,
python_requires=">=3.6",
platforms="Linux, Mac OS X, Windows",
keywords=["Jupyter", "JupyterLab", "JupyterLab3"],
classifiers=[
"License :: OSI Approved :: GNU Affero General Public License v3",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Framework :: Jupyter",
"Framework :: Jupyter :: JupyterLab",
"Framework :: Jupyter :: JupyterLab :: 3",
"Framework :: Jupyter :: JupyterLab :: Extensions",
"Framework :: Jupyter :: JupyterLab :: Extensions :: Prebuilt",
],
)

try:
from jupyter_packaging import (
wrap_installers,
npm_builder,
get_data_files
)
post_develop = npm_builder(
build_cmd="install:extension", source_dir="src", build_dir=lab_path
)
setup_args["cmdclass"] = wrap_installers(post_develop=post_develop, ensured_targets=ensured_targets)
setup_args["data_files"] = get_data_files(data_files_spec)
except ImportError as e:
import logging
logging.basicConfig(format="%(levelname)s: %(message)s")
logging.warning("Build tool `jupyter-packaging` is missing. Install it with pip or conda.")
if not ("--name" in sys.argv or "--version" in sys.argv):
raise e

if __name__ == "__main__":
setuptools.setup(**setup_args)
8 changes: 8 additions & 0 deletions SwanFileBrowser/src/icons.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { LabIcon } from '@jupyterlab/ui-components';

import swanProjectIconStr from '../style/project_folder.svg';

export const swanProjectIcon = new LabIcon({
name: 'ui-components:folder-project',
svgstr: swanProjectIconStr
});
Loading