Skip to content

Commit 2c357a2

Browse files
authored
Merge pull request #124 from bokeh/jlab_scratch
Upgrade to JupyterLab by reinitializing project structure
2 parents ba31df4 + 1829c4a commit 2c357a2

32 files changed

+17225
-4753
lines changed

.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

.eslintrc.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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+
'warn',
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+
semi: ['warn', 'never'],
37+
eqeqeq: 'warn',
38+
'prefer-arrow-callback': 'error'
39+
}
40+
};

.github/workflows/build.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: main
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: '12.x'
19+
- name: Install Python
20+
uses: actions/setup-python@v2
21+
with:
22+
python-version: '3.7'
23+
architecture: 'x64'
24+
- name: Setup pip cache
25+
uses: actions/cache@v2
26+
with:
27+
path: ~/.cache/pip
28+
key: pip-3.7-${{ hashFiles('package.json') }}
29+
restore-keys: |
30+
pip-3.7-
31+
pip-
32+
33+
- name: Get yarn cache directory path
34+
id: yarn-cache-dir-path
35+
run: echo "::set-output name=dir::$(yarn cache dir)"
36+
- name: Setup yarn cache
37+
uses: actions/cache@v2
38+
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
39+
with:
40+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
41+
key: yarn-${{ hashFiles('**/yarn.lock') }}
42+
restore-keys: |
43+
yarn-
44+
45+
- name: Install dependencies
46+
run: python -m pip install -U jupyterlab~=3.0 jupyter_packaging~=0.7.9
47+
- name: Build the extension
48+
run: |
49+
jlpm
50+
jlpm run eslint:check
51+
python -m pip install .
52+
53+
jupyter labextension list 2>&1 | grep -ie "@bokeh/jupyter_bokeh.*OK"
54+
python -m jupyterlab.browser_check

.prettierignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
node_modules
2+
**/node_modules
3+
**/lib
4+
**/package.json
5+
jupyter_bokeh
6+
src/extension.ts

.prettierrc

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

.travis.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

MANIFEST.in

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,25 @@
1+
include LICENSE
12
include README.md
2-
include LICENSE.txt
3-
include jupyter_bokeh.json
4-
recursive-include jupyter_bokeh/nbextension/static *.js *.js.map *.d.ts
3+
include pyproject.toml
4+
include jupyter-config/jupyter_bokeh.json
5+
6+
include package.json
7+
include install.json
8+
include ts*.json
9+
include yarn.lock
10+
11+
recursive-include jupyter_bokeh/nbextension/ *.js *.js.map *.d.ts
12+
graft jupyter_bokeh/labextension
13+
14+
# Javascript files
15+
graft src
16+
graft style
17+
prune **/node_modules
18+
prune lib
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

README.md

Lines changed: 44 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,37 @@
11
# jupyter_bokeh
22

