Skip to content

Commit

Permalink
Update to Python ArviZ v0.13.0 compatibility (#237)
Browse files Browse the repository at this point in the history
* Deprecate extract_dataset and replace with extract

* Add from_beanmachine forward

* Increment minor version number

* Mark plot_kde bokeh test as broken

* Revert "Mark plot_kde bokeh test as broken"

This reverts commit e64f153.

* Mark correct test as broken
  • Loading branch information
sethaxen authored Oct 26, 2022
1 parent 09ca2d2 commit d8d98e4
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "ArviZ"
uuid = "131c737c-5715-5e2e-ad31-c244f01c1dc7"
authors = ["Seth Axen <[email protected]>"]
version = "0.6.6"
version = "0.6.7"

[deps]
Conda = "8f4d0f93-b110-5947-807f-2305c1781a2d"
Expand Down
2 changes: 1 addition & 1 deletion docs/src/api/data.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ to_netcdf

```@docs
concat
extract_dataset
extract
```

## Example data
Expand Down
4 changes: 2 additions & 2 deletions src/ArviZ.jl
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export InferenceObjects,
namedtuple_to_dataset

## Data
export extract_dataset,
export extract,
load_example_data,
to_netcdf,
from_json,
Expand All @@ -107,7 +107,7 @@ export with_interactive_backend
## rcParams
export rcParams, with_rc_context

const _min_arviz_version = v"0.12.0"
const _min_arviz_version = v"0.13.0"
const arviz = PyNULL()
const xarray = PyNULL()
const bokeh = PyNULL()
Expand Down
6 changes: 4 additions & 2 deletions src/data.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@forwardfun extract_dataset
convert_result(::typeof(extract_dataset), result, args...) = convert(Dataset, result)
@forwardfun extract
convert_result(::typeof(extract), result, args...) = convert(Dataset, result)
Base.@deprecate extract_dataset(args...; kwargs...) extract(args...; kwargs...)

function convert_to_inference_data(filename::AbstractString; kwargs...)
return from_netcdf(filename)
Expand All @@ -9,6 +10,7 @@ end
@forwardfun from_netcdf
@forwardfun from_json
@forwardfun from_dict
@forwardfun from_beanmachine
@forwardfun from_cmdstan
@forwardfun from_cmdstanpy
@forwardfun from_emcee
Expand Down
9 changes: 7 additions & 2 deletions test/test_data.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ using ArviZ, DimensionalData, Test

@testset "extract_dataset" begin
idata = random_data()
post = extract_dataset(idata, :posterior; combined=false)
@test_deprecated extract_dataset(idata, :posterior; combined=false)
end

@testset "extract" begin
idata = random_data()
post = extract(idata, :posterior; combined=false)
for k in keys(idata.posterior)
@test haskey(post, k)
@test post[k] idata.posterior[k]
Expand All @@ -11,7 +16,7 @@ using ArviZ, DimensionalData, Test
@test DimensionalData.name(dims) === DimensionalData.name(dims_exp)
@test DimensionalData.index(dims) == DimensionalData.index(dims_exp)
end
prior = extract_dataset(idata, :prior; combined=false)
prior = extract(idata, :prior; combined=false)
for k in keys(idata.prior)
@test haskey(prior, k)
@test prior[k] idata.prior[k]
Expand Down
2 changes: 1 addition & 1 deletion test/test_plots.jl
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ using PyCall, PyPlot
plot_kde(arr1, arr2)
close(gcf())
ispynull(ArviZ.bokeh) || @testset "bokeh" begin
@test plot_kde(arr1, arr2; backend=:bokeh) isa ArviZ.BokehPlot
@test_broken plot_kde(arr1, arr2; backend=:bokeh) isa ArviZ.BokehPlot
end
end

Expand Down

4 comments on commit d8d98e4

@sethaxen
Copy link
Member Author

Choose a reason for hiding this comment

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

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

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

Registration pull request created: JuliaRegistries/General/71094

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.6.7 -m "<description of version>" d8d98e41e7f2bd0759fb29b01210bed938753f24
git push origin v0.6.7

@sethaxen
Copy link
Member Author

Choose a reason for hiding this comment

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

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

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

Registration pull request updated: JuliaRegistries/General/71094

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.6.7 -m "<description of version>" d8d98e41e7f2bd0759fb29b01210bed938753f24
git push origin v0.6.7

Please sign in to comment.