Skip to content

Commit

Permalink
rename common.txt to core.txt and added import message in try except
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerflex committed Apr 19, 2022
1 parent e82d7ba commit ef54d12
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 8 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-r requirements/common.txt
-r requirements/core.txt
File renamed without changes.
2 changes: 1 addition & 1 deletion requirements/dev.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# core, plotly and tests

-r common.txt
-r core.txt
-r plotly.txt

# required for development
Expand Down
2 changes: 1 addition & 1 deletion requirements/plotly.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# core + plotly plotting, no tests
-r common.txt
-r core.txt

plotly==5.5.0
dash
Expand Down
8 changes: 3 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()

with open("requirements/common.txt") as f:
required = f.read().splitlines()
with open("requirements/core.txt") as f:
core_required = f.read().splitlines()

with open("requirements/plotly.txt") as f:
plotly_required = f.read().splitlines()
Expand All @@ -40,10 +40,8 @@
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
# package_dir={"": ""},
# packages=[PACKAGE_NAME],
packages=setuptools.find_packages(),
python_requires=">=3.6",
install_requires=required,
install_requires=core_required,
extras_require={"plotly": plotly_required},
)
4 changes: 4 additions & 0 deletions tidy3d/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ class DataError(Tidy3dError):
"""Error accessing data."""


class Tidy3dImportError(Tidy3dError):
"""Error importing a package needed for tidy3d."""


""" Logging functions """


Expand Down
16 changes: 16 additions & 0 deletions tidy3d/plugins/webplots/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
"""Import post run visualization app and Simulation plotting through plotly."""

from ...log import Tidy3dImportError

# try to get the plotly packages, otherwise print a helpful error message.
try:
from jupyter_dash import JupyterDash
from dash import Dash
import plotly.graph_objects as go
except ImportError as e:
raise Tidy3dImportError(
"Could not import plotly requirements. "
"Ensure that tidy3d is installed with [plotly] requirements specified. "
'``pip install "tidy3d-beta[plotly]" or `pip install -e ".[plotly]". '
"Or, install the dependencies directly with `pip install -r requirements/plotly.txt`"
) from e

from .app import SimulationDataApp
from .simulation import SimulationPlotly

0 comments on commit ef54d12

Please sign in to comment.