Skip to content

Commit 0f50696

Browse files
authored
Merge pull request #512 from MetaCell/release/0.8.0
Release/0.8.0
2 parents 5e0fd30 + 917b7a5 commit 0f50696

File tree

162 files changed

+54533
-18693
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

162 files changed

+54533
-18693
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ init.py
1313
webapp/node_modules
1414
webapp/geppetto-client
1515
webapp/build
16+
webapp/.yalc
1617
workspace
1718
netpyne_workspace
1819
tests/frontend/e2e/node_modules
@@ -24,4 +25,6 @@ utilities/x86_64
2425
.idea
2526
*.iml
2627
x86_64
27-
.jupyter-config
28+
.jupyter-config
29+
venv
30+
node_modules

Dockerfile

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,23 @@ FROM frodriguez4600/jupyter-neuron:v7.8.0
22
ARG INSTALLATION_FOLDER=/home/jovyan/work/NetPyNE-UI
33
ARG NETPYNE_VERSION=development
44
ARG WORKSPACE_VERSION=nov2020
5-
ARG JUPYTER_GEPPETTO_VERSION=development
6-
ARG PYGEPPETTO_VERSION=development
5+
ARG GEPPETTO_VERSION=development
76
ARG BUILD_ARGS=""
87

98
USER $NB_USER
109

1110
ENV INSTALLATION_FOLDER=$INSTALLATION_FOLDER
1211
ENV NETPYNE_VERSION=$NETPYNE_VERSION
1312
ENV WORKSPACE_VERSION=$WORKSPACE_VERSION
14-
ENV JUPYTER_GEPPETTO_VERSION=$JUPYTER_GEPPETTO_VERSION
15-
ENV PYGEPPETTO_VERSION=$PYGEPPETTO_VERSION
13+
ENV GEPPETTO_VERSION=$GEPPETTO_VERSION
1614
ENV BUILD_ARGS=$BUILD_ARGS
1715

16+
# Install openmpi for parallel simulations
17+
# Important: Have to switch to root to install a package and ensure to switch back to NB user afterwards
18+
USER root
19+
RUN apt-get update && apt-get install -y libopenmpi-dev
20+
USER $NB_USER
21+
1822
WORKDIR /home/jovyan/work
1923
COPY --chown=1000:1000 requirements.txt ${INSTALLATION_FOLDER}/requirements.txt
2024

@@ -24,10 +28,12 @@ RUN pip install -r requirements.txt
2428
COPY --chown=1000:1000 . .
2529
WORKDIR ${INSTALLATION_FOLDER}/utilities
2630

27-
RUN python install.py ${BUILD_ARGS}
31+
RUN npm install --global yarn
32+
RUN npm install --global yalc
33+
RUN python install.py ${BUILD_ARGS} --geppetto ${GEPPETTO_VERSION}
2834

2935
WORKDIR ${INSTALLATION_FOLDER}
3036

3137
RUN pip install -r requirements-test.txt
3238
RUN pytest tests/backend
33-
CMD /bin/bash -c "jupyter notebook --NotebookApp.default_url=/geppetto --NotebookApp.token='' --library=netpyne_ui --NotebookApp.disable_check_xsrf=True"
39+
CMD /bin/bash -c "jupyter notebook --NotebookApp.default_url=/geppetto --NotebookApp.token='' --library=netpyne_ui --NotebookApp.disable_check_xsrf=True"

README.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,18 @@
77

