Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix minor Optional Dependency issues #580

Merged
merged 3 commits into from
Aug 10, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions alibi_detect/utils/frameworks.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

try:
import tensorflow as tf # noqa
import tensorflow_probability as tfp # noqa
has_tensorflow = True
except ImportError:
has_tensorflow = False
Expand Down
9 changes: 9 additions & 0 deletions alibi_detect/utils/missing_optional_dependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@
))


"""Map used to ensure correct pip install message is generated if a missing optional dependency is detected. This dict
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick: map -> mapping?

is used to control two behaviours:
1. When we import objects from missing dependencies we check that any `ModuleNotFoundError` or `ImportError`
corresponds to a missing optional dependency by checking the name of the missing dependency is in `ERROR_TYPES`. We
then map this name to the corresponding optional dependency bucket that will resolve the issue.
2. Some optional dependencies have multiple names such as `torch` and `pytorch`, instead of enforcing a single
naming convention across the whole code base we instead use `ERROR_TYPES` to capture both cases. This is done right
before the pip install message is issued as this is the most robust place to capture these differences.
"""
ERROR_TYPES = {
"fbprophet": 'prophet',
"holidays": 'prophet',
Expand Down