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

Robustify preview module #2398

Merged
merged 4 commits into from
Dec 19, 2024
Merged
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
41 changes: 36 additions & 5 deletions arviz/preview.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,48 @@
# pylint: disable=unused-import,unused-wildcard-import,wildcard-import
# pylint: disable=unused-import,unused-wildcard-import,wildcard-import,invalid-name
"""Expose features from arviz-xyz refactored packages inside ``arviz.preview`` namespace."""
import logging

_log = logging.getLogger(__name__)

info = ""

try:
from arviz_base import *

status = "arviz_base available, exposing its functions as part of arviz.preview"
_log.info(status)

Check warning on line 13 in arviz/preview.py

View check run for this annotation

Codecov / codecov/patch

arviz/preview.py#L12-L13

Added lines #L12 - L13 were not covered by tests
except ModuleNotFoundError:
pass
status = "arviz_base not installed"
_log.info(status)
except ImportError:
status = "Unable to import arviz_base"
_log.info(status, exc_info=True)

Check warning on line 19 in arviz/preview.py

View check run for this annotation

Codecov / codecov/patch

arviz/preview.py#L17-L19

Added lines #L17 - L19 were not covered by tests

info += status + "\n"

try:
import arviz_stats
from arviz_stats import *

status = "arviz_stats available, exposing its functions as part of arviz.preview"
_log.info(status)

Check warning on line 27 in arviz/preview.py

View check run for this annotation

Codecov / codecov/patch

arviz/preview.py#L26-L27

Added lines #L26 - L27 were not covered by tests
except ModuleNotFoundError:
pass
status = "arviz_stats not installed"
_log.info(status)
except ImportError:
status = "Unable to import arviz_stats"
_log.info(status, exc_info=True)

Check warning on line 33 in arviz/preview.py

View check run for this annotation

Codecov / codecov/patch

arviz/preview.py#L31-L33

Added lines #L31 - L33 were not covered by tests
info += status + "\n"

try:
from arviz_plots import *

status = "arviz_plots available, exposing its functions as part of arviz.preview"
_log.info(status)

Check warning on line 40 in arviz/preview.py

View check run for this annotation

Codecov / codecov/patch

arviz/preview.py#L39-L40

Added lines #L39 - L40 were not covered by tests
except ModuleNotFoundError:
pass
status = "arviz_plots not installed"
_log.info(status)
except ImportError:
status = "Unable to import arviz_plots"
_log.info(status, exc_info=True)

Check warning on line 46 in arviz/preview.py

View check run for this annotation

Codecov / codecov/patch

arviz/preview.py#L44-L46

Added lines #L44 - L46 were not covered by tests

info += status + "\n"
1 change: 1 addition & 0 deletions doc/source/api/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ API Reference
plot_utils
utils
rcparams
preview
wrappers
stats_refitting
11 changes: 11 additions & 0 deletions doc/source/api/preview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
(preview_api)=

# Preview
This module give access to upcoming refactored features by exposing
all objects in [arviz-base](https://arviz-base.readthedocs.io/en/latest/),
[arviz-stats](https://arviz-stats.readthedocs.io/en/latest/) and
[arviz-plots](https://arviz-plots.readthedocs.io/en/latest/)
under a single namespace: `arviz.preview`.

In addition, there is also an `arviz.preview.info` to check availability
of the different sub-libraries.
3 changes: 3 additions & 0 deletions doc/source/getting_started/Installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ Use the below pip command to install ArviZ with all of its :ref:`Optional-depend

pip install "arviz[all]"

It is also possible to use ``pip install "arviz[preview]"` to access
:ref:`upcoming refactored features <preview_api>`.

Using conda-forge
=================

Expand Down