Skip to content

Commit 03478e0

Browse files
authored
Merge pull request #121 from krassowski/pep-8-name
Update in line with latest 3.0 cookiecutter, use PEP8 package name
2 parents ff72be0 + 1de7d66 commit 03478e0

File tree

15 files changed

+196
-129
lines changed

15 files changed

+196
-129
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
python-version: '3.7'
2323
architecture: 'x64'
2424
- name: Install dependencies
25-
run: python -m pip install -U pip jupyterlab~=3.0 jupyter-packaging~=0.7.9
25+
run: python -m pip install -U jupyterlab~=3.0 jupyter-packaging~=0.7.9
2626
- name: Build the extension
2727
run: |
2828
jlpm
@@ -31,8 +31,5 @@ jobs:
3131
3232
python -m pip install .
3333
34-
jupyter labextension list 1>labextensions 2>&1
35-
cat labextensions | grep "jupyterlab-interactive-dashboard-editor.*OK"
36-
34+
jupyter labextension list 2>&1 | grep -ie "jupyterlab-interactive-dashboard-editor.*OK"
3735
python -m jupyterlab.browser_check
38-

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ node_modules/
55
.ipynb_checkpoints
66
*.tsbuildinfo
77

8-
jupyterlab_interactive_dashboard_editor/labextension
8+
jupyterlab-interactive-dashboard-editor/labextension
99

1010
*/labextension/*.tgz
1111
# Created by https://www.gitignore.io/api/python
@@ -115,4 +115,4 @@ dmypy.json
115115
.vscode
116116

117117
# Local testing
118-
__test/
118+
__test/

.prettierignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ node_modules
22
**/node_modules
33
**/lib
44
**/package.json
5-
jupyterlab_interactive_dashboard_editor
5+
jupyterlab-interactive-dashboard-editor
66
.vscode
7-
.github
7+
.github

MANIFEST.in

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,22 @@ include README.md
33
include pyproject.toml
44
include install.json
55

6-
graft jupyterlab_interactive_dashboard_editor/labextension
6+
include package.json
7+
include install.json
8+
include ts*.json
9+
include yarn.lock
10+
11+
graft jupyterlab-interactive-dashboard-editor/labextension
12+
13+
# Javascript files
14+
graft src
15+
graft style
16+
prune **/node_modules
17+
prune lib
18+
19+
# Patterns to exclude from any directory
20+
global-exclude *~
21+
global-exclude *.pyc
22+
global-exclude *.pyo
23+
global-exclude .git
24+
global-exclude .ipynb_checkpoints

README.md

Lines changed: 41 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -57,48 +57,69 @@ And edit them again!
5757

5858
## Install
5959

60-
Note: You will need NodeJS to install the extension.
60+
For JupyterLab 3+:
6161

6262
```bash
63-
pip install jupyterlab_interactive_dashboard_editor
63+
pip install jupyterlab-interactive-dashboard-editor
64+
```
65+
66+
For JupyterLab 2.x:
67+
68+
```bash
69+
jupyter labextension install jupyterlab-interactive-dashboard-editor
6470
jupyter lab build
6571
```
6672

67-
### Install
73+
Note: You will need NodeJS to install the extension for JupterLab 2.x.
74+
75+
## Contributing
76+
77+
### Development install
78+
79+
Note: You will need NodeJS to build the extension package.
6880

