Skip to content

Commit 6186fc1

Browse files
polish it
1 parent 9e56751 commit 6186fc1

File tree

3 files changed

+28
-3
lines changed

3 files changed

+28
-3
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,8 @@ jupyter nbextension install --py --symlink --sys-prefix pythreejs
7474
# To clean out generated files, run:
7575
npm run clean
7676

77+
# To symlink the jupyter lab extension
78+
jupyter labextension develop .. --overwrite
79+
80+
7781
```

js/scripts/templates/py_top_level_init.mustache

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,25 @@ from __future__ import absolute_import
88
from {{ module.pyRelativePath }} import *
99
{{/each}}
1010

11+
12+
def _prefix():
13+
import sys
14+
from pathlib import Path
15+
prefix = sys.prefix
16+
here = Path(__file__).parent
17+
# for when in dev mode
18+
if (here.parent / 'setup.py').exists():
19+
prefix = here.parent
20+
return prefix
21+
22+
23+
def _jupyter_labextension_paths():
24+
return [{
25+
'src': f'{_prefix()}/share/jupyter/labextensions/{npm_pkg_name}/',
26+
'dest': f'{npm_pkg_name}',
27+
}]
28+
29+
1130
def _jupyter_nbextension_paths():
1231
return [{
1332
'section': 'notebook',

setup.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@
1616
from setuptools import setup
1717

1818

19-
log.set_verbosity(log.DEBUG)
20-
log.info('setup.py entered')
21-
log.info('$PATH=%s' % os.environ['PATH'])
19+
# due to https://github.com/jupyterlab/jupyterlab/blob/136d2ec216ebfc429a696e6ee75fee5f8ead73e2/jupyterlab/federated_labextensions.py#L347
20+
# we should not print out anything, otherwise setup.py --name gives noise
21+
# log.set_verbosity(log.DEBUG)
22+
# log.info('setup.py entered')
23+
# log.info('$PATH=%s' % os.environ['PATH'])
2224

2325
LONG_DESCRIPTION = 'A Python/ThreeJS bridge utilizing the Jupyter widget infrastructure.'
2426

0 commit comments

Comments
 (0)