Skip to content

Commit 1a28826

Browse files
committed
Add 'jupyterlab-kernel-usage/' from commit 'b22e7f8b35f1adf7a14f0ff2d9e637c37751efa2'
git-subtree-dir: jupyterlab-kernel-usage git-subtree-mainline: 74a391c git-subtree-split: b22e7f8
2 parents 74a391c + b22e7f8 commit 1a28826

37 files changed

+9191
-0
lines changed

jupyterlab-kernel-usage/.eslintignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
dist
3+
coverage
4+
**/*.d.ts
5+
tests

jupyterlab-kernel-usage/.eslintrc.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
module.exports = {
2+
extends: [
3+
'eslint:recommended',
4+
'plugin:@typescript-eslint/eslint-recommended',
5+
'plugin:@typescript-eslint/recommended',
6+
'plugin:prettier/recommended'
7+
],
8+
parser: '@typescript-eslint/parser',
9+
parserOptions: {
10+
project: 'tsconfig.json',
11+
sourceType: 'module'
12+
},
13+
plugins: ['@typescript-eslint'],
14+
rules: {
15+
'@typescript-eslint/naming-convention': [
16+
'error',
17+
{
18+
'selector': 'interface',
19+
'format': ['PascalCase'],
20+
'custom': {
21+
'regex': '^I[A-Z]',
22+
'match': true
23+
}
24+
}
25+
],
26+
'@typescript-eslint/no-unused-vars': ['warn', { args: 'none' }],
27+
'@typescript-eslint/no-explicit-any': 'off',
28+
'@typescript-eslint/no-namespace': 'off',
29+
'@typescript-eslint/no-use-before-define': 'off',
30+
'@typescript-eslint/quotes': [
31+
'error',
32+
'single',
33+
{ avoidEscape: true, allowTemplateLiterals: false }
34+
],
35+
curly: ['error', 'all'],
36+
eqeqeq: 'error',
37+
'prefer-arrow-callback': 'error'
38+
}
39+
};

jupyterlab-kernel-usage/.gitignore

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
*.bundle.*
2+
lib/
3+
node_modules/
4+
*.egg-info/
5+
.ipynb_checkpoints
6+
.vscode
7+
*.tsbuildinfo
8+
jupyterlab_kernel_usage/labextension
9+
10+
# Created by https://www.gitignore.io/api/python
11+
# Edit at https://www.gitignore.io/?templates=python
12+
13+
### Python ###
14+
# Byte-compiled / optimized / DLL files
15+
__pycache__/
16+
*.py[cod]
17+
*$py.class
18+
19+
# C extensions
20+
*.so
21+
22+
# Distribution / packaging
23+
.Python
24+
build/
25+
develop-eggs/
26+
dist/
27+
downloads/
28+
eggs/
29+
.eggs/
30+
lib/
31+
lib64/
32+
parts/
33+
sdist/
34+
var/
35+
wheels/
36+
pip-wheel-metadata/
37+
share/python-wheels/
38+
.installed.cfg
39+
*.egg
40+
MANIFEST
41+
42+
# PyInstaller
43+
# Usually these files are written by a python script from a template
44+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
45+
*.manifest
46+
*.spec
47+
48+
# Installer logs
49+
pip-log.txt
50+
pip-delete-this-directory.txt
51+
52+
# Unit test / coverage reports
53+
htmlcov/
54+
.tox/
55+
.nox/
56+
.coverage
57+
.coverage.*
58+
.cache
59+
nosetests.xml
60+
coverage.xml
61+
*.cover
62+
.hypothesis/
63+
.pytest_cache/
64+
65+
# Translations
66+
*.mo
67+
*.pot
68+
69+
# Scrapy stuff:
70+
.scrapy
71+
72+
# Sphinx documentation
73+
docs/_build/
74+
75+
# PyBuilder
76+
target/
77+
78+
# pyenv
79+
.python-version
80+
81+
# celery beat schedule file
82+
celerybeat-schedule
83+
84+
# SageMath parsed files
85+
*.sage.py
86+
87+
# Spyder project settings
88+
.spyderproject
89+
.spyproject
90+
91+
# Rope project settings
92+
.ropeproject
93+
94+
# Mr Developer
95+
.mr.developer.cfg
96+
.project
97+
.pydevproject
98+
99+
# mkdocs documentation
100+
/site
101+
102+
# mypy
103+
.mypy_cache/
104+
.dmypy.json
105+
dmypy.json
106+
107+
# Pyre type checker
108+
.pyre/
109+
110+
# End of https://www.gitignore.io/api/python
111+
112+
# OSX files
113+
.DS_Store
114+
115+
# Locks
116+
*.lock
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
**/node_modules
3+
**/lib
4+
**/package.json
5+
jupyterlab_kernel_usage

jupyterlab-kernel-usage/.prettierrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"singleQuote": true,
3+
"trailingComma": "none",
4+
"arrowParens": "avoid"
5+
}

jupyterlab-kernel-usage/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Changelog
2+
3+
<!-- <START NEW CHANGELOG ENTRY> -->
4+
5+
<!-- <END NEW CHANGELOG ENTRY> -->