88
![Screenshot](https://github.com/MetaCell/NetPyNE-UI/raw/documentation/docs/netpyneui.png)
99

10-
This repository hosts the User Interface for [NetPyNE](http://www.neurosimlab.org/netpyne/). NetPyNE is a python package to facilitate the development, parallel simulation and analysis of biological neuronal networks using the NEURON simulator.
10+
This repository hosts the User Interface for [NetPyNE](http://www.neurosimlab.org/netpyne/). NetPyNE is a python package
11+
to facilitate the development, parallel simulation and analysis of biological neuronal networks using the NEURON
12+
simulator.
1113

1214
## Install NetPyNE User Interface
1315

14-
Select one option to install the NetPyNE User Interface.
16+
Select one option to install the NetPyNE User Interface.
1517

16-
If you are familiar with NEURON and have already NEURON installed in your machine you can proceed using Pip. If you want a container which comes with everything preinstalled including NEURON you can use the Docker image. Using docker you will still be able to mount a local folder which will be your NetPyNE workspace. If you don't have docker installed in your system and you have had troubles installing it you can opt for the Virtual Machine installation.
18+
If you are familiar with NEURON and have already NEURON installed in your machine you can proceed using Pip. If you want
19+
a container which comes with everything preinstalled including NEURON you can use the Docker image. Using docker you
20+
will still be able to mount a local folder which will be your NetPyNE workspace. If you don't have docker installed in
21+
your system and you have had troubles installing it you can opt for the Virtual Machine installation.
1722

1823
<p align="center">
1924
<a href="https://github.com/MetaCell/NetPyNE-UI/wiki/Pip-installation"><img src="https://raw.githubusercontent.com/MetaCell/NetPyNE-UI/master/docs/pip_logo.png" alt="Pip" width="70px"/></a>
@@ -57,15 +62,14 @@ For debugging you can use `run.py` instead
5762
python run.py
5863
```
5964

60-
6165
## Run NetPyNE User Interface in Docker
6266

6367
Ensure that you have Docker installed on your system.
6468

6569
Build the image
6670

6771
```bash
68-
docker build -t netpyne-ui
72+
docker build -t netpyne-ui .
6973
```
7074

7175
Run the image
@@ -76,8 +80,8 @@ docker run -p 8888:8888 netpyne-ui
7680

7781
## End-to-end tests
7882

79-
End-to-end tests are located in `tests/deployment/frontend/e2e`.
80-
Ensure that the application is running in a blank state, since end-to-end tests interact with the running application.
83+
End-to-end tests are located in `tests/deployment/frontend/e2e`. Ensure that the application is running in a blank
84+
state, since end-to-end tests interact with the running application.
8185

8286
Install packages
8387

@@ -92,11 +96,9 @@ Start tests
9296
npm run test
9397
```
9498

95-
9699
#### Containerized tests
97100

98-
You can also use `docker-compose` to run the tests.
99-
Ensure that you have Docker installed on your system.
101+
You can also use `docker-compose` to run the tests. Ensure that you have Docker installed on your system.
100102

101103
Build the images
102104

@@ -111,8 +113,7 @@ Run the tests
111113
docker-compose up --abort-on-container-exit --exit-code-from netpyne-ui-e2e
112114
```
113115

114-
115116
## Additional Notes
116117

117-
NetPyNE-UI is being developed in collaboration with the [Neurosim Lab](http://neurosimlab.org/).
118-
See the [Wiki](https://github.com/MetaCell/NetPyNE-UI/wiki) for more info!
118+
NetPyNE-UI is being developed in collaboration with the [Neurosim Lab](http://neurosimlab.org/). See
119+
the [Wiki](https://github.com/MetaCell/NetPyNE-UI/wiki) for more info!

example.db

124 KB
Binary file not shown.

netpyne_ui/__init__.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
import logging
21
from jupyter_geppetto.webapi import RouteManager
3-
42
from netpyne_ui import api
3+
import sentry_sdk
4+
5+
sentry_sdk.init(
6+
"https://[email protected]/6"
7+
)
58

6-
RouteManager.add_controller(api.NetPyNEController)
9+
RouteManager.add_controller(api.NetPyNEController)

netpyne_ui/api.py

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from tempfile import TemporaryDirectory
99
from jupyter_geppetto.webapi import get, post
1010
from notebook.base.handlers import IPythonHandler
11-
from netpyne_ui.constants import NETPYNE_WORKDIR, UPLOAD_FOLDER_NAME, ALLOWED_EXTENSIONS, UPLOAD_FOLDER_PATH
11+
from netpyne_ui.constants import ALLOWED_EXTENSIONS, UPLOAD_FOLDER_PATH
1212

1313
def allowed_file(filename, allowed_extensions=ALLOWED_EXTENSIONS):
1414
return '.' in filename and \
@@ -26,7 +26,7 @@ def send_files(handler, file_path, filename):
2626
if _buffer:
2727
handler.write(_buffer)
2828
else:
29-
return
29+
return
3030
except:
3131
handler.set_status(500, f"Error sending files")
3232

@@ -39,16 +39,17 @@ def get_file_paths(handler):
3939
for path in tmp_file_paths:
4040
if os.path.exists(path):
4141
file_paths.append(path)
42-
42+
4343
return file_paths
4444

45+
4546
class NetPyNEController: # pytest: no cover
4647

4748
@post('/uploads')
4849
def uploads(handler: IPythonHandler):
4950
files = handler.request.files
5051
files_saved = 0
51-
52+
5253
if len(files) == 0 or 'file' not in files:
5354
handler.set_status(400, f"Can't find 'file' or filename is empty. Files received {len(files)}")
5455
else:
@@ -58,13 +59,13 @@ def uploads(handler: IPythonHandler):
5859
logging.warn(f"Can't store file {f.filename}. Extension not allowed")
5960
continue
6061

61-
## Save to file
62+
# Save to file
6263
filename = f.filename
6364
file_path = os.path.join(UPLOAD_FOLDER_PATH, filename)
64-
65+
6566
with open(file_path, 'wb') as zf:
6667
zf.write(f['body'])
67-
68+
6869
files_saved += 1
6970

7071
if filename.endswith('.zip'):
@@ -78,27 +79,24 @@ def uploads(handler: IPythonHandler):
7879
elif filename.endswith('.gz'):
7980
with gzip.open(file_path, "rb") as gz, open(file_path.replace('.gz', ''), 'wb') as ff:
8081
shutil.copyfileobj(gz, ff)
81-
82+
8283
handler.set_status(200, f"Number of files saved: {files_saved}. Number of files sent: {len(files['file'])}")
8384

8485
handler.finish()
85-
86+
8687
@get('/downloads')
8788
def downloads(handler: IPythonHandler):
88-
8989
file_paths = get_file_paths(handler)
90-
9190
if file_paths:
92-
9391
if len(file_paths) == 0:
9492
handler.set_status(400, f"Files not found.")
9593
handler.finish()
9694
return
9795

9896
if len(file_paths) == 1:
9997
send_files(handler, file_paths[0], file_paths[0].split('/')[-1])
100-
101-
else :
98+
99+
else:
102100
with TemporaryDirectory() as dir_path:
103101
tar_gz_file_name = f'{str(uuid.uuid4())}.tar.gz'
104102
tar_gz_file_path = os.path.join(dir_path, tar_gz_file_name)
@@ -107,5 +105,5 @@ def downloads(handler: IPythonHandler):
107105
tar.add(file_path, os.path.join('download', file_path.split('/')[-1]))
108106

109107
send_files(handler, tar_gz_file_path, tar_gz_file_name)
110-
108+
111109
handler.finish()

netpyne_ui/constants.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,21 @@
22

33
UPLOAD_FOLDER_NAME = 'uploads'
44
NETPYNE_WORKDIR = 'workspace'
5+
EXPERIMENTS_FOLDER = "experiments"
6+
MODEL_OUTPUT_FILENAME = 'model_output'
57

6-
ALLOWED_EXTENSIONS = ["py", "zip", "gz", ".tar.gz", "pdf", "txt", "xls", "png", "jpeg", "hoc"]
8+
SIMULATION_SCRIPT_NAME = "init.py"
9+
TEMPLATE_FILENAME_SINGLE_RUN = "run.py"
10+
TEMPLATE_FILENAME_SINGLE_RUN_INSTANTIATED = "run_instantiated_net.py"
11+
TEMPLATE_FILENAME_BATCH_RUN = "batch_run_single.py"
12+
TEMPLATE_FILENAME_BATCH = "batch.py"
13+
14+
ALLOWED_EXTENSIONS = ["py", "zip", "gz", ".tar.gz", "pdf", "txt", "xls", "png", "jpeg", "hoc", "json"]
715
HERE = os.path.dirname(os.path.abspath(__file__))
816
ROOT = os.path.dirname(HERE)
917
UPLOAD_FOLDER_PATH = os.path.join(ROOT, NETPYNE_WORKDIR, UPLOAD_FOLDER_NAME)
1018
NETPYNE_WORKDIR_PATH = os.path.join(ROOT, NETPYNE_WORKDIR)
19+
EXPERIMENTS_FOLDER_PATH = os.path.join(ROOT, NETPYNE_WORKDIR, EXPERIMENTS_FOLDER)
1120

1221
if not os.path.exists(NETPYNE_WORKDIR_PATH):
1322
NETPYNE_WORKDIR_PATH = os.path.join(os.getcwd(), NETPYNE_WORKDIR)

0 commit comments

Comments
 (0)