Skip to content

Commit

Permalink
make bokeh as optional deps
Browse files Browse the repository at this point in the history
  • Loading branch information
henrysky committed Aug 30, 2023
1 parent 6b100ba commit 782ebfc
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 5 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/ci_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ jobs:
python-version: "3.11"
- name: Install dependencies
run: |
pip install coveralls pydot graphviz pytest pytest-cov galpy astroquery numpy
pip install coveralls pydot graphviz pytest pytest-cov galpy astroquery numpy bokeh
pip install .
- name: Test mw-plot
if: ${{ matrix.PAPER_MODELS == false}}
run: >
python -m pytest --cov mw_plot --cov-report=xml tests/test_mwplot.py
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ version: 2
build:
os: ubuntu-22.04
tools:
python: "3.10"
python: "3.11"
# You can also specify other tool versions:
# nodejs: "20"
# rust: "1.70"
Expand Down
9 changes: 8 additions & 1 deletion mw_plot/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
try:
import bokeh
_BOKEH_LOADED = True
except ImportError:
_BOKEH_LOADED = False
else:
from mw_plot.mw_plot_bokeh import *

from mw_plot.mw_plot_matplotlib import *
from mw_plot.mw_plot_bokeh import *
from pkg_resources import get_distribution
from astropy.coordinates import SkyCoord, ICRS
import astropy.units as u
Expand Down
7 changes: 7 additions & 0 deletions mw_plot/mw_plot_bokeh.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
try:
import bokeh
except ImportError:
raise ImportError(
"Bokeh is not installed. Please install Bokeh to use this feature"
)

import requests
import numpy as np
import astropy.units as u
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
include_package_data=True,
package_data={"mw_plot": ["*.png", "*.jpg"]},
python_requires=">=3.7",
install_requires=["requests", "numpy", "astropy", "matplotlib", "Pillow", "bokeh", "galpy"],
install_requires=["requests", "numpy", "astropy", "matplotlib", "Pillow", "galpy"],
url="https://github.com/henrysky/milkyway_plot",
project_urls={
"Bug Tracker": "https://github.com/henrysky/milkyway_plot/issues",
Expand Down

0 comments on commit 782ebfc

Please sign in to comment.