jupyterlab-kernel-usage/LICENSE

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
BSD 3-Clause License
2+
3+
Copyright (c) 2021, Eric Charles
4+
All rights reserved.
5+
6+
Redistribution and use in source and binary forms, with or without
7+
modification, are permitted provided that the following conditions are met:
8+
9+
1. Redistributions of source code must retain the above copyright notice, this
10+
list of conditions and the following disclaimer.
11+
12+
2. Redistributions in binary form must reproduce the above copyright notice,
13+
this list of conditions and the following disclaimer in the documentation
14+
and/or other materials provided with the distribution.
15+
16+
3. Neither the name of the copyright holder nor the names of its
17+
contributors may be used to endorse or promote products derived from
18+
this software without specific prior written permission.
19+
20+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

jupyterlab-kernel-usage/MANIFEST.in

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
include LICENSE
2+
include *.md
3+
include pyproject.toml
4+
recursive-include jupyter-config *.json
5+
6+
include package.json
7+
include install.json
8+
include ts*.json
9+
include yarn.lock
10+
11+
graft jupyterlab_kernel_usage/labextension
12+
13+
# Javascript files
14+
graft src
15+
graft style
16+
prune **/node_modules
17+
prune lib
18+
prune binder
19+
20+
# Patterns to exclude from any directory
21+
global-exclude *~
22+
global-exclude *.pyc
23+
global-exclude *.pyo
24+
global-exclude .git
25+
global-exclude .ipynb_checkpoints

jupyterlab-kernel-usage/Makefile

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
CONDA_ACTIVATE=source $$(conda info --base)/etc/profile.d/conda.sh ; conda activate ; conda activate
2+
CONDA_DEACTIVATE=source $$(conda info --base)/etc/profile.d/conda.sh ; conda deactivate
3+
CONDA_REMOVE=source $$(conda info --base)/etc/profile.d/conda.sh ; conda remove -y --all -n
4+
5+
ENV_NAME=jupyterlab-kernel-usage
6+
7+
.PHONY: clean build dist env cp
8+
9+
.EXPORT_ALL_VARIABLES:
10+
11+
default: all ## Default target is all.
12+
13+
help: ## display this help.
14+
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
15+
16+
all: clean install build dist ## Clean, install and build.
17+
18+
build:
19+
($(CONDA_ACTIVATE) ${ENV_NAME}; \
20+
yarn build )
21+
22+
clean:
23+
rm -fr build || true
24+
rm -fr dist || true
25+
rm -fr *.egg-info || true
26+
rm -fr jupyterlab-kernel-usage/labextension || true
27+
find . -name '*.egg-info' -exec rm -fr {} + || true
28+
find . -name '__pycache__' -exec rm -fr {} + || true
29+
30+
env-rm:
31+
-conda remove -y --all -n ${ENV_NAME}
32+
33+
env:
34+
-conda env create -f environment.yaml
35+
@echo
36+
@echo --------------------------------
37+
@echo ✨ ${ENV_NAME} environment is created.
38+
@echo --------------------------------
39+
@echo
40+
41+
install-dev:
42+
($(CONDA_ACTIVATE) ${ENV_NAME}; \
43+
pip install -e . && \
44+
jlpm && \
45+
jlpm build && \
46+
jupyter server extension enable jupyterlab_kernel_usage && \
47+
jupyter labextension develop --overwrite .)
48+
49+
jlab:
50+
($(CONDA_ACTIVATE) ${ENV_NAME}; \
51+
jupyter lab \
52+
--ServerApp.jpserver_extensions="{'jupyterlab': True, 'jupyterlab_kernel_usage': True}" \
53+
--no-browser \
54+
--notebook-dir=./notebooks \
55+
--port 8234)
56+
57+
jlab-dev:
58+
($(CONDA_ACTIVATE) ${ENV_NAME}; \
59+
jupyter lab \
60+
--ServerApp.jpserver_extensions="{'jupyterlab': True, 'jupyterlab_kernel_usage': True}" \
61+
--no-browser \
62+
--dev-mode \
63+
--extensions-in-dev-mode \
64+
--port 8234)
65+
66+
jlab-watch:
67+
($(CONDA_ACTIVATE) ${ENV_NAME}; \
68+
jupyter lab \
69+
--watch \
70+
--ServerApp.jpserver_extensions="{'jupyterlab_resource_usage': True}" \
71+
--port 8234)
72+
73+
kill:
74+
lsof -i TCP:8234 | grep LISTEN | awk '{print $2}' | xargs kill -9
75+
76+
watch:
77+
($(CONDA_ACTIVATE) ${ENV_NAME}; \
78+
yarn watch )
79+
80+
main:
81+
($(CONDA_ACTIVATE) ${ENV_NAME}; \
82+
python -m jupyterlab_resource_usage )
83+
84+
publish:
85+
($(CONDA_ACTIVATE) ${ENV_NAME}; \
86+
rm -fr dist/* && \
87+
yarn clean && \
88+
yarn build && \
89+
python setup.py sdist bdist_wheel && \
90+
twine upload dist/* )

0 commit comments

Comments
 (0)