6981
The `jlpm` command is JupyterLab's pinned version of
7082
[yarn](https://yarnpkg.com/) that is installed with JupyterLab. You may use
7183
`yarn` or `npm` in lieu of `jlpm` below.
7284

7385
```bash
7486
# Clone the repo to your local environment
75-
# Move to jupyterlab-interactive-dashboard-editor directory
76-
77-
# Install dependencies
78-
jlpm
79-
# Build Typescript source
80-
jlpm build
87+
# Change directory to the jupyterlab-interactive-dashboard-editor directory
88+
# Install package in development mode
89+
pip install -e .
8190
# Link your development version of the extension with JupyterLab
82-
jupyter labextension install .
83-
# Rebuild Typescript source after making changes
84-
jlpm build
85-
# Rebuild JupyterLab after making any changes
86-
jupyter lab build
91+
jupyter labextension develop . --overwrite
92+
# Rebuild extension Typescript source after making changes
93+
jlpm run build
8794
```
8895

89-
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.
96+
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.
9097

9198
```bash
92-
# Watch the source directory in another terminal tab
93-
jlpm watch
94-
# Run jupyterlab in watch mode in one terminal tab
95-
jupyter lab --watch
99+
# Watch the source directory in one terminal, automatically rebuilding when needed
100+
jlpm run watch
101+
# Run JupyterLab in another terminal
102+
jupyter lab
96103
```
97104

98-
Now every change will be built locally and bundled into JupyterLab. Be sure to refresh your browser page after saving file changes to reload the extension (note: you'll need to wait for webpack to finish, which can take 10s+ at times).
105+
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).
106+
107+
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:
108+
109+
```bash
110+
jupyter lab build --minimize=False
111+
```
99112

100113
### Uninstall
101114

115+
For JupyterLab 3+:
116+
117+
```bash
118+
pip uninstall -interactive-dashboard-editor
119+
```
120+
121+
For JupyterLab 2.x:
122+
102123
```bash
103124
jupyter labextension uninstall jupyterlab-interactive-dashboard-editor
104125
```

binder/postBuild

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ rm -rf design
1010
rm -rf .github
1111
rm -rf binder
1212
rm -rf docs
13-
rm -rf jupyterlab_interactive_dashboard_editor
13+
rm -rf jupyterlab-interactive-dashboard-editor
1414
rm package.json
1515
rm tsconfig.json
1616
rm yarn.lock

docs/getting_started/installation.rst

Lines changed: 41 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,41 +9,64 @@ JupyterLab >= 2.0
99

1010
Install
1111
~~~~~~~
12-
Note: You will need NodeJS to install the extension.
12+
For JupyterLab 3+:
1313

1414
.. code:: bash
1515
16-
pip install jupyterlab_interactive_dashboard_editor
16+
pip install jupyterlab-interactive-dashboard-editor
17+
18+
For JupyterLab 2.x:
19+
20+
.. code:: bash
21+
22+
jupyter labextension install jupyterlab-interactive-dashboard-editor
1723
jupyter lab build
1824
25+
Note: You will need NodeJS to install the extension for JupyterLab 2.x.
26+
27+
Developement install:
28+
1929
.. code:: bash
2030
2131
# Clone the repo to your local environment
2232
# Move to jupyterlab-interactive-dashboard-editor directory
2333
24-
# Install dependencies
25-
jlpm
26-
# Build Typescript source
27-
jlpm build
34+
# Clone the repo to your local environment
35+
# Change directory to the jupyterlab-interactive-dashboard-editor directory
36+
# Install package in development mode
37+
pip install -e .
2838
# Link your development version of the extension with JupyterLab
29-
jupyter labextension install .
30-
# Rebuild Typescript source after making changes
31-
jlpm build
32-
# Rebuild JupyterLab after making any changes
33-
jupyter lab build
39+
jupyter labextension develop . --overwrite
40+
# Rebuild extension Typescript source after making changes
41+
jlpm run build
42+
3443
35-
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.
44+
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.
3645

3746
.. code:: bash
3847
39-
# Watch the source directory in another terminal tab
40-
jlpm watch
41-
# Run jupyterlab in watch mode in one terminal tab
42-
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
52+
53+
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).
54+
55+
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:
56+
57+
.. code:: bash
58+
jupyter lab build --minimize=False
4359
44-
Now every change will be built locally and bundled into JupyterLab. Be sure to refresh your browser page after saving file changes to reload the extension (note: you'll need to wait for webpack to finish, which can take 10s+ at times).
4560
4661
Uninstall
4762
~~~~~~~~~
63+
64+
For JupyterLab 3+:
65+
66+
.. code:: bash
67+
pip uninstall jupyterlab-interactive-dashboard-editor
68+
69+
For JupyterLab 2.x:
70+
4871
.. code:: bash
49-
jupyter labextension uninstall jupyterlab-interactive-dashboard-editor
72+
jupyter labextension uninstall jupyterlab-interactive-dashboard-editor

install.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"packageManager": "python",
3+
"packageName": "jupyterlab-interactive-dashboard-editor",
4+
"uninstallInstructions": "Use your Python package manager (pip, conda, etc.) to uninstall the package jupyterlab-interactive-dashboard-editor"
5+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
2+
import json
3+
from pathlib import Path
4+
5+
from ._version import __version__
6+
7+
HERE = Path(__file__).parent.resolve()
8+
9+
with (HERE / "labextension" / "package.json").open() as fid:
10+
data = json.load(fid)
11+
12+
def _jupyter_labextension_paths():
13+
return [{
14+
"src": "labextension",
15+
"dest": data["name"]
16+
}]
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import json
2+
from pathlib import Path
3+
4+
__all__ = ["__version__"]
5+
6+
def _fetchVersion():
7+
HERE = Path(__file__).parent.resolve()
8+
9+
for settings in HERE.rglob("package.json"):
10+
try:
11+
with settings.open() as f:
12+
return json.load(f)["version"]
13+
except FileNotFoundError:
14+
pass
15+
16+
raise FileNotFoundError(f"Could not find package.json under dir {HERE!s}")
17+
18+
__version__ = _fetchVersion()
19+

0 commit comments

Comments
 (0)