Skip to content

Commit

Permalink
Merge pull request #639 from MetaCell/release/0.9.0
Browse files Browse the repository at this point in the history
Release/0.9.0
  • Loading branch information
ddelpiano authored Jan 5, 2023
2 parents ba6db5f + 0c14fd7 commit 0d18663
Show file tree
Hide file tree
Showing 31 changed files with 1,701 additions and 4,867 deletions.
2 changes: 0 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ COPY webapp/ .
RUN yarn build-dev


RUN mv node_modules/@metacell .
RUN rm -Rf node_modules/*
RUN mv @metacell node_modules

###
FROM jupyter/base-notebook:hub-1.5.0
Expand Down
20 changes: 19 additions & 1 deletion netpyne_ui/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from notebook.base.handlers import IPythonHandler
from netpyne_ui.constants import ALLOWED_EXTENSIONS, UPLOAD_FOLDER_PATH


def allowed_file(filename, allowed_extensions=ALLOWED_EXTENSIONS):
return '.' in filename and \
filename.rsplit('.', 1)[1].lower() in allowed_extensions
Expand Down Expand Up @@ -43,6 +44,23 @@ def get_file_paths(handler):
return file_paths


def is_within_directory(directory, target):
abs_directory = os.path.abspath(directory)
abs_target = os.path.abspath(target)

prefix = os.path.commonprefix([abs_directory, abs_target])

return prefix == abs_directory


def safe_extract_tar(tar, path=".", members=None, *, numeric_owner=False):
for member in tar.getmembers():
member_path = os.path.join(path, member.name)
if not is_within_directory(path, member_path):
raise Exception("Attempted Path Traversal in Tar File")
tar.extractall(path, members, numeric_owner=numeric_owner)


class NetPyNEController: # pytest: no cover

@post('/uploads')
Expand Down Expand Up @@ -74,7 +92,7 @@ def uploads(handler: IPythonHandler):

elif filename.endswith('.tar.gz'):
with tarfile.open(file_path, mode='r:gz') as tar:
tar.extractall(UPLOAD_FOLDER_PATH)
safe_extract_tar(tar, UPLOAD_FOLDER_PATH)

elif filename.endswith('.gz'):
with gzip.open(file_path, "rb") as gz, open(file_path.replace('.gz', ''), 'wb') as ff:
Expand Down
6 changes: 4 additions & 2 deletions netpyne_ui/netpyne_geppetto.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ def instantiateNetPyNEModelInGeppetto(self, args):
try:
with redirect_stdout(sys.__stdout__):
if not args.get("usePrevInst", False):
if self.doIhaveInstOrSimData()['haveInstance']:
sim.clearAll()
netpyne_model = self.instantiateNetPyNEModel()
self.geppetto_model = self.model_interpreter.getGeppettoModel(netpyne_model)

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

self.geppetto_model = self.model_interpreter.getGeppettoModel(netpyne_model)

simulations.run()

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

def _prepare_batch_files(self, experiment: model.Experiment) -> str:
"""Creates template files and netpyne model files in the experiment folder.
Only for an experiment consisting of many trials.
:param experiment: given experiment
Expand Down
5 changes: 3 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jedi==0.17.0
Jinja2==2.11.2
jsonpickle==2.1.0
jsonschema==3.2.0
jupyter_geppetto==1.1.4
jupyter_geppetto==1.1.5
jupyter-client==7.0.6
jupyter-core==4.9.1
jupyter-server==1.11.2
Expand All @@ -43,10 +43,11 @@ multimethod==1.3
nbconvert==5.6.1
nbformat==5.0.6
neuromllite==0.1.9
netpyne==1.0.2.1
netpyne==1.0.3
NEURON==8.0.2
numpy==1.18.5
oauthlib==3.0.1
optuna==2.10.1
ordered-set==4.0.2
pamela==1.0.0
pandas==0.23.4
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

setuptools.setup(
name="netpyne_ui",
version="0.8.1",
version="0.9.0",
url="https://github.com/MetaCell/NetPyNE-UI",
author="MetaCell",
author_email="info@metacell.us",
Expand Down
6 changes: 3 additions & 3 deletions tests/frontend/e2e/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions tests/frontend/e2e/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4051,10 +4051,10 @@ minimatch@^3.0.4:
dependencies:
brace-expansion "^1.1.7"

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

minimist@^1.2.0:
version "1.2.7"
Expand Down
4 changes: 2 additions & 2 deletions utilities/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,12 @@ def main(netpyne_branch, workspace_branch, geppetto_branch=None, skipNpm=False,
execute(cmd=['pip', 'install', '-e', '.'], cwd=os.path.join(DEPS_DIR, META_DIR, JUPYTER_DIR))
# installing core dependencies
execute(cmd=['pip', 'install', '-e', '.'], cwd=ROOT_DIR)
else:
# install requirements
if netpyne_branch and netpyne_branch != 'master':
cprint("Installing netpyne")
clone(repository=NETPYNE, branch_or_tag=netpyne_branch)
execute(cmd=['pip', 'install', '-e', '.'], cwd=os.path.join(DEPS_DIR, NETPYNE_DIR))
else:
# install requirements
cprint("Installing UI python package...")
execute(cmd=['pip', 'install', '-e', '.', '--no-deps'], cwd=ROOT_DIR)

Expand Down
22 changes: 13 additions & 9 deletions webapp/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,19 @@ import '@metacell/geppetto-meta-ui/flex-layout/style/dark.scss';
global.GEPPETTO_CONFIGURATION = require('./GeppettoConfiguration.json');
const { initGeppetto } = require('@metacell/geppetto-meta-client/GEPPETTO');

Sentry.init({
dsn: 'https://d8bf7e40eec34cb9891f6dd8207b5e83@sentry.metacell.us/6',
integrations: [
new CaptureConsole({
levels: ['error'],
}),
],
tracesSampleRate: 1.0,
});
if (process.env.NODE_ENV == 'production')
{
Sentry.init({
dsn: 'https://d8bf7e40eec34cb9891f6dd8207b5e83@sentry.metacell.us/6',
integrations: [
new CaptureConsole({
levels: ['error'],
}),
],
tracesSampleRate: 1.0,
});
}


initGeppetto();
require('./css/netpyne.less');
Expand Down
3 changes: 2 additions & 1 deletion webapp/Utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ const Utils = {
},

captureSentryException (e) {
Sentry.captureException(e);
if (process.env.NODE_ENV == 'production')
Sentry.captureException(e);
console.error(e);
},

Expand Down
12 changes: 11 additions & 1 deletion webapp/components/definition/synapses/NetPyNESynapse.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ class NetPyNESynapse extends React.Component {

UNSAFE_componentWillReceiveProps (nextProps) {
if (this.state.currentName != nextProps.name) {
this.setState({ currentName: nextProps.name, synMechMod: '' });
this.setSyncMechModState(nextProps.name)
this.setState({ currentName: nextProps.name});
}
}

Expand Down Expand Up @@ -115,6 +116,15 @@ class NetPyNESynapse extends React.Component {
this.setState({ synMechMod: value });
}

async setSyncMechModState(synapseName) {
const value = await Utils.execPythonMessage(
`netpyne_geppetto.netParams.synMechParams['${
synapseName
}']['mod']`
)
this.setState({synMechMod: value})
}

render () {
const { classes } = this.props;
const dialogPop = this.state.errorMessage != undefined ? (
Expand Down
Loading

0 comments on commit 0d18663

Please sign in to comment.