Skip to content

Commit e3ef6b7

Browse files
authored
Merge pull request #126 from MetaCell/feature/125
Feature/125 update jupyter geppetto
2 parents e6086f0 + de1deb8 commit e3ef6b7

6 files changed

Lines changed: 44 additions & 16 deletions

File tree

netpyne_ui/netpyne_geppetto.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def simulateNetPyNEModelInGeppetto(self, args):
9898
logging.debug('Running single thread simulation')
9999
netpyne_model = self.simulateNetPyNEModel()
100100

101-
return json.loads(GeppettoModelSerializer().serialize(self.geppetto_model))
101+
return json.loads(GeppettoModelSerializer.serialize(self.geppetto_model))
102102
except:
103103
return utils.getJSONError("Error while simulating the NetPyNE model", sys.exc_info())
104104

netpyne_ui/netpyne_model_interpreter.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ def getGeppettoModel(self, netpyne_model):
1818

1919
# We create a GeppettoModel instance and we set a name a assign a lib
2020
geppetto_model = self.factory.createGeppettoModel('NetPyNEModel')
21+
self.factory.geppetto_common_library = geppetto_model.libraries[0]
2122
netpyne_geppetto_library = pygeppetto.GeppettoLibrary(
2223
name='netpynelib')
2324
geppetto_model.libraries.append(netpyne_geppetto_library)
@@ -44,6 +45,7 @@ def extractPopulations(self, netpyne_model, netpyne_geppetto_library, geppetto_m
4445
composite_id = cell['tags']['pop'] + "_cell"
4546

4647
cellType = pygeppetto.CompositeType(id=str(composite_id), name=str(composite_id), abstract= False)
48+
4749
visualType = pygeppetto.CompositeVisualType(id='cellMorphology', name='cellMorphology')
4850
cellType.visualType = visualType
4951
defaultValue = ArrayValue(elements=[])

run.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
'''
2+
Run this to debug
3+
'''
4+
import sys
5+
import os
6+
from notebook.notebookapp import main, NotebookApp
7+
import netpyne_ui
8+
from jupyter_geppetto import settings
9+
10+
settings.debug = True
11+
12+
if __name__ == '__main__':
13+
sys.argv.append('--NotebookApp.default_url=/geppetto')
14+
sys.argv.append("--NotebookApp.token=''")
15+
sys.argv.append('--library=netpyne_ui')
16+
17+
app = NotebookApp.instance()
18+
app.initialize(sys.argv)
19+
app.file_to_run = ''
20+
sys.exit(app.start())
21+

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
'Programming Language :: Python :: 3.7'
3838
],
3939
install_requires=[
40-
'jupyter_geppetto==0.4.2',
40+
'jupyter-geppetto>=1.0.0',
4141
'netpyne==0.9.1.1'
4242
],
4343
)

utilities/GeppettoConfiguration.json renamed to utilities/GeppettoConfiguration.copyme.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"_README" : "http://docs.geppetto.org/en/latest/build.html",
3-
"contextPath": "org.geppetto.frontend/",
3+
"contextPath": "org.geppetto.frontend",
44
"useSsl": false,
55
"embedded": false,
66
"embedderURL": ["/"],

