Skip to content

REF: Migrate to ArviZ 1.0 (InferenceData -> DataTree)#642

Open
AAlexxis222 wants to merge 11 commits intopymc-devs:mainfrom
AAlexxis222:main
Open

REF: Migrate to ArviZ 1.0 (InferenceData -> DataTree)#642
AAlexxis222 wants to merge 11 commits intopymc-devs:mainfrom
AAlexxis222:main

Conversation

@AAlexxis222
Copy link
Copy Markdown

Migrates pymc-extras to support ArviZ 1.0, replacing InferenceData with xarray.DataTree.

Changes:

  • Imports: Replaced arviz.InferenceData with xarray.DataTree.
  • Attributes: Refactored .posterior access to dictionary style (["posterior"]).
  • API: Updated constructors (DataTree.from_dict) and replaced .extend() with .update().

Verification:

  • ~325 tests passing (verified against PyMC PR #8019 rebase).
  • Validated prior and pathfinder modules.

@review-notebook-app
Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Copy link
Copy Markdown
Member

@aloctavodia aloctavodia left a comment

Choose a reason for hiding this comment

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

In many places you are apllying formating issues. Are you sure these are needed?

@AAlexxis222
Copy link
Copy Markdown
Author

Hi! Yes, I applied the formatting tools (black, isort, ruff) because the pre-commit CI job was failing with linting errors on the modified files.

I wanted to ensure the CI was green. However, if you prefer to keep the diff minimal, I can try to revert the style changes and only keep the logic migration (though pre-commit might fail again)

@aloctavodia
Copy link
Copy Markdown
Member

That's fine, just checking.

Copilot AI review requested due to automatic review settings February 18, 2026 07:15
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request migrates pymc-extras to support ArviZ 1.0 by replacing InferenceData with xarray.DataTree. The migration updates imports, changes attribute access patterns from dot notation to dictionary-style access, and updates API methods.

Changes:

  • Replaced arviz.InferenceData imports with xarray.DataTree and updated arviz imports to arviz_base where needed
  • Changed attribute access from .posterior to ["posterior"] throughout the codebase
  • Replaced .extend() method calls with .update() and .add_groups() with direct dictionary assignment
  • Updated dict_to_dataset parameter names from library to inference_library and default_dims to sample_dims
  • Applied code formatting improvements (multi-line formatting, import cleanup)

Reviewed changes

Copilot reviewed 85 out of 87 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pymc_extras/model/marginal/marginal_model.py Updated imports and DataTree usage, but has parameter naming issue
pymc_extras/utils/prior.py Updated type annotations and DataTree access patterns
pymc_extras/inference/laplace_approx/*.py Updated InferenceData to DataTree, dict_to_dataset parameters
pymc_extras/inference/pathfinder/*.py Updated DataTree usage and API calls
pymc_extras/inference/dadvi/dadvi.py Updated DataTree construction
pymc_extras/statespace/core/statespace.py Updated type annotations and DataTree access
pymc_extras/model_builder.py Updated .extend() to .update() and .add_groups() to dict assignment
tests/* Updated test fixtures to create DataTree objects and use dict-style access
Various formatting changes Multi-line formatting improvements throughout

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jessegrabowski
Copy link
Copy Markdown
Member

I wanted to ensure the CI was green. However, if you prefer to keep the diff minimal, I can try to revert the style changes and only keep the logic migration (though pre-commit might fail again)

The CI needs to be green, but this PR shouldn't touch 87 files. You should be running the pre-commit hooks we have defined locally that should be sufficient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants