Skip to content

Commit c641c6d

Browse files
Merge pull request #317 from krassowski/jupyterlab-3
Update for JupyterLab 3.0
2 parents 507bf9f + def91e4 commit c641c6d

26 files changed

+312
-114
lines changed

.eslintrc.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,16 @@ module.exports = {
1212
},
1313
plugins: ['@typescript-eslint'],
1414
rules: {
15-
'@typescript-eslint/interface-name-prefix': [
15+
'@typescript-eslint/naming-convention': [
1616
'error',
17-
{ prefixWithI: 'always' }
17+
{
18+
'selector': 'interface',
19+
'format': ['PascalCase'],
20+
'custom': {
21+
'regex': '^I[A-Z]',
22+
'match': true
23+
}
24+
}
1825
],
1926
'@typescript-eslint/no-unused-vars': ['warn', { args: 'none' }],
2027
'@typescript-eslint/no-explicit-any': 'off',

.github/workflows/build.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- name: Checkout
14-
uses: actions/checkout@v1
14+
uses: actions/checkout@v2
1515
- name: Install node
1616
uses: actions/setup-node@v1
1717
with:
1818
node-version: '10.x'
1919
- name: Install Python
20-
uses: actions/setup-python@v1
20+
uses: actions/setup-python@v2
2121
with:
2222
python-version: '3.7'
2323
architecture: 'x64'
@@ -27,7 +27,7 @@ jobs:
2727
run: |
2828
jlpm
2929
jlpm run eslint:check
30+
python -m pip install .
3031
31-
jupyter labextension install .
32-
32+
jupyter labextension list 2>&1 | grep -ie "jupyterlab-tabular-data-editor.*OK"
3333
python -m jupyterlab.browser_check

.prettierrc

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

MANIFEST.in

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
include LICENSE
2+
include README.md
3+
include pyproject.toml
4+
include jupyter-config/jupyterlab-tabular-data-editor.json
5+
6+
include package.json
7+
include install.json
8+
include ts*.json
9+
include yarn.lock
10+
11+
graft jupyterlab-tabular-data-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: 42 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
### EXPERIMENTAL: This extension is still in alpha. The API is subject to frequent changes.
1010

11-
![](design/gifs/showcase.gif)
11+
![](https://raw.githubusercontent.com/jupytercalpoly/jupyterlab-tabular-data-editor/master/design/gifs/showcase.gif)
1212

1313
Try our extension [here](https://mybinder.org/v2/gh/jupytercalpoly/jupyterlab-tabular-data-editor/master?urlpath=lab)!
1414

@@ -25,31 +25,31 @@ See our progress as of 08/27/2020 from these [slides](https://docs.google.com/pr
2525
<summary>View Extension Highlights</summary>
2626
<br>
2727
<h3>Launch new files and quickly add rows and columns</h3>
28-
<img src="design/gifs/csvlauncher.gif" alt="gif of launching a new csv file within JupyterLab">
28+
<img src="https://raw.githubusercontent.com/jupytercalpoly/jupyterlab-tabular-data-editor/master/design/gifs/csvlauncher.gif" alt="gif of launching a new csv file within JupyterLab">
2929

3030
<br>
3131
<br>
3232

3333
<h3>Seamlessly rearrange your data table</h3>
34-
<img src="design/gifs/moving.gif" alt="gif of moving rows and columns within JupyterLab">
34+
<img src="https://raw.githubusercontent.com/jupytercalpoly/jupyterlab-tabular-data-editor/master/design/gifs/moving.gif" alt="gif of moving rows and columns within JupyterLab">
3535

3636
<br>
3737
<br>
3838

3939
<h3>Insert and remove multiple rows and columns</h3>
40-
<img src="design/gifs/multiremoveandinsert.gif" alt="gif of removing and inserting multiple rows and columns within JupyterLab">
40+
<img src="https://raw.githubusercontent.com/jupytercalpoly/jupyterlab-tabular-data-editor/master/design/gifs/multiremoveandinsert.gif" alt="gif of removing and inserting multiple rows and columns within JupyterLab">
4141

4242
<br>
4343
<br>
4444

4545
<h3>Format your data with a click of a button</h3>
46-
<img src="design/gifs/auto-format.gif" alt="gif of toggling on a mode that formats data based on data types within JupyterLab">
46+
<img src="https://raw.githubusercontent.com/jupytercalpoly/jupyterlab-tabular-data-editor/master/design/gifs/auto-format.gif" alt="gif of toggling on a mode that formats data based on data types within JupyterLab">
4747

4848
<br>
4949
<br>
5050

5151
<h3>Search and replace with ease</h3>
52-
<img src="design/gifs/searchandreplace.gif" alt="gif of searching and replacing a word within a large file within JupyterLab">
52+
<img src="https://raw.githubusercontent.com/jupytercalpoly/jupyterlab-tabular-data-editor/master/design/gifs/searchandreplace.gif" alt="gif of searching and replacing a word within a large file within JupyterLab">
5353
</details>
5454

5555
## Requirements
@@ -58,48 +58,66 @@ See our progress as of 08/27/2020 from these [slides](https://docs.google.com/pr
5858

5959
## Install
6060

61+
JupyterLab 3:
62+
63+
```bash
64+
pip install jupyterlab-tabular-data-editor
65+
```
66+
67+
JupyterLab 2:
68+
6169
```bash
6270
jupyter labextension install jupyterlab-tabular-data-editor
6371
```
6472

6573
## Contributing
6674

67-
### Install
75+
### Development install
76+
77+
Note: You will need NodeJS to build the extension package.
6878

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

7383
```bash
7484
# Clone the repo to your local environment
75-
# Move to jupyterlab-tabular-data-editor directory
76-
77-
# Install dependencies
78-
jlpm
79-
# Build Typescript source
80-
jlpm build
85+
# Change directory to the jupyterlab-tabular-data-editor directory
86+
# Install package in development mode
87+
pip install -e .
8188
# 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
89+
jupyter labextension develop . --overwrite
90+
# Rebuild extension Typescript source after making changes
91+
jlpm run build
8792
```
8893

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.
94+
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.
9095

9196
```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
97+
# Watch the source directory in one terminal, automatically rebuilding when needed
98+
jlpm run watch
99+
# Run JupyterLab in another terminal
100+
jupyter lab
96101
```
97102

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).
103+
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).
104+
105+
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:
106+
107+
```bash
108+
jupyter lab build --minimize=False
109+
```
99110

100111
### Uninstall
101112

113+
For JupyterLab 3:
114+
102115
```bash
116+
pip uninstall jupyterlab-tabular-data-editor
117+
```
118+
119+
For JupyterLab 2:
103120

121+
```bash
104122
jupyter labextension uninstall jupyterlab-tabular-data-editor
105123
```

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-tabular-data-editor",
4+
"uninstallInstructions": "Use your Python package manager (pip, conda, etc.) to uninstall the package jupyterlab-tabular-data-editor"
5+
}

jest.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module.exports = {
99
setupFiles: ['<rootDir>/testutils/jest-setup-files.js'],
1010
testPathIgnorePatterns: ['/lib/', '/node_modules/'],
1111
transformIgnorePatterns: [
12-
'/node_modules/(?!(@jupyterlab/.*|tde-csvviewer)/)'
12+
'/node_modules/(?!(@jupyterlab/.*)/)'
1313
],
1414

1515
globals: {
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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+
}]
17+
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)