Skip to content

Commit

Permalink
New files with updated project for jupyterlab 3
Browse files Browse the repository at this point in the history
  • Loading branch information
oriolmirosa committed Aug 31, 2021
1 parent c6da3d0 commit 8c1e1e4
Show file tree
Hide file tree
Showing 24 changed files with 13,959 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
dist
coverage
**/*.d.ts
tests
32 changes: 32 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
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/interface-name-prefix': [
'error',
{ prefixWithI: 'always' }
],
'@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'
}
};
32 changes: 32 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Build

on:
push:
branches: master
pull_request:
branches: '*'

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install node
uses: actions/setup-node@v1
with:
node-version: '12.x'
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: '3.7'
architecture: 'x64'
- name: Install dependencies
run: python -m pip install jupyterlab==3 jupyter_packaging
- name: Build the extension
run: |
jlpm
jlpm run eslint:check
python -m pip install .
jupyter labextension list 2>&1 | grep -ie "@oriolmirosa/jupyterlab_materialdarker.*OK"
python -m jupyterlab.browser_check
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
**/node_modules
**/lib
**/package.json
3 changes: 3 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"singleQuote": true
}
28 changes: 28 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
BSD 3-Clause License

Copyright (c) 2020, Oriol Mirosa All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 changes: 23 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
include LICENSE
include README.md
include pyproject.toml
include jupyter-config/jupyterlab_materialdarker.json

include package.json
include install.json
include ts*.json

graft jupyterlab_materialdarker/labextension

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

# Patterns to exclude from any directory
global-exclude *~
global-exclude *.pyc
global-exclude *.pyo
global-exclude .git
global-exclude .ipynb_checkpoints
21 changes: 21 additions & 0 deletions binder/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# a mybinder.org-ready environment for demoing jupyterlab_materialdarker
# this environment may also be used locally on Linux/MacOS/Windows, e.g.
#
# conda env update --file binder/environment.yml
# conda activate jupyterlab_materialdarker-demo
#
name: jupyterlab_materialdarker-demo

channels:
- conda-forge

dependencies:
# runtime dependencies
- python >=3.8,<3.9.0a0
- jupyterlab >=3,<4.0.0a0
# labextension build dependencies
- nodejs >=14,<15
- pip
- wheel
# additional packages for demos
# - ipywidgets
46 changes: 46 additions & 0 deletions binder/postBuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/usr/bin/env python3
""" perform a development install of jupyterlab_materialdarker
On Binder, this will run _after_ the environment has been fully created from
the environment.yml in this directory.
This script should also run locally on Linux/MacOS/Windows:
python3 binder/postBuild
"""
import subprocess
import sys
from pathlib import Path


ROOT = Path.cwd()

def _(*args, **kwargs):
""" Run a command, echoing the args
fails hard if something goes wrong
"""
print("\n\t", " ".join(args), "\n")
return_code = subprocess.call(args, **kwargs)
if return_code != 0:
print("\nERROR", return_code, " ".join(args))
sys.exit(return_code)

# verify the environment is self-consistent before even starting
_(sys.executable, "-m", "pip", "check")

# install the labextension
_(sys.executable, "-m", "pip", "install", "-e", ".")

# verify the environment the extension didn't break anything
_(sys.executable, "-m", "pip", "check")

# list the extensions
_("jupyter", "server", "extension", "list")

# initially list installed extensions to determine if there are any surprises
_("jupyter", "labextension", "list")


print("JupyterLab with jupyterlab_materialdarker is ready to run with:\n")
print("\tjupyter lab\n")
5 changes: 5 additions & 0 deletions install.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"packageManager": "python",
"packageName": "jupyterlab_materialdarker",
"uninstallInstructions": "Use your Python package manager (pip, conda, etc.) to uninstall the package jupyterlab_materialdarker"
}
17 changes: 17 additions & 0 deletions jupyterlab_materialdarker/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

import json
import os.path as osp

from ._version import __version__

HERE = osp.abspath(osp.dirname(__file__))

with open(osp.join(HERE, 'labextension', 'package.json')) as fid:
data = json.load(fid)


def _jupyter_labextension_paths():
return [{
'src': 'labextension',
'dest': data['name']
}]
19 changes: 19 additions & 0 deletions jupyterlab_materialdarker/_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
__all__ = ['__version__']


def _fetchVersion():
import json
import os

here = os.path.abspath(os.path.dirname(__file__))

for d, _, _ in os.walk(here):
try:
with open(os.path.join(d, 'package.json')) as f:
return json.load(f)['version']
except FileNotFoundError:
pass

raise FileNotFoundError('Could not find package.json under dir {}'.format(here))

__version__ = _fetchVersion()
71 changes: 71 additions & 0 deletions jupyterlab_materialdarker/labextension/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"name": "@oriolmirosa/jupyterlab_materialdarker",
"version": "0.1.0",
"description": "The Material Darker theme for JupyterLab",
"keywords": [
"jupyter",
"jupyterlab",
"jupyterlab-extension"
],
"homepage": "https://github.com/oriolmirosa/jupyterlab_materialdarker",
"bugs": {
"url": "https://github.com/oriolmirosa/jupyterlab_materialdarker/issues"
},
"license": "BSD-3-Clause",
"author": "Oriol Mirosa",
"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}"
],
"main": "lib/index.js",
"types": "lib/index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/oriolmirosa/jupyterlab_materialdarker.git"
},
"scripts": {
"build": "jlpm run build:lib && jlpm run build:labextension:dev",
"build:prod": "jlpm run build:lib && jlpm run build:labextension",
"build:labextension": "jupyter labextension build .",
"build:labextension:dev": "jupyter labextension build --development True .",
"build:lib": "tsc",
"clean": "jlpm run clean:lib",
"clean:lib": "rimraf lib tsconfig.tsbuildinfo",
"clean:labextension": "rimraf jupyterlab_materialdarker/labextension",
"clean:all": "jlpm run clean:lib && jlpm run clean:labextension",
"eslint": "eslint . --ext .ts,.tsx --fix",
"eslint:check": "eslint . --ext .ts,.tsx",
"install:extension": "jupyter labextension develop --overwrite .",
"prepare": "jlpm run clean && jlpm run build:prod",
"watch": "run-p watch:src watch:labextension",
"watch:src": "tsc -w",
"watch:labextension": "jupyter labextension watch ."
},
"dependencies": {
"@jupyterlab/application": "^3.0.0"
},
"devDependencies": {
"@jupyterlab/builder": "^3.0.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",
"npm-run-all": "^4.1.5",
"prettier": "^1.19.0",
"rimraf": "^3.0.2",
"typescript": "~4.0.3"
},
"sideEffects": [
"style/*.css"
],
"jupyterlab": {
"extension": true,
"themePath": "style/index.css",
"outputDir": "jupyterlab_materialdarker/labextension",
"_build": {
"load": "static/remoteEntry.d15cf35d5cd2c45563e7.js",
"extension": "./extension"
}
}
}
Loading

0 comments on commit 8c1e1e4

Please sign in to comment.