Skip to content

Commit bb7c1a7

Browse files
authored
Merge pull request #82 from MetaCell/refactor-sync
Jupyter extension refactor
2 parents 07eebc5 + dc5a594 commit bb7c1a7

8 files changed

Lines changed: 124 additions & 215 deletions

File tree

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "netpyne_ui/geppetto"]
2+
path = netpyne_ui/geppetto
3+
url = https://github.com/openworm/org.geppetto.frontend.git

Dockerfile_dev

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,4 @@ RUN /bin/bash -c "source activate snakes && exec python install.py branch $netpy
6060
WORKDIR /home/jovyan
6161
RUN git clone https://github.com/Neurosim-lab/netpyne_workspace
6262
WORKDIR /home/jovyan/netpyne_workspace
63-
CMD /bin/bash -c "source activate snakes && exec jupyter notebook --debug --NotebookApp.default_url=/geppetto --NotebookApp.token=''"
63+
CMD /bin/bash -c "source activate snakes && exec jupyter notebook --debug --NotebookApp.default_url=/geppetto --NotebookApp.token='' --library=netpyne_ui"

NetPyNE-UI

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
#!/bin/sh
2-
exec jupyter notebook --NotebookApp.default_url=/geppetto --NotebookApp.token=''
2+
exec jupyter notebook --NotebookApp.default_url=/geppetto --NotebookApp.token='' --library=netpyne_ui

netpyne_ui/geppetto

Submodule geppetto added at 0077835

netpyne_ui/netpyne_geppetto.py

Lines changed: 83 additions & 200 deletions
Large diffs are not rendered by default.

setup.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
1-
from setuptools import setup, find_packages
1+
import setuptools
2+
import fnmatch
3+
import os
4+
from glob import glob
25

3-
setup(
6+
#This block copies resources to the server so we avoid jupyter nbextension install --py --sys-prefix jupyter_geppetto
7+
data_files = []
8+
data_files.append(('geppetto/src/main/webapp/build/', glob('src/jupyter_geppetto/geppetto/src/main/webapp/build/*.js')))
9+
data_files.append(('geppetto/src/main/webapp/build/', glob('src/jupyter_geppetto/geppetto/src/main/webapp/build/*.vm')))
10+
data_files.append(('geppetto/geppetto/src/main/webapp/build/', glob('src/jupyter_geppetto/geppetto/src/main/webapp/build/fonts/*')))
11+
for root, dirnames, filenames in os.walk('src/jupyter_geppetto/geppetto/src/main/webapp/js/'):
12+
for filename in fnmatch.filter(filenames, '*'):
13+
data_files.append((root[3:], [os.path.join(root, filename)]))
14+
15+
16+
setuptools.setup(
417
name="netpyne_ui",
518
version="0.4",
619
url="https://github.com/MetaCell/NetPyNE-UI",
@@ -9,7 +22,8 @@
922
description="NetPyNE User interface",
1023
license="MIT",
1124
long_description=open('README.rst').read(),
12-
packages=find_packages(),
25+
data_files=data_files,
26+
packages=setuptools.find_packages(),
1327
package_data={
1428
'': ['*.hoc']
1529
},

utilities/gitall.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@
3535
},
3636
{
3737
"name": "org.geppetto.frontend",
38-
"path": "../org.geppetto.frontend.jupyter/src/jupyter_geppetto/geppetto/",
38+
"path": "../netpyne_ui/geppetto/",
3939
"url": "https://github.com/openworm/org.geppetto.frontend"
4040
},
4141
{
4242
"name": "Geppetto Netpyne extension",
43-
"path": "../org.geppetto.frontend.jupyter/src/jupyter_geppetto/geppetto/src/main/webapp/extensions/geppetto-netpyne/",
43+
"path": "../netpyne_ui/geppetto/src/main/webapp/extensions/geppetto-netpyne/",
4444
"url": "https://github.com/MetaCell/geppetto-netpyne"
4545
}
4646
]

utilities/install.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,16 @@
99

