Skip to content

Commit aecbcbc

Browse files
author
rodriguez-facundo
committed
Fix casper
1 parent 1a00670 commit aecbcbc

6 files changed

Lines changed: 81 additions & 29 deletions

File tree

.dockerignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,8 @@ netpyne_ui/geppetto
66
*.egg-info
77
notebook.ipynb
88
.git
9-
netpyne
9+
netpyne
10+
Dockerfile
11+
Dockerfile_base
12+
Dockerfile_dev
13+
netpyne_workspace

Dockerfile_dev

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
FROM metacell/jupyter-neuron:latest
1+
# FROM metacell/jupyter-neuron:latest
2+
FROM frodriguez4600/jupyter-neuron:latest
23
USER $NB_USER
34

45
ARG netpyneuiBranch=development
@@ -11,13 +12,12 @@ WORKDIR /home/jovyan/work
1112
COPY --chown=1000:1000 . NetPyNE-UI
1213
WORKDIR ${FOLDER}/utilities
1314

14-
RUN /bin/bash -c "source activate snakes && python --version"
15-
RUN /bin/bash -c "source activate snakes && exec python install.py branch $netpyneuiBranch"
15+
RUN python install.py branch $netpyneuiBranch
1616

17-
WORKDIR /home/jovyan
17+
WORKDIR /home/jovyan/work/NetPyNE-UI
1818

19-
RUN git clone https://github.com/Neurosim-lab/netpyne_workspace
20-
WORKDIR /home/jovyan/netpyne_workspace
19+
RUN git clone https://github.com/Neurosim-lab/netpyne_workspace && rm -rf netpyne_workspace/.git
20+
WORKDIR /home/jovyan/work/NetPyNE-UI/netpyne_workspace
2121

22-
RUN ln -sfn /home/jovyan/work/NetPyNE-UI/netpyne_ui/tests tests
23-
CMD /bin/bash -c "source activate snakes && exec jupyter notebook --debug --NotebookApp.default_url=/geppetto --NotebookApp.token='' --library=netpyne_ui --NotebookApp.disable_check_xsrf=True"
22+
RUN ln -sfn /home/jovyan/work/NetPyNE-UI/netpyne_ui/tests ../tests
23+
CMD /bin/bash -c "cd .. && NetPyNE-UI"

netpyne_ui/api.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,7 @@
88
from tempfile import TemporaryDirectory
99
from jupyter_geppetto.webapi import get, post
1010
from notebook.base.handlers import IPythonHandler
11-
12-
ALLOWED_EXTENSIONS = ["py", "zip", "gz", ".tar.gz", "pdf", "txt", "xls", "png", "jpeg"]
13-
14-
UPLOAD_FOLDER_NAME = "uploads"
15-
UPLOAD_FOLDER_PATH = os.path.join(os.getcwd(), UPLOAD_FOLDER_NAME)
16-
17-
if not os.path.exists(UPLOAD_FOLDER_PATH):
18-
os.makedirs(UPLOAD_FOLDER_PATH)
11+
from netpyne_ui.constants import NETPYNE_WORKDIR, UPLOAD_FOLDER_NAME, ALLOWED_EXTENSIONS, UPLOAD_FOLDER_PATH
1912

2013
def allowed_file(filename, allowed_extensions=ALLOWED_EXTENSIONS):
2114
return '.' in filename and \

netpyne_ui/constants.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import os
2+
3+
UPLOAD_FOLDER_NAME = 'uploads'
4+
NETPYNE_WORKDIR = 'netpyne_workspace'
5+
6+
ALLOWED_EXTENSIONS = ["py", "zip", "gz", ".tar.gz", "pdf", "txt", "xls", "png", "jpeg"]
7+
8+
UPLOAD_FOLDER_PATH = os.path.join(os.getcwd(), NETPYNE_WORKDIR, UPLOAD_FOLDER_NAME)
9+
NETPYNE_WORKDIR_PATH = os.path.join(os.getcwd(), NETPYNE_WORKDIR)
10+
11+
if not os.path.exists(UPLOAD_FOLDER_PATH):
12+
os.makedirs(UPLOAD_FOLDER_PATH)
13+
14+
if not os.path.exists(NETPYNE_WORKDIR_PATH):
15+
os.makedirs(NETPYNE_WORKDIR_PATH)

netpyne_ui/netpyne_geppetto.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@
3030
from jupyter_geppetto import jupyter_geppetto, synchronization, utils
3131
import imp
3232
from contextlib import redirect_stdout, redirect_stderr
33+
from netpyne_ui.constants import NETPYNE_WORKDIR_PATH
3334

34-
35+
os.chdir(NETPYNE_WORKDIR_PATH)
3536
class NetPyNEGeppetto():
3637

3738
def __init__(self):
@@ -372,7 +373,7 @@ def getPlotSettings(self, plot):
372373
def getDirList(self, dir=None, onlyDirs = False, filterFiles=False):
373374
# Get Current dir
374375
if dir == None or dir == '':
375-
dir = os.getcwd()
376+
dir = os.path.join(os.getcwd(), NETPYNE_WORKDIR_PATH)
376377
dir_list = []
377378
file_list = []
378379
for f in sorted(os.listdir(str(dir)), key=str.lower):

utilities/install.py

