Skip to content

Commit

Permalink
Merge pull request #113 from jklynch/optional-dependencies
Browse files Browse the repository at this point in the history
Read optional dependencies from files
  • Loading branch information
danielballan authored Mar 12, 2021
2 parents 73d5004 + 1f16e26 commit c2edf3c
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 19 deletions.
19 changes: 19 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,22 @@ bluesky-widgets
:target: https://codecov.io/gh/bluesky/bluesky-widgets

Toolbox of widgets for visualizing blueskying data

Installation
------------

Install bluesky-widgets with Qt support::

$ pip install bluesky-widgets[pyside2]

or::

$ pip install bluesky-widgets[pyqt5]

Install bluesky-widgets with jupyter support::

$ pip install bluesky-widgets[jupyter]

Install bluesky-widgets with all optional dependencies::

$ pip install bluesky-widgets[complete]
3 changes: 3 additions & 0 deletions requirements-jupyter.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ipywidgets
ipympl
matplotlib
3 changes: 3 additions & 0 deletions requirements-pyqt5.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
PyQt5
qtpy
matplotlib
3 changes: 3 additions & 0 deletions requirements-pyside2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
PySide2
qtpy
matplotlib
38 changes: 19 additions & 19 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,28 +29,28 @@
with open(path.join(here, "README.rst"), encoding="utf-8") as readme_file:
readme = readme_file.read()

with open(path.join(here, "requirements.txt")) as requirements_file:
# Parse requirements.txt, ignoring any commented-out lines.
requirements = [
line
for line in requirements_file.read().splitlines()
if not line.startswith("#")
]

def read_requirements(requirements_filename):
with open(path.join(here, requirements_filename)) as requirements_file:
# Parse requirements.txt, ignoring any commented-out lines.
requirements = [
line
for line in requirements_file.read().splitlines()
if not line.startswith("#")
]
return requirements


requirements = read_requirements("requirements.txt")

# TODO Some of the views do not require matplotlib. Should that get its own
# group? Seems a little much to ask the user to manage all this, so I am
# erring on the side of inclusion for now.
extras_require = {
# TODO Some of the views do not require matplotlib. Should that get its own
# group? Seems a little much to ask the user to manage all this, so I am
# erring on the side of inclusion for now.
"pyside2": ["PySide2", "qtpy", "matplotlib"],
"pyqt5": ["PyQt5", "qtpy", "matplotlib"],
"jupyter": ["ipywidgets", "ipympl", "matplotlib"],
key: read_requirements(f"requirements-{key}.txt")
for key in ["examples", "jupyter", "pyside2", "pyqt5"]
}
with open(path.join(here, "requirements-examples.txt")) as requirements_file:
extras_require["examples"] = [
line
for line in requirements_file.read().splitlines()
if not line.startswith("#")
]
extras_require["complete"] = sorted(set(sum(extras_require.values(), [])))

setup(
name="bluesky-widgets",
Expand Down

0 comments on commit c2edf3c

Please sign in to comment.