1010
#by default clones branch (which can be passed as a parameter python install.py branch test_branch)
1111
#if branch doesnt exist clones the default_branch
12-
def clone(repository, folder, default_branch, cwdp='', recursive = False):
12+
def clone(repository, folder, default_branch, cwdp='', recursive = False, destination_folder = None):
1313
global branch
1414
print("Cloning "+repository)
1515
if recursive:
1616
subprocess.call(['git', 'clone', '--recursive', repository], cwd='./'+cwdp)
1717
else:
18-
subprocess.call(['git', 'clone', repository], cwd='./'+cwdp)
18+
if destination_folder:
19+
subprocess.call(['git', 'clone', repository, destination_folder], cwd='./'+cwdp)
20+
else:
21+
subprocess.call(['git', 'clone', repository], cwd='./'+cwdp)
1922
checkout(folder, default_branch, cwdp)
2023

2124
def checkout(folder, default_branch, cwdp):
@@ -49,18 +52,23 @@ def main(argv):
4952
clone('https://github.com/Neurosim-lab/netpyne.git','netpyne','ui')
5053
subprocess.call(['pip', 'install', '-e', '.'], cwd='./netpyne/')
5154

52-
clone('https://github.com/openworm/org.geppetto.frontend.jupyter.git','org.geppetto.frontend.jupyter','development','', True )
53-
checkout('geppetto', 'development','org.geppetto.frontend.jupyter/src/jupyter_geppetto/')
54-
clone('https://github.com/MetaCell/geppetto-netpyne.git','geppetto-netpyne','development','org.geppetto.frontend.jupyter/src/jupyter_geppetto/geppetto/src/main/webapp/extensions/')
55+
clone('https://github.com/openworm/org.geppetto.frontend.jupyter.git','org.geppetto.frontend.jupyter','development')
56+
subprocess.call(['npm', 'install'], cwd='./org.geppetto.frontend.jupyter/js')
57+
subprocess.call(['npm', 'run', 'build-dev'], cwd='./org.geppetto.frontend.jupyter/js')
58+
59+
#subprocess.call(['git', 'submodule', 'update', '--init'], cwd='./')
60+
clone('https://github.com/openworm/org.geppetto.frontend.git','geppetto','development','netpyne_ui/', False, 'geppetto')
61+
# checkout('geppetto', 'development','org.geppetto.frontend.jupyter/src/jupyter_geppetto/')
62+
clone('https://github.com/MetaCell/geppetto-netpyne.git','geppetto-netpyne','development','netpyne_ui/geppetto/src/main/webapp/extensions/')
5563

5664
print("Enabling Geppetto NetPyNE Extension ...")
5765
geppetto_configuration = os.path.join(os.path.dirname(__file__), './utilities/GeppettoConfiguration.json')
58-
copyfile(geppetto_configuration, './org.geppetto.frontend.jupyter/src/jupyter_geppetto/geppetto/src/main/webapp/GeppettoConfiguration.json')
66+
copyfile(geppetto_configuration, './netpyne_ui/geppetto/src/main/webapp/GeppettoConfiguration.json')
5967

6068
# Installing and building
6169
print("NPM Install and build for Geppetto Frontend ...")
62-
subprocess.call(['npm', 'install'], cwd='./org.geppetto.frontend.jupyter/src/jupyter_geppetto/geppetto/src/main/webapp/')
63-
subprocess.call(['npm', 'run', 'build-dev-noTest'], cwd='./org.geppetto.frontend.jupyter/src/jupyter_geppetto/geppetto/src/main/webapp/')
70+
subprocess.call(['npm', 'install'], cwd='./netpyne_ui/geppetto/src/main/webapp/')
71+
subprocess.call(['npm', 'run', 'build-dev-noTest'], cwd='./netpyne_ui/geppetto/src/main/webapp/')
6472

6573
print("Installing jupyter_geppetto python package ...")
6674
subprocess.call(['pip', 'install', '-e', '.'], cwd='./org.geppetto.frontend.jupyter')

0 commit comments

Comments
 (0)