Lines changed: 49 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ def checkout(folder, default_branch, cwdp):
3636
subprocess.call(['git', 'checkout', default_branch], cwd='./')
3737
os.chdir(currentPath)
3838

39+
def clone_repo(project, repo_name, **kwargs):
40+
normal = "\033[0;37;40m"
41+
stroke = "\033[1;32;40m\n"
42+
subprocess.run(["echo", f'{stroke}Cloning {repo_name} from {project}{stroke}'])
43+
url = f'https://github.com/{project}/{repo_name}.git'
44+
clone(url, **kwargs)
45+
3946
def main(argv):
4047
global branch
4148
if(len(argv) > 0):
@@ -47,22 +54,54 @@ def main(argv):
4754

4855
os.chdir(os.getcwd()+"/../")
4956

50-
51-
clone('https://github.com/Neurosim-lab/netpyne.git','netpyne','ui')
52-
subprocess.call(['pip', 'install', '-e', '.'], cwd='./netpyne/')
57+
# Fix terminado installation error
58+
terminado_path = '/opt/conda/lib/python3.7/site-packages/'
59+
subprocess.call(['rm', '-rf', terminado_path+'terminado', terminado_path+'terminado-0.8.3.dist-info', terminado_path+'terminado-0.8.3-py3.7.egg-info'])
5360

5461

62+
clone_repo(project='Neurosim-lab',
63+
repo_name='netpyne',
64+
folder='netpyne',
65+
default_branch='ui'
66+
)
67+
subprocess.call(['python3', '-m', 'pip', 'install', '-e', '.'], cwd='./netpyne/')
5568

5669
# We can't clone org.geppetto.frontend as a regular submodule because Travis doesn't have .gitmodules in the zip
5770
# subprocess.call(['git', 'submodule', 'update', '--init'], cwd='./')
58-
clone('https://github.com/openworm/org.geppetto.frontend.git','geppetto','v0.4.2-alpha','netpyne_ui/', False, 'geppetto')
59-
clone('https://github.com/MetaCell/geppetto-netpyne.git','geppetto-netpyne','development','netpyne_ui/geppetto/src/main/webapp/extensions/')
71+
clone_repo(project='openworm',
72+
repo_name='org.geppetto.frontend',
73+
folder='geppetto',
74+
default_branch='v0.4.2-alpha',
75+
cwdp='netpyne_ui/',
76+
recursive=False,
77+
destination_folder='geppetto'
78+
)
79+
80+
clone_repo(project='MetaCell',
81+
repo_name='geppetto-netpyne',
82+
folder='geppetto-netpyne',
83+
default_branch='development',
84+
cwdp='netpyne_ui/geppetto/src/main/webapp/extensions/'
85+
)
6086

6187
branch = None
6288
# 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')
89+
90+
clone_repo(project='openworm',
91+
repo_name='pygeppetto',
92+
folder='pygeppetto',
93+
default_branch='development'
94+
)
95+
subprocess.call(['python3', '-m', 'pip', 'install', '-e', '.'], cwd='./pygeppetto/')
96+
97+
98+
clone_repo(project='openworm',
99+
repo_name='org.geppetto.frontend.jupyter',
100+
folder='org.geppetto.frontend.jupyter',
101+
default_branch='development'
102+
)
103+
104+
66105
with open('npm_frontend_jupyter_log', 'a') as stdout:
67106
subprocess.call(['npm', 'install'], cwd='./org.geppetto.frontend.jupyter/js', stdout=stdout)
68107
subprocess.call(['npm', 'run', 'build-dev'], cwd='./org.geppetto.frontend.jupyter/js')
@@ -78,12 +117,12 @@ def main(argv):
78117
subprocess.call(['npm', 'run', 'build-dev-noTest'], cwd='./netpyne_ui/geppetto/src/main/webapp/')
79118

80119
print("Installing jupyter_geppetto python package ...")
81-
subprocess.call(['pip', 'install', '-e', '.'], cwd='./org.geppetto.frontend.jupyter')
120+
subprocess.call(['python3', '-m', 'pip', 'install', '-e', '.'], cwd='./org.geppetto.frontend.jupyter')
82121
print("Installing jupyter_geppetto Jupyter Extension ...")
83122
subprocess.call(['jupyter', 'nbextension', 'install', '--py', '--symlink', '--sys-prefix', 'jupyter_geppetto'], cwd='./org.geppetto.frontend.jupyter')
84123
subprocess.call(['jupyter', 'nbextension', 'enable', '--py', '--sys-prefix', 'jupyter_geppetto'], cwd='./org.geppetto.frontend.jupyter')
85124
subprocess.call(['jupyter', 'nbextension', 'enable', '--py', '--sys-prefix', 'widgetsnbextension'], cwd='./org.geppetto.frontend.jupyter')
86125
subprocess.call(['jupyter', 'serverextension', 'enable', '--sys-prefix', '--py', 'jupyter_geppetto'], cwd='./org.geppetto.frontend.jupyter')
87126

88127
print("Installing NetPyNE UI python package ...")
89-
subprocess.call(['pip', 'install', '-e', '.'], cwd='.')
128+
subprocess.call(['python3', '-m', 'pip', 'install', '-e', '.'], cwd='.')

0 commit comments

Comments
 (0)