Skip to content

Commit 4319576

Browse files
authored
Upgrade for lab 3.0 as a prebuilt extension (#21)
This commit was partially generated via juptyerlab.upgrade_extension which is governed by BSD-3 and thus the following disclaimer applies: 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. jupyterlab-execute-time is also governed by BSD-3.
1 parent 329f933 commit 4319576

23 files changed

+3466
-754
lines changed

.eslintignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
dist
3+
coverage
4+
**/*.d.ts
5+
jupyterlab_execute_time

.eslintrc.js

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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', 'tests/tsconfig.json'],
11+
sourceType: 'module'
12+
},
13+
plugins: ['@typescript-eslint'],
14+
rules: {
15+
'@typescript-eslint/interface-name-prefix': [
16+
'error',
17+
{ prefixWithI: 'always' }
18+
],
19+
'@typescript-eslint/no-unused-vars': ['warn', { args: 'none' }],
20+
'@typescript-eslint/no-explicit-any': 'off',
21+
'@typescript-eslint/explicit-function-return-type': 'off',
22+
'@typescript-eslint/no-namespace': 'off',
23+
'@typescript-eslint/no-use-before-define': 'off',
24+
'@typescript-eslint/quotes': [
25+
'error',
26+
'single',
27+
{ avoidEscape: true, allowTemplateLiterals: false }
28+
],
29+
curly: ['error', 'all'],
30+
eqeqeq: 'error',
31+
'prefer-arrow-callback': 'error'
32+
}
33+
};

.github/workflows/build.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: master
6+
pull_request:
7+
branches: '*'
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v2
15+
- name: Install node
16+
uses: actions/setup-node@v1
17+
with:
18+
node-version: '14.x'
19+
- name: Install Python
20+
uses: actions/setup-python@v2
21+
with:
22+
python-version: '3.7'
23+
architecture: 'x64'
24+
- name: Install dependencies
25+
run: python -m pip install jupyterlab
26+
- name: Build the extension
27+
run: |
28+
jlpm
29+
jlpm run eslint:check
30+
python -m pip install .
31+
32+
jupyter labextension list 2>&1 | grep -ie "jupyterlab-execute-time.*OK"
33+
python -m jupyterlab.browser_check

.gitignore

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

.prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ node_modules
22
**/node_modules
33
**/lib
44
**/package.json
5+
jupyterlab_execute_time

.travis.yml

-6
This file was deleted.

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## [2.0.0](https://github.com/deshaw/jupyterlab-execute-time/compare/v1.1.0...v2.0.0) (UNRELEASED)
2+
3+
### Changed
4+
5+
- **Breaking**: Adds support for Jupyterlab@3.x and removes support for Jupyterlab@2.x. To migrate, after installing Jupyterlab@3.x run `pip install jupyterlab_execute_time`.
6+
17
## [1.1.0](https://github.com/deshaw/jupyterlab-execute-time/compare/v1.0.0...v1.1.0) (2021-01-18)
28

39
### Added

MANIFEST.in

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

README.md

+28-30
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,68 @@
11
# jupyterlab-execute-time
22

3-
[![Binder][badge-binder]][binder]
4-
[![NPM version][npm-image]][npm-url] [![NPM DM][npm-dm-image]][npm-url] [![Build Status][travis-image]][travis-url]
3+
[![NPM version][npm-image]][npm-url] [![NPM DM][npm-dm-image]][npm-url]
4+
[![Github Actions Status](https://github.com/deshaw/jupyterlab-execute-time.git/workflows/Build/badge.svg)[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/deshaw/jupyterlab-execute-time.git/master?urlpath=lab%2Ftree%2Fnotebooks%2Findex.ipynb)
55

6-
Display cell timings.
6+
Display cell timings in Jupyter Lab
77

88
![Execute Time Screenshot](https://github.com/deshaw/jupyterlab-execute-time/blob/master/docs/execute-time-screenshot.png?raw=true)
99

1010
This is inspired by the notebook version [here](https://github.com/ipython-contrib/jupyter_contrib_nbextensions/blob/master/src/jupyter_contrib_nbextensions/nbextensions/execute_time).
1111

1212
Note: for this to show anything, you need to enable cell timing in the notebook via Settings->Advanced Settings Editor->Notebook: `{"recordTiming": true}`. This is a notebook metadata setting and not a plugin setting. The plugin just displays this data.
1313

14-
"Jupyter" is a trademark of the NumFOCUS foundation, of which Project Jupyter is a part."
15-
1614
## Requirements
1715

18-
- JupyterLab >= 2.0.2
16+
- JupyterLab >= 3.0
1917

2018
## Install
2119

2220
```bash
23-
jupyter labextension install jupyterlab-execute-time
21+
pip install jupyterlab_execute_time
2422
```
2523

2624
## Contributing
2725

28-
### Install
26+
### Development install
27+
28+
Note: You will need NodeJS to build the extension package.
29+
30+
The `jlpm` command is JupyterLab's pinned version of
31+
[yarn](https://yarnpkg.com/) that is installed with JupyterLab. You may use
32+
`yarn` or `npm` in lieu of `jlpm` below.
2933

3034
```bash
3135
# Clone the repo to your local environment
32-
# Move to jupyterlab-execute-time directory
33-
# Install dependencies
34-
yarn
35-
# Build Typescript source
36-
yarn run build
36+
# Change directory to the jupyterlab_execute_time directory
37+
# Install package in development mode
38+
pip install -e .
3739
# Link your development version of the extension with JupyterLab
38-
jupyter labextension link .
39-
# Rebuild Typescript source after making changes
40-
yarn run build
41-
# Rebuild JupyterLab after making any changes
42-
jupyter lab build
40+
jupyter labextension develop . --overwrite
41+
# Rebuild extension Typescript source after making changes
42+
jlpm run build
4343
```
4444

45-
You can watch the source directory and run JupyterLab in watch mode to watch for changes in the extension's source and automatically rebuild the extension and application.
45+
You can watch the source directory and run JupyterLab at the same time in different terminals to watch for changes in the extension's source and automatically rebuild the extension.
4646

4747
```bash
48-
# Watch the source directory in another terminal tab
49-
yarn run watch
50-
# Run jupyterlab in watch mode in one terminal tab
51-
jupyter lab --watch
48+
# Watch the source directory in one terminal, automatically rebuilding when needed
49+
jlpm run watch
50+
# Run JupyterLab in another terminal
51+
jupyter lab
5252
```
5353

54-
To test:
54+
With the watch command running, every saved change will immediately be built locally and available in your running JupyterLab. Refresh JupyterLab to load the change in your browser (you may need to wait several seconds for the extension to be rebuilt).
55+
56+
By default, the `jlpm run build` command generates the source maps for this extension to make it easier to debug using the browser dev tools. To also generate source maps for the JupyterLab core extensions, you can run the following command:
5557

5658
```bash
57-
yarn run test
59+
jupyter lab build --minimize=False
5860
```
5961

6062
### Uninstall
6163

6264
```bash
63-
jupyter labextension uninstall jupyterlab-execute-time
65+
pip uninstall jupyterlab_execute_time
6466
```
6567

6668
## History
@@ -82,7 +84,3 @@ This project is released under a [BSD-3-Clause license](https://github.com/desha
8284
[npm-url]: https://npmjs.org/package/jupyterlab-execute-time
8385
[npm-image]: https://badge.fury.io/js/jupyterlab-execute-time.png
8486
[npm-dm-image]: https://img.shields.io/npm/dm/jupyterlab-execute-time.svg
85-
[travis-url]: http://travis-ci.org/deshaw/jupyterlab-execute-time
86-
[travis-image]: https://secure.travis-ci.org/deshaw/jupyterlab-execute-time.png?branch=master
87-
[badge-binder]: https://mybinder.org/badge_logo.svg
88-
[binder]: https://mybinder.org/v2/gh/deshaw/jupyterlab-execute-time/master?urlpath=lab%2Ftree%2Fnotebooks%2Findex.ipynb

binder/environment.yml

+18-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
1+
# a mybinder.org-ready environment for demoing jupyterlab_execute_time
2+
# this environment may also be used locally on Linux/MacOS/Windows, e.g.
3+
#
4+
# conda env update --file binder/environment.yml
5+
# conda activate jupyterlab_execute_time-demo
6+
#
7+
name: jupyterlab_execute_time-demo
8+
19
channels:
210
- conda-forge
11+
312
dependencies:
4-
- jupyterlab>=2
5-
- nodejs=12
13+
# runtime dependencies
14+
- python >=3.8,<4.0.0a0
15+
- jupyterlab >=3,<4.0.0a0
16+
# labextension build dependencies
17+
- nodejs >=14,<15
18+
- pip
19+
- wheel
20+
# additional packages for demos
21+
# - ipywidgets

0 commit comments

Comments
 (0)