utilities/install.py

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ def checkout(folder, default_branch, cwdp):
2727
newPath = currentPath+"/"+cwdp+folder
2828
print(newPath)
2929
os.chdir(newPath)
30-
python_git=subprocess.Popen("git branch -a",shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
30+
python_git = subprocess.Popen("git branch -a && git tag", shell=True, stdout=subprocess.PIPE,
31+
stderr=subprocess.PIPE)
3132
outstd,errstd=python_git.communicate()
3233
if branch and branch in str(outstd) and branch != 'development': # don't ckeckout development for netpyne
3334
subprocess.call(['git', 'checkout', branch], cwd='./')
@@ -45,25 +46,29 @@ def main(argv):
4546
main(sys.argv[1:])
4647

4748
os.chdir(os.getcwd()+"/../")
48-
# Cloning Repos
49-
clone('https://github.com/openworm/pygeppetto.git','pygeppetto','development')
50-
subprocess.call(['pip', 'install', '-e', '.'], cwd='./pygeppetto/')
49+
5150

5251
clone('https://github.com/Neurosim-lab/netpyne.git','netpyne','ui')
5352
subprocess.call(['pip', 'install', '-e', '.'], cwd='./netpyne/')
5453

55-
clone('https://github.com/openworm/org.geppetto.frontend.jupyter.git','org.geppetto.frontend.jupyter','development')
56-
with open('npm_frontend_jupyter_log', 'a') as stdout:
57-
subprocess.call(['npm', 'install'], cwd='./org.geppetto.frontend.jupyter/js', stdout=stdout)
58-
subprocess.call(['npm', 'run', 'build-dev'], cwd='./org.geppetto.frontend.jupyter/js')
54+
5955

6056
# We can't clone org.geppetto.frontend as a regular submodule because Travis doesn't have .gitmodules in the zip
6157
# subprocess.call(['git', 'submodule', 'update', '--init'], cwd='./')
6258
clone('https://github.com/openworm/org.geppetto.frontend.git','geppetto','development','netpyne_ui/', False, 'geppetto')
6359
clone('https://github.com/MetaCell/geppetto-netpyne.git','geppetto-netpyne','development','netpyne_ui/geppetto/src/main/webapp/extensions/')
6460

61+
branch = None
62+
# Cloning Repos
63+
clone('https://github.com/openworm/pygeppetto.git','pygeppetto','development')
64+
subprocess.call(['pip', 'install', '-e', '.'], cwd='./pygeppetto/')
65+
clone('https://github.com/openworm/org.geppetto.frontend.jupyter.git','org.geppetto.frontend.jupyter','development')
66+
with open('npm_frontend_jupyter_log', 'a') as stdout:
67+
subprocess.call(['npm', 'install'], cwd='./org.geppetto.frontend.jupyter/js', stdout=stdout)
68+
subprocess.call(['npm', 'run', 'build-dev'], cwd='./org.geppetto.frontend.jupyter/js')
69+
6570
print("Enabling Geppetto NetPyNE Extension ...")
66-
geppetto_configuration = os.path.join(os.path.dirname(__file__), './utilities/GeppettoConfiguration.json')
71+
geppetto_configuration = os.path.join(os.path.dirname(__file__), './utilities/GeppettoConfiguration.copyme.json')
6772
copyfile(geppetto_configuration, './netpyne_ui/geppetto/src/main/webapp/GeppettoConfiguration.json')
6873

6974
# Installing and building
@@ -75,10 +80,10 @@ def main(argv):
7580
print("Installing jupyter_geppetto python package ...")
7681
subprocess.call(['pip', 'install', '-e', '.'], cwd='./org.geppetto.frontend.jupyter')
7782
print("Installing jupyter_geppetto Jupyter Extension ...")
78-
subprocess.call(['jupyter', 'nbextension', 'install', '--py', '--symlink', '--user', 'jupyter_geppetto'], cwd='./org.geppetto.frontend.jupyter')
79-
subprocess.call(['jupyter', 'nbextension', 'enable', '--py', '--user', 'jupyter_geppetto'], cwd='./org.geppetto.frontend.jupyter')
80-
subprocess.call(['jupyter', 'nbextension', 'enable', '--py', 'widgetsnbextension'], cwd='./org.geppetto.frontend.jupyter')
81-
subprocess.call(['jupyter', 'serverextension', 'enable', '--py', 'jupyter_geppetto'], cwd='./org.geppetto.frontend.jupyter')
83+
subprocess.call(['jupyter', 'nbextension', 'install', '--py', '--symlink', '--sys-prefix', 'jupyter_geppetto'], cwd='./org.geppetto.frontend.jupyter')
84+
subprocess.call(['jupyter', 'nbextension', 'enable', '--py', '--sys-prefix', 'jupyter_geppetto'], cwd='./org.geppetto.frontend.jupyter')
85+
subprocess.call(['jupyter', 'nbextension', 'enable', '--py', '--sys-prefix', 'widgetsnbextension'], cwd='./org.geppetto.frontend.jupyter')
86+
subprocess.call(['jupyter', 'serverextension', 'enable', '--sys-prefix', '--py', 'jupyter_geppetto'], cwd='./org.geppetto.frontend.jupyter')
8287

8388
print("Installing NetPyNE UI python package ...")
8489
subprocess.call(['pip', 'install', '-e', '.'], cwd='.')

0 commit comments

Comments
 (0)