diff --git a/netpyne_ui/netpyne_geppetto.py b/netpyne_ui/netpyne_geppetto.py index 0a1b27b1..bb5e41a8 100644 --- a/netpyne_ui/netpyne_geppetto.py +++ b/netpyne_ui/netpyne_geppetto.py @@ -98,7 +98,7 @@ def simulateNetPyNEModelInGeppetto(self, args): logging.debug('Running single thread simulation') netpyne_model = self.simulateNetPyNEModel() - return json.loads(GeppettoModelSerializer().serialize(self.geppetto_model)) + return json.loads(GeppettoModelSerializer.serialize(self.geppetto_model)) except: return utils.getJSONError("Error while simulating the NetPyNE model", sys.exc_info()) diff --git a/netpyne_ui/netpyne_model_interpreter.py b/netpyne_ui/netpyne_model_interpreter.py index fced8523..9526b494 100644 --- a/netpyne_ui/netpyne_model_interpreter.py +++ b/netpyne_ui/netpyne_model_interpreter.py @@ -18,6 +18,7 @@ def getGeppettoModel(self, netpyne_model): # We create a GeppettoModel instance and we set a name a assign a lib geppetto_model = self.factory.createGeppettoModel('NetPyNEModel') + self.factory.geppetto_common_library = geppetto_model.libraries[0] netpyne_geppetto_library = pygeppetto.GeppettoLibrary( name='netpynelib') geppetto_model.libraries.append(netpyne_geppetto_library) @@ -44,6 +45,7 @@ def extractPopulations(self, netpyne_model, netpyne_geppetto_library, geppetto_m composite_id = cell['tags']['pop'] + "_cell" cellType = pygeppetto.CompositeType(id=str(composite_id), name=str(composite_id), abstract= False) + visualType = pygeppetto.CompositeVisualType(id='cellMorphology', name='cellMorphology') cellType.visualType = visualType defaultValue = ArrayValue(elements=[]) diff --git a/run.py b/run.py new file mode 100644 index 00000000..ea3bb39f --- /dev/null +++ b/run.py @@ -0,0 +1,21 @@ +''' +Run this to debug +''' +import sys +import os +from notebook.notebookapp import main, NotebookApp +import netpyne_ui +from jupyter_geppetto import settings + +settings.debug = True + +if __name__ == '__main__': + sys.argv.append('--NotebookApp.default_url=/geppetto') + sys.argv.append("--NotebookApp.token=''") + sys.argv.append('--library=netpyne_ui') + + app = NotebookApp.instance() + app.initialize(sys.argv) + app.file_to_run = '' + sys.exit(app.start()) + diff --git a/setup.py b/setup.py index 086059fd..da6e6d9b 100644 --- a/setup.py +++ b/setup.py @@ -37,7 +37,7 @@ 'Programming Language :: Python :: 3.7' ], install_requires=[ - 'jupyter_geppetto==0.4.2', + 'jupyter-geppetto>=1.0.0', 'netpyne==0.9.1.1' ], ) diff --git a/utilities/GeppettoConfiguration.json b/utilities/GeppettoConfiguration.copyme.json similarity index 94% rename from utilities/GeppettoConfiguration.json rename to utilities/GeppettoConfiguration.copyme.json index 8df359b0..4d6e6d2b 100644 --- a/utilities/GeppettoConfiguration.json +++ b/utilities/GeppettoConfiguration.copyme.json @@ -1,6 +1,6 @@ { "_README" : "http://docs.geppetto.org/en/latest/build.html", - "contextPath": "org.geppetto.frontend/", + "contextPath": "org.geppetto.frontend", "useSsl": false, "embedded": false, "embedderURL": ["/"], diff --git a/utilities/install.py b/utilities/install.py index 794d6ccc..312aa6f1 100644 --- a/utilities/install.py +++ b/utilities/install.py @@ -27,7 +27,8 @@ def checkout(folder, default_branch, cwdp): newPath = currentPath+"/"+cwdp+folder print(newPath) os.chdir(newPath) - python_git=subprocess.Popen("git branch -a",shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE) + python_git = subprocess.Popen("git branch -a && git tag", shell=True, stdout=subprocess.PIPE, + stderr=subprocess.PIPE) outstd,errstd=python_git.communicate() if branch and branch in str(outstd) and branch != 'development': # don't ckeckout development for netpyne subprocess.call(['git', 'checkout', branch], cwd='./') @@ -45,25 +46,29 @@ def main(argv): main(sys.argv[1:]) os.chdir(os.getcwd()+"/../") -# Cloning Repos -clone('https://github.com/openworm/pygeppetto.git','pygeppetto','development') -subprocess.call(['pip', 'install', '-e', '.'], cwd='./pygeppetto/') + clone('https://github.com/Neurosim-lab/netpyne.git','netpyne','ui') subprocess.call(['pip', 'install', '-e', '.'], cwd='./netpyne/') -clone('https://github.com/openworm/org.geppetto.frontend.jupyter.git','org.geppetto.frontend.jupyter','development') -with open('npm_frontend_jupyter_log', 'a') as stdout: - subprocess.call(['npm', 'install'], cwd='./org.geppetto.frontend.jupyter/js', stdout=stdout) -subprocess.call(['npm', 'run', 'build-dev'], cwd='./org.geppetto.frontend.jupyter/js') + # We can't clone org.geppetto.frontend as a regular submodule because Travis doesn't have .gitmodules in the zip # subprocess.call(['git', 'submodule', 'update', '--init'], cwd='./') clone('https://github.com/openworm/org.geppetto.frontend.git','geppetto','development','netpyne_ui/', False, 'geppetto') clone('https://github.com/MetaCell/geppetto-netpyne.git','geppetto-netpyne','development','netpyne_ui/geppetto/src/main/webapp/extensions/') +branch = None +# Cloning Repos +clone('https://github.com/openworm/pygeppetto.git','pygeppetto','development') +subprocess.call(['pip', 'install', '-e', '.'], cwd='./pygeppetto/') +clone('https://github.com/openworm/org.geppetto.frontend.jupyter.git','org.geppetto.frontend.jupyter','development') +with open('npm_frontend_jupyter_log', 'a') as stdout: + subprocess.call(['npm', 'install'], cwd='./org.geppetto.frontend.jupyter/js', stdout=stdout) +subprocess.call(['npm', 'run', 'build-dev'], cwd='./org.geppetto.frontend.jupyter/js') + print("Enabling Geppetto NetPyNE Extension ...") -geppetto_configuration = os.path.join(os.path.dirname(__file__), './utilities/GeppettoConfiguration.json') +geppetto_configuration = os.path.join(os.path.dirname(__file__), './utilities/GeppettoConfiguration.copyme.json') copyfile(geppetto_configuration, './netpyne_ui/geppetto/src/main/webapp/GeppettoConfiguration.json') # Installing and building @@ -75,10 +80,10 @@ def main(argv): print("Installing jupyter_geppetto python package ...") subprocess.call(['pip', 'install', '-e', '.'], cwd='./org.geppetto.frontend.jupyter') print("Installing jupyter_geppetto Jupyter Extension ...") -subprocess.call(['jupyter', 'nbextension', 'install', '--py', '--symlink', '--user', 'jupyter_geppetto'], cwd='./org.geppetto.frontend.jupyter') -subprocess.call(['jupyter', 'nbextension', 'enable', '--py', '--user', 'jupyter_geppetto'], cwd='./org.geppetto.frontend.jupyter') -subprocess.call(['jupyter', 'nbextension', 'enable', '--py', 'widgetsnbextension'], cwd='./org.geppetto.frontend.jupyter') -subprocess.call(['jupyter', 'serverextension', 'enable', '--py', 'jupyter_geppetto'], cwd='./org.geppetto.frontend.jupyter') +subprocess.call(['jupyter', 'nbextension', 'install', '--py', '--symlink', '--sys-prefix', 'jupyter_geppetto'], cwd='./org.geppetto.frontend.jupyter') +subprocess.call(['jupyter', 'nbextension', 'enable', '--py', '--sys-prefix', 'jupyter_geppetto'], cwd='./org.geppetto.frontend.jupyter') +subprocess.call(['jupyter', 'nbextension', 'enable', '--py', '--sys-prefix', 'widgetsnbextension'], cwd='./org.geppetto.frontend.jupyter') +subprocess.call(['jupyter', 'serverextension', 'enable', '--sys-prefix', '--py', 'jupyter_geppetto'], cwd='./org.geppetto.frontend.jupyter') print("Installing NetPyNE UI python package ...") subprocess.call(['pip', 'install', '-e', '.'], cwd='.') \ No newline at end of file