3-
A Jupyter extension for rendering [Bokeh](https://bokeh.org) content within Jupyter. See also the separate [ipywidgets_bokeh](https://github.com/bokeh/ipywidgets_bokeh) library for support for using Jupyter widgets/ipywidgets objects within Bokeh applications.
3+
![Github Actions Status](https://github.com/bokeh/jupyter_bokeh/workflows/Build/badge.svg)
44

5-
## Prerequisites
5+
A Jupyter extension for rendering [Bokeh](https://bokeh.org) content within Jupyter. See also the separate [ipywidgets_bokeh](https://github.com/bokeh/ipywidgets_bokeh) library for support for using Jupyter widgets/ipywidgets objects within Bokeh applications.
66

7-
* Jupyter Lab or Notebook
87

9-
## Installation
8+
## Install
109

1110
To install the latest version in Jupyter Lab:
1211

1312
```bash
13+
pip install jupyter_bokeh
14+
```
15+
16+
or
17+
18+
```
1419
conda install -c bokeh jupyter_bokeh
15-
jupyter labextension install @jupyter-widgets/jupyterlab-manager
16-
jupyter labextension install @bokeh/jupyter_bokeh
1720
```
1821

19-
To install a specific version:
22+
For versions of Jupyter Lab <3.0 you must install the labextension
23+
separately:
2024

2125
```bash
22-
jupyter labextension install @bokeh/[email protected]
26+
conda install -c bokeh jupyter_bokeh
27+
jupyter labextension install @jupyter-widgets/jupyterlab-manager
28+
jupyter labextension install @bokeh/jupyter_bokeh
2329
```
2430

25-
On slow or limited memory systems, one can use `--minimize=False` to reduce compilation
26-
times or make Jupyter Lab build runtime bundles at all.
27-
28-
jupyter_bokeh is automatically installed in Jupyter Notebook. In case of a non-standard
29-
setup, one can install the extensions with:
31+
To install a specific version:
3032

3133
```bash
32-
jupyter nbextension install --sys-prefix --symlink --py jupyter_bokeh
33-
jupyter nbextension enable jupyter_bokeh --py --sys-prefix
34+
jupyter labextension install @bokeh/[email protected]
3435
```
3536

3637
## Compatibility
@@ -53,41 +54,48 @@ installation may refer to the below table.
5354
| 0.35.x | 0.6.3 |
5455
| 1.0.x | 1.0.0 |
5556
| 2.0.x | 2.0.0 |
57+
| 3.0.x | 3.0.0 |
5658

57-
## Development
59+
## Contributing
5860

59-
For a development install (requires npm version 6 or later), do the following in the repository directory:
61+
### Development install
6062

61-
```bash
62-
npm install
63-
jupyter labextension link .
64-
```
63+
Note: You will need NodeJS to build the extension package.
6564

66-
To rebuild the package and the JupyterLab app:
65+
The `jlpm` command is JupyterLab's pinned version of
66+
[yarn](https://yarnpkg.com/) that is installed with JupyterLab. You may use
67+
`yarn` or `npm` in lieu of `jlpm` below.
6768

6869
```bash
69-
npm run build
70-
jupyter lab build
70+
# Clone the repo to your local environment
71+
# Change directory to the jupyter_bokeh directory
72+
# Install package in development mode
73+
pip install -e .
74+
# Link your development version of the extension with JupyterLab
75+
jupyter labextension develop . --overwrite
76+
# Rebuild extension Typescript source after making changes
77+
jlpm run build
7178
```
7279

73-
To incrementally rebuild the extension and JupyterLab after changes you can run
80+
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.
7481

7582
```bash
76-
npm run watch
83+
# Watch the source directory in one terminal, automatically rebuilding when needed
84+
jlpm run watch
85+
# Run JupyterLab in another terminal
86+
jupyter lab
7787
```
7888

79-
and in another terminal run
89+
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).
90+
91+
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:
8092

8193
```bash
82-
jupyter lab --watch
94+
jupyter lab build --minimize=False
8395
```
8496

85-
When making a new release for compatibility with a new JupyterLab minor release series, please make a minor
86-
release bump in this extension (i.e. 0.6.3 -> 0.7.0). Conversely, when creating a release for a new feature or bug fix,
87-
please make a micro release bump (i.e. 0.6.3 -> 0.6.4).
88-
89-
## Testing
97+
### Uninstall
9098

91-
There is a directory named ``examples`` which contains a collection of notebooks that cover the various ``jupyter_bokeh``
92-
functionalities. If you update the extension for new JupyterLab releases, please manually execute each and check that the
93-
expected behavior occurs. If you extend the ``jupyter_bokeh``, please add a new notebook that covers the new functionality.
99+
```bash
100+
pip uninstall jupyter_bokeh
101+
```

conda.recipe/meta.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,18 @@ extra:
1919

2020
requirements:
2121
build:
22+
- jupyter-packaging
23+
- jupyterlab
24+
- notebook
2225
- python
2326
- setuptools
2427
- nodejs >=10.13.0
2528
run:
2629
- python
2730
- bokeh >=2.0.0
28-
- ipywidgets >=7.0.0
31+
- ipywidgets >=7.5.0
32+
run_constrained:
33+
- jupyterlab >=3.0.0,<4
2934

3035
test:
3136
imports:

eslint.json

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)