Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ include bluepyopt/ephys/templates/acc/_json_template.jinja2
include bluepyopt/ephys/templates/acc/decor_acc_template.jinja2
include bluepyopt/ephys/templates/acc/label_dict_acc_template.jinja2

include.txt
include README.rst
include AUTHORS.txt
include COPYING
include COPYING.lesser
Expand Down
21 changes: 20 additions & 1 deletion bluepyopt/ipyp/bpopt_tasksdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,21 @@
import itertools

import numpy as np
import matplotlib.pyplot as plt


def _import_pyplot():
"""Import matplotlib.pyplot, with a helpful error if it is missing.

matplotlib is an optional dependency of bpopt_tasksdb; install it via
``pip install bluepyopt[ipyp]``.
"""
try:
import matplotlib.pyplot as plt
except ImportError as e:
raise ImportError(
"bpopt_tasksdb requires matplotlib: pip install bluepyopt[ipyp]"
) from e
return plt


def get_engine_data(tasksdb_filename):
Expand Down Expand Up @@ -67,6 +81,8 @@ def get_engine_data(tasksdb_filename):
def plot_usage(tasks, engine_number_map):
"""Plot usage stats"""

plt = _import_pyplot()

plt.figure(figsize=(8, 8))
for engine_uuid, task_list in tasks.items():
engine_number = engine_number_map[engine_uuid]
Expand All @@ -91,6 +107,8 @@ def plot_usage(tasks, engine_number_map):

def plot_duration_histogram(tasks):
"""Plot duration histogram"""
plt = _import_pyplot()

plt.figure(figsize=(8, 8))

durations = np.fromiter((t['duration']
Expand Down Expand Up @@ -137,6 +155,7 @@ def run(arg_list):
plot_usage(tasks, engine_number_map)
plot_duration_histogram(tasks)

plt = _import_pyplot()
plt.show()


Expand Down
5 changes: 5 additions & 0 deletions examples/BluePyOpt-ipyparallel.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ The `ipcontroller` gets its work from clients that connect to it.

## Installation

> **Note:** As of recent versions, `ipyparallel` is no longer installed
> automatically with `BluePyOpt`. Install it explicitly, either on its own
> (`pip install ipyparallel`) or together with BluePyOpt via the extra:
> `pip install bluepyopt[ipyp]`.

`ipyparallel` can be installed using pip:

# create and activate virtualenv
Expand Down
17 changes: 10 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ dependencies = [
"pandas>=0.18",
"deap>=1.3.3",
"efel>=2.13",
"ipyparallel",
"pickleshare>=0.7.3",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be a breaking change for packages that rely on ipyparallel being available indirectly through bluepyopt. The main l5PC example of bluepyopt also uses it. Maybe you can add a line to the example README or add the ipyparallel installation in the notebook or before launching the script.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, I will add a new commit documenting the pip install bluepyopt[ipyp] requirement

"Jinja2>=2.8",
"Pebble>=4.6.0",
"NEURON>=7.8",
Expand All @@ -39,13 +37,15 @@ keywords = [
]

[project.optional-dependencies]
all = ["scoop>=0.7", "pyneuroml>=0.5.20", "libNeuroML>=0.3.1", "LFPy>=2.3", "arbor>=0.10,<0.12"]
tests = ["pyneuroml>=0.5.20", "libNeuroML>=0.3.1", "LFPy>=2.3", "arbor>=0.10,<0.12"]
tests-no-arbor = ["pyneuroml>=0.5.20", "libNeuroML>=0.3.1", "LFPy>=2.3"]
all = ["scoop>=0.7", "pyneuroml>=0.5.20", "libNeuroML>=0.3.1", "LFPy>=2.3", "arbor>=0.10,<0.12", "ipyparallel", "matplotlib"]
tests = ["pyneuroml>=0.5.20", "libNeuroML>=0.3.1", "LFPy>=2.3", "arbor>=0.10,<0.12", "matplotlib"]
tests-no-arbor = ["pyneuroml>=0.5.20", "libNeuroML>=0.3.1", "LFPy>=2.3", "matplotlib"]
scoop = ["scoop>=0.7"]
neuroml = ["pyneuroml>=0.5.20", "libNeuroML>=0.3.1"]
lfpy = ["LFPy>=2.3"]
arbor = ["arbor>=0.10,<0.12"]
# Dependencies for the optional ipyparallel-based bpopt_tasksdb helper script.
ipyp = ["ipyparallel", "matplotlib"]

[project.urls]
Homepage = "https://github.com/openbraininstitute/BluePyOpt"
Expand All @@ -55,7 +55,7 @@ Tracker = "https://github.com/openbraininstitute/BluePyOpt/issues"
Documentation = "https://bluepyopt.readthedocs.io/en/latest"

[project.scripts]
bpopt_tasksdb = "bluepyopt:ipyp.bpopt_tasksdb.main"
bpopt_tasksdb = "bluepyopt.ipyp.bpopt_tasksdb:main"

[tool.setuptools]
include-package-data = true
Expand All @@ -72,7 +72,10 @@ bluepyopt = [
]

[tool.setuptools.packages.find]
exclude = ["examples*"]
exclude = ["examples*", "bluepyopt.tests*"]

[tool.setuptools.exclude-package-data]
"*" = ["tests/*", "tests/**/*"]

[tool.setuptools_scm]
version_scheme = "python-simplified-semver"
Expand Down
Loading