Skip to content

Commit 0d18663

Browse files
authored
Merge pull request #639 from MetaCell/release/0.9.0
Release/0.9.0
2 parents ba6db5f + 0c14fd7 commit 0d18663

31 files changed

+1701
-4867
lines changed

Dockerfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ COPY webapp/ .
1212
RUN yarn build-dev
1313

1414

15-
RUN mv node_modules/@metacell .
1615
RUN rm -Rf node_modules/*
17-
RUN mv @metacell node_modules
1816

1917
###
2018
FROM jupyter/base-notebook:hub-1.5.0

netpyne_ui/api.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from notebook.base.handlers import IPythonHandler
1111
from netpyne_ui.constants import ALLOWED_EXTENSIONS, UPLOAD_FOLDER_PATH
1212

13+
1314
def allowed_file(filename, allowed_extensions=ALLOWED_EXTENSIONS):
1415
return '.' in filename and \
1516
filename.rsplit('.', 1)[1].lower() in allowed_extensions
@@ -43,6 +44,23 @@ def get_file_paths(handler):
4344
return file_paths
4445

4546

47+
def is_within_directory(directory, target):
48+
abs_directory = os.path.abspath(directory)
49+
abs_target = os.path.abspath(target)
50+
51+
prefix = os.path.commonprefix([abs_directory, abs_target])
52+
53+
return prefix == abs_directory
54+
55+
56+
def safe_extract_tar(tar, path=".", members=None, *, numeric_owner=False):
57+
for member in tar.getmembers():
58+
member_path = os.path.join(path, member.name)
59+
if not is_within_directory(path, member_path):
60+
raise Exception("Attempted Path Traversal in Tar File")
61+
tar.extractall(path, members, numeric_owner=numeric_owner)
62+
63+
4664
class NetPyNEController: # pytest: no cover
4765

4866
@post('/uploads')
@@ -74,7 +92,7 @@ def uploads(handler: IPythonHandler):
7492

7593
elif filename.endswith('.tar.gz'):
7694
with tarfile.open(file_path, mode='r:gz') as tar:
77-
tar.extractall(UPLOAD_FOLDER_PATH)
95+
safe_extract_tar(tar, UPLOAD_FOLDER_PATH)
7896

7997
elif filename.endswith('.gz'):
8098
with gzip.open(file_path, "rb") as gz, open(file_path.replace('.gz', ''), 'wb') as ff:

netpyne_ui/netpyne_geppetto.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,8 @@ def instantiateNetPyNEModelInGeppetto(self, args):
192192
try:
193193
with redirect_stdout(sys.__stdout__):
194194
if not args.get("usePrevInst", False):
195+
if self.doIhaveInstOrSimData()['haveInstance']:
196+
sim.clearAll()
195197
netpyne_model = self.instantiateNetPyNEModel()
196198
self.geppetto_model = self.model_interpreter.getGeppettoModel(netpyne_model)
197199

@@ -259,7 +261,7 @@ def simulate_single_model(self, experiment: model.Experiment = None, use_prev_in
259261
netpyne_model = self.instantiateNetPyNEModel()
260262

261263
self.geppetto_model = self.model_interpreter.getGeppettoModel(netpyne_model)
262-
264+
263265
simulations.run()
264266

265267
if self.geppetto_model:
@@ -374,7 +376,7 @@ def _prepare_simulation_files(self, experiment: model.Experiment = None, use_pre
374376

375377
def _prepare_batch_files(self, experiment: model.Experiment) -> str:
376378
"""Creates template files and netpyne model files in the experiment folder.
377-
379+
378380
Only for an experiment consisting of many trials.
379381
380382
:param experiment: given experiment

requirements.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jedi==0.17.0
2323
Jinja2==2.11.2
2424
jsonpickle==2.1.0
2525
jsonschema==3.2.0
26-
jupyter_geppetto==1.1.4
26+
jupyter_geppetto==1.1.5
2727
jupyter-client==7.0.6
2828
jupyter-core==4.9.1
2929
jupyter-server==1.11.2
@@ -43,10 +43,11 @@ multimethod==1.3
4343
nbconvert==5.6.1
4444
nbformat==5.0.6
4545
neuromllite==0.1.9
46-
netpyne==1.0.2.1
46+
netpyne==1.0.3
4747
NEURON==8.0.2
4848
numpy==1.18.5
4949
oauthlib==3.0.1
50+
optuna==2.10.1
5051
ordered-set==4.0.2
5152
pamela==1.0.0
5253
pandas==0.23.4

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
setuptools.setup(
1717
name="netpyne_ui",
18-
version="0.8.1",
18+
version="0.9.0",
1919
url="https://github.com/MetaCell/NetPyNE-UI",
2020
author="MetaCell",
2121
author_email="info@metacell.us",

tests/frontend/e2e/package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/frontend/e2e/yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4051,10 +4051,10 @@ minimatch@^3.0.4:
40514051
dependencies:
40524052
brace-expansion "^1.1.7"
40534053

4054-
minimist@^1.1.1, minimist@^1.2.5:
4055-
version "1.2.5"
4056-
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602"
4057-
integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==
4054+
minimist@^1.1.1, minimist@^1.2.0, minimist@^1.2.5:
4055+
version "1.2.6"
4056+
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44"
4057+
integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==
40584058

40594059
minimist@^1.2.0:
40604060
version "1.2.7"

utilities/install.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,12 @@ def main(netpyne_branch, workspace_branch, geppetto_branch=None, skipNpm=False,
116116
execute(cmd=['pip', 'install', '-e', '.'], cwd=os.path.join(DEPS_DIR, META_DIR, JUPYTER_DIR))
117117
# installing core dependencies
118118
execute(cmd=['pip', 'install', '-e', '.'], cwd=ROOT_DIR)
119-
else:
120-
# install requirements
121119
if netpyne_branch and netpyne_branch != 'master':
122120
cprint("Installing netpyne")
123121
clone(repository=NETPYNE, branch_or_tag=netpyne_branch)
124122
execute(cmd=['pip', 'install', '-e', '.'], cwd=os.path.join(DEPS_DIR, NETPYNE_DIR))
123+
else:
124+
# install requirements
125125
cprint("Installing UI python package...")
126126
execute(cmd=['pip', 'install', '-e', '.', '--no-deps'], cwd=ROOT_DIR)
127127

webapp/Main.js

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,19 @@ import '@metacell/geppetto-meta-ui/flex-layout/style/dark.scss';
1313
global.GEPPETTO_CONFIGURATION = require('./GeppettoConfiguration.json');
1414
const { initGeppetto } = require('@metacell/geppetto-meta-client/GEPPETTO');
1515

16-
Sentry.init({
17-
dsn: 'https://d8bf7e40eec34cb9891f6dd8207b5e83@sentry.metacell.us/6',
18-
integrations: [
19-
new CaptureConsole({
20-
levels: ['error'],
21-
}),
22-
],
23-
tracesSampleRate: 1.0,
24-
});
16+
if (process.env.NODE_ENV == 'production')
17+
{
18+
Sentry.init({
19+
dsn: 'https://d8bf7e40eec34cb9891f6dd8207b5e83@sentry.metacell.us/6',
20+
integrations: [
21+
new CaptureConsole({
22+
levels: ['error'],
23+
}),
24+
],
25+
tracesSampleRate: 1.0,
26+
});
27+
}
28+
2529

2630
initGeppetto();
2731
require('./css/netpyne.less');

webapp/Utils.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ const Utils = {
2525
},
2626

2727
captureSentryException (e) {
28-
Sentry.captureException(e);
28+
if (process.env.NODE_ENV == 'production')
29+
Sentry.captureException(e);
2930
console.error(e);
3031
},
3132

0 commit comments

Comments
 (0)