Skip to content

Commit c17acbb

Browse files
committed
regenerate from JupyterLab 3 template
jupyter-widgets/widget-cookiecutter@a368113
1 parent ea38822 commit c17acbb

20 files changed

+516
-0
lines changed

.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
*.egg-info/
2+
.ipynb_checkpoints/
3+
dist/
4+
build/
5+
*.py[cod]
6+
node_modules/
7+
8+
# Compiled javascript
9+
idom_jupyter/nbextension/
10+
idom_jupyter/labextension/
11+
12+
# OS X
13+
.DS_Store

MANIFEST.in

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
graft idom_jupyter/nbextension
2+
graft idom_jupyter/labextension
3+
4+
graft js
5+
graft tests
6+
prune **/node_modules
7+
8+
include idom-client-jupyter.json
9+
10+
include LICENSE
11+
include setup.py
12+
include pyproject.toml
13+
include install.json
14+
15+
# Patterns to exclude from any directory
16+
global-exclude *~
17+
global-exclude *.pyc
18+
global-exclude *.pyo
19+
global-exclude .git
20+
global-exclude .ipynb_checkpoints
21+
global-exclude *.map

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
idom-jupyter
2+
===============================
3+
4+
A client for IDOM implemented using Jupyter widgets
5+
6+
Installation
7+
------------
8+
9+
To install use pip:
10+
11+
$ pip install idom_jupyter
12+
13+
For a development installation (requires [Node.js](https://nodejs.org) and [Yarn version 1](https://classic.yarnpkg.com/)),
14+
15+
$ git clone https://github.com/idom-team/idom-jupyter.git
16+
$ cd idom-jupyter
17+
$ pip install -e .
18+
$ jupyter nbextension install --py --symlink --overwrite --sys-prefix idom_jupyter
19+
$ jupyter nbextension enable --py --sys-prefix idom_jupyter
20+
21+
When actively developing your extension for JupyterLab, run the command:
22+
23+
$ jupyter labextension develop --overwrite idom_jupyter
24+
25+
Then you need to rebuild the JS when you make a code change:
26+
27+
$ cd js
28+
$ yarn run build
29+
30+
You then need to refresh the JupyterLab page when your javascript changes.

RELEASE.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
- To release a new version of idom_jupyter on PyPI:
2+
3+
Update _version.py (set release version, remove 'dev')
4+
git add the _version.py file and git commit
5+
`python setup.py sdist upload`
6+
`python setup.py bdist_wheel upload`
7+
`git tag -a X.X.X -m 'comment'`
8+
Update _version.py (add 'dev' and increment minor)
9+
git add and git commit
10+
git push
11+
git push --tags
12+
13+
- To release a new version of idom-client-jupyter on NPM:
14+
15+
Update `js/package.json` with new npm package version
16+
17+
```
18+
# clean out the `dist` and `node_modules` directories
19+
git clean -fdx
20+
npm install
21+
npm publish
22+
```

idom-client-jupyter.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"load_extensions": {
3+
"idom-client-jupyter/extension": true
4+
}
5+
}

idom_jupyter/__init__.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
from ._version import version_info, __version__
2+
3+
from .example import *
4+
5+
6+
def _jupyter_labextension_paths():
7+
"""Called by Jupyter Lab Server to detect if it is a valid labextension and
8+
to install the widget
9+
10+
Returns
11+
=======
12+
src: Source directory name to copy files from. Webpack outputs generated files
13+
into this directory and Jupyter Lab copies from this directory during
14+
widget installation
15+
dest: Destination directory name to install widget files to. Jupyter Lab copies
16+
from `src` directory into <jupyter path>/labextensions/<dest> directory
17+
during widget installation
18+
"""
19+
return [{
20+
'src': 'labextension',
21+
'dest': 'idom-client-jupyter',
22+
}]
23+
24+
25+
def _jupyter_nbextension_paths():
26+
"""Called by Jupyter Notebook Server to detect if it is a valid nbextension and
27+
to install the widget
28+
29+
Returns
30+
=======
31+
section: The section of the Jupyter Notebook Server to change.
32+
Must be 'notebook' for widget extensions
33+
src: Source directory name to copy files from. Webpack outputs generated files
34+
into this directory and Jupyter Notebook copies from this directory during
35+
widget installation
36+
dest: Destination directory name to install widget files to. Jupyter Notebook copies
37+
from `src` directory into <jupyter path>/nbextensions/<dest> directory
38+
during widget installation
39+
require: Path to importable AMD Javascript module inside the
40+
<jupyter path>/nbextensions/<dest> directory
41+
"""
42+
return [{
43+
'section': 'notebook',
44+
'src': 'nbextension',
45+
'dest': 'idom-client-jupyter',
46+
'require': 'idom-client-jupyter/extension'
47+
}]

idom_jupyter/_version.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Module version
2+
version_info = (0, 1, 0, 'alpha', 0)
3+
4+
# Module version stage suffix map
5+
_specifier_ = {'alpha': 'a', 'beta': 'b', 'candidate': 'rc', 'final': ''}
6+
7+
# Module version accessible using idom_jupyter.__version__
8+
__version__ = '%s.%s.%s%s'%(version_info[0], version_info[1], version_info[2],
9+
'' if version_info[3]=='final' else _specifier_[version_info[3]]+str(version_info[4]))

idom_jupyter/example.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import ipywidgets as widgets
2+
from traitlets import Unicode
3+
4+
# See js/lib/example.js for the frontend counterpart to this file.
5+
6+
@widgets.register
7+
class HelloWorld(widgets.DOMWidget):
8+
"""An example widget."""
9+
10+
# Name of the widget view class in front-end
11+
_view_name = Unicode('HelloView').tag(sync=True)
12+
13+
# Name of the widget model class in front-end
14+
_model_name = Unicode('HelloModel').tag(sync=True)
15+
16+
# Name of the front-end module containing widget view
17+
_view_module = Unicode('idom-client-jupyter').tag(sync=True)
18+
19+
# Name of the front-end module containing widget model
20+
_model_module = Unicode('idom-client-jupyter').tag(sync=True)
21+
22+
# Version of the front-end module containing widget view
23+
_view_module_version = Unicode('^0.4.0').tag(sync=True)
24+
# Version of the front-end module containing widget model
25+
_model_module_version = Unicode('^0.4.0').tag(sync=True)
26+
27+
# Widget specific property.
28+
# Widget properties are defined as traitlets. Any property tagged with `sync=True`
29+
# is automatically synced to the frontend *any* time it changes in Python.
30+
# It is synced back to Python from the frontend *any* time the model is touched.
31+
value = Unicode('Hello World!').tag(sync=True)

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

js/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
A client for IDOM implemented using Jupyter widgets
2+
3+
Package Install
4+
---------------
5+
6+
**Prerequisites**
7+
- [node](http://nodejs.org/)
8+
9+
```bash
10+
npm install --save idom-client-jupyter
11+
```

0 commit comments

Comments
 (0)