Skip to content

Commit 9ef7629

Browse files
committed
Force enabling serverextension in develop mode
1 parent 5d84082 commit 9ef7629

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

README.md

-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ cd jupyterlab-git
101101
102102
# Install the server extension in development mode and enable it
103103
pip install -e .[test]
104-
jupyter serverextension enable --py jupyterlab_git
105104
106105
# Build the labextension and dev-mode link it to jlab
107106
jlpm build

setup.py

+31-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
)
1313

1414
import setuptools
15+
from setuptools.command.develop import develop
1516

1617
# The name of the project
1718
name='jupyterlab_git'
@@ -38,9 +39,38 @@ def runPackLabextension():
3839
pass
3940
pack_labext = command_for_func(runPackLabextension)
4041

42+
class DevelopAndEnable(develop):
43+
def run(self):
44+
develop.run(self)
45+
46+
list_cmd = [
47+
'jupyter',
48+
'serverextension',
49+
'list'
50+
]
51+
enable_cmd = [
52+
'jupyter',
53+
'serverextension',
54+
'enable',
55+
'--py',
56+
'jupyterlab_git'
57+
]
58+
59+
# test if `jupyter` cmd is available
60+
try:
61+
run(list_cmd)
62+
except:
63+
print('`jupyter` cmd not installed, skipping serverextension activation...')
64+
return
65+
66+
print('Enabling serverextension...')
67+
run(enable_cmd)
68+
69+
70+
4171
cmdclass = create_cmdclass('pack_labext', data_files_spec=data_files_spec)
4272
cmdclass['pack_labext'] = pack_labext
43-
cmdclass.pop('develop')
73+
cmdclass['develop'] = DevelopAndEnable
4474

4575
with open("README.md", "r") as fh:
4676
long_description = fh.read()

0 commit comments

Comments
 (0)