-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use PythonCall to wrap Python ArviZ (#5)
* Add CondaPkg.toml * Replace PyCall packages with PythonCall equivalents * Add LazyHelp utility * Use LazyHelp utility for docs * Update imports * Update utilities to use PythonCall * Update conversion and styles * Update conversions to ELPDData * Update plotting functions to use PythonCall * Update examples.md * Update docs deps * Update docs * Remove PyCall-specific CI code * Use simpler caching action * Cache CondaPkg artifacts * Remove futures workflow * Run formatter * Remove build fiile * Remove prefix * Index axes from 0 * Use pywith in example * Overload Py methods * Delete unused macro * Add topytype * Simplify plotting functions * Don't import PyCall * Run formatter * Convert styles list * Fixes for utils * Update some tests * Enable strict docs building * Remove setup code * Remove todataframes * Remove frompytype * Remove convert_result * Remove unused topandas method * Replace DataFrames with Tables * Remove conversions from Py to InferenceObjects * Simplify rcparams code * Fix rcparams bugs * Use topytype utility * Run formatter * Fix topytype * Update tests * Increment lower Julia version bound * Bump lower Julia version bound * Update docs * Don't reexport ArviZ * Update docs * Increment ArviZ version bound * Also run CI on nightly
- Loading branch information
Showing
31 changed files
with
454 additions
and
1,012 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ | |
/docs/build | ||
/test/*.log | ||
.DS_Store | ||
.CondaPkg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[deps] | ||
pandas = "" | ||
matplotlib = "" | ||
xarray = "" | ||
arviz = ">=0.14.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
using Documenter, Markdown, PythonCall | ||
|
||
# adapted from https://github.com/AtelierArith/Kyulacs.jl for PythonCall | ||
# MIT License | ||
# Copyright (c) 2022 Satoshi Terasaki <[email protected]> and contributors | ||
|
||
function get_signature(f) | ||
inspect = pyimport("inspect") | ||
try | ||
return pyconvert(String, inspect.signature(f)) | ||
catch e | ||
return "" | ||
end | ||
end | ||
|
||
function gendocstr(h::LazyHelp) | ||
o = h.o | ||
for k in h.keys | ||
o = pygetattr(o, k) | ||
end | ||
fname = pyhasattr(o, "__name__") ? pyconvert(String, o.__name__) : "" | ||
sig = pyhasattr(o, "__call__") ? get_signature(o) : "" | ||
fdoc = pyhasattr(o, "__doc__") ? pyconvert(String, o.__doc__) : "" | ||
|
||
if isnothing(fdoc) | ||
return """ | ||
$(fname)$(sig) | ||
""" | ||
else | ||
return """ | ||
$(fdoc) | ||
""" | ||
end | ||
end | ||
|
||
function Documenter.Writers.HTMLWriter.mdconvert(h::LazyHelp, parent; kwargs...) | ||
s = gendocstr(h) | ||
# quote docstring `s` to prevent changing display result | ||
m = Markdown.parse(""" | ||
``` | ||
$s | ||
``` | ||
""") | ||
return Documenter.Writers.HTMLWriter.mdconvert(m, parent; kwargs...) | ||
end | ||
|
||
Documenter.Utilities.MDFlatten.mdflatten(::IOBuffer, ::LazyHelp, ::Markdown.MD) = nothing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
71afdf6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
71afdf6
There was a problem hiding this comment.
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/88578
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:
71afdf6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
71afdf6
There was a problem hiding this comment.
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/88578
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: