Skip to content
This repository has been archived by the owner on Dec 18, 2023. It is now read-only.

Remove arviz as a dependency #1822

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Remove arviz as a dependency #1822

wants to merge 5 commits into from

Conversation

zaxtax
Copy link
Contributor

@zaxtax zaxtax commented Nov 10, 2022

Motivation

This removes arviz as an explicit dependency of Bean Machine. This will also prevent a circular dependency with arviz.

Changes proposed

Updates setup.py and moves import into to_inference_data

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • The title of my pull request is a short description of the requested changes.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 10, 2022
@zaxtax zaxtax force-pushed the remove_arviz_dep branch 2 times, most recently from 0c70d9f to cdcf5f9 Compare November 11, 2022 02:20
@zaxtax zaxtax requested a review from horizon-blue November 30, 2022 16:23
Copy link
Contributor

@horizon-blue horizon-blue left a comment

Choose a reason for hiding this comment

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

Removing ArviZ dependency sounds fine to me, though in this case we should also remove the global import in monte_carlo_sample.py (because this module will be imported when people import beanmachine, and we don't want it to raise an ModuleNotFoundError due to missing ArviZ dependency.

We can consider moving the ArviZ import into to_inference_data method for now, so that the ArviZ dependency is only required if users need to do the conversion.

This will also prevent a circular dependency with arviz.

Looks like ArviZ only has Bean Machine as an external dependency, so even if we keep ArviZ as-is, this shouldn't cause any circular dependency issue. In fact, it looks like PyMC also depends on ArviZ at the moment and that works just fine for them

@zaxtax
Copy link
Contributor Author

zaxtax commented Dec 15, 2022 via email

@ndmlny-qs
Copy link
Contributor

We could also use the _requires_dev_packages in

def _requires_dev_packages(f: Callable[P, R]) -> Callable[P, R]:

as a decorator for the to_inference_data method found in

def to_inference_data(self, include_adapt_steps: bool = False):

Using this, I think we can remove the ArviZ import, and if the user wanted to call the .to_inference_data method, then they would get the very useful error message indicating that they need to also install the dev requirements for Bean Machine.

@zaxtax zaxtax force-pushed the remove_arviz_dep branch from eaf8aa8 to 28714c4 Compare March 24, 2023 23:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants