From be0dc506c70a574625f654409c87ecaa2a968ca0 Mon Sep 17 00:00:00 2001 From: Oriol Abril-Pla Date: Thu, 20 Jun 2024 23:29:38 +0200 Subject: [PATCH] Prepare initial pre-release (#54) * add links between sub-libraries * bump version * use accessor in plot_forest docstring * bump version and configure publishing --- .github/workflows/publish.yml | 10 +++++----- .pylintrc | 1 + docs/source/_static/custom.css | 9 +++++++++ docs/source/_static/favicon.ico | Bin 0 -> 5054 bytes docs/source/_templates/name.html | 5 +++++ docs/source/conf.py | 11 +++++++++++ pyproject.toml | 4 ++-- src/arviz_plots/_version.py | 2 +- src/arviz_plots/plots/distplot.py | 4 ++-- src/arviz_plots/plots/forestplot.py | 10 +++++----- 10 files changed, 41 insertions(+), 15 deletions(-) create mode 100644 docs/source/_static/custom.css create mode 100644 docs/source/_static/favicon.ico create mode 100644 docs/source/_templates/name.html diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 82963248..6c8fea78 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -2,8 +2,6 @@ name: Publish library on: push: - branches: - - main tags: # Don't try to be smart about PEP 440 compliance, # see https://www.python.org/dev/peps/pep-0440/#appendix-b-parsing-version-strings-with-regular-expressions @@ -11,7 +9,12 @@ on: jobs: publish: + environment: + name: publish + url: https://pypi.org/p/arviz-plots runs-on: ubuntu-latest + permissions: + id-token: write steps: - uses: actions/checkout@v4 - name: Set up Python @@ -25,6 +28,3 @@ jobs: - name: Publish to PyPI uses: pypa/gh-action-pypi-publish@release/v1 if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') - with: - user: __token__ - password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.pylintrc b/.pylintrc index 381ce9a6..0e48a263 100644 --- a/.pylintrc +++ b/.pylintrc @@ -66,6 +66,7 @@ disable=missing-docstring, not-an-iterable, no-member, import-error, + possibly-used-before-assignment, fixme diff --git a/docs/source/_static/custom.css b/docs/source/_static/custom.css new file mode 100644 index 00000000..19d23318 --- /dev/null +++ b/docs/source/_static/custom.css @@ -0,0 +1,9 @@ +html[data-theme="light"] { + --pst-color-primary: rgb(11 117 145); + --pst-color-secondary: rgb(238 144 64); +} + +html[data-theme="dark"] { + --pst-color-primary: rgb(0 192 191); + --pst-color-secondary: rgb(238 144 64); +} diff --git a/docs/source/_static/favicon.ico b/docs/source/_static/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..c350216b4d34eacdafae1497c74b26e91878a202 GIT binary patch literal 5054 zcmds*T}TvB6vywTw&Dkp_6g~VB=t}c31*SlhqTWLz4@B-64XPWLTJ>|2R>weu5229 zv5P5^=Es_8ArxU06h27NmO&4__>dqWoc?E=yG-Nk?rb~mLM#70_ug^u`OUdA=iC_~ zZ1^k87x>N>-W(xz3Ly?ah0rO8$N$IAw-?SGkQ2HHbwF;Y4XT1FpzZNGZ}_T&CLl7Q z`9=Sk%9$Baq-vj)obX=+Etud4vc4HOK^@n3k>^f2`6spzxL7ODFmwS*{#QnD@cOKn z<@qvmj-GcNrN(QSLABk;&~iz>pWwO#rA5OAj^og8Gdv$h%M=!ljh08YJ6!2BJ#CXb zTKfZB6=u1>^4EGT`p?q4;Zl0#Eg`?>2#vNLq`tca)KZgU$RT;8^?K}D7JYj#Qp~`^ z_Z2OSou+a3Ve-`NG38hK4`l~?x9VB6{W)-Dg^JndXXW+G5^C;P#`(JUb=qmzmtu6C zy)=p!kM%TW&&T37n%^=b^TDr_OCKv7bM>{SZc2>8vAS=i)8v?vH#lbm^Deicm7)HW zxHBaVT5Qq3?qy4dQE_bA50Pd5>lk|7gaZwjCnWd1hhN z>U~G*gC`g2kzBE?AIIkH&`HVi3p}Nf{D(UZCMUGS`;2H}BLBDlUV*%Bm}v>h3+K=5 zF)%rvJWdWsKW443p^$j54i2f9;-lvUS6*{%##ggEyieBgH0kHGqCeMv%-MA_H|!d6 zjZkxrj1619hJrcT3Ks1gpQg&I=K6|>*QK>~{W+oMcD}NI=VuAcI%(Tiv~z4m8-DrO z*zEJ)#AYxU%?YNxPE`H!_Gp|rlMUBMQi2nr7gi60jL_1{=ud2kP!A& hj8pwOC(R0n(hsP1S(GXLRZ*wdHPw<$IX`*ce*pIH@WKE9 literal 0 HcmV?d00001 diff --git a/docs/source/_templates/name.html b/docs/source/_templates/name.html new file mode 100644 index 00000000..699a95d2 --- /dev/null +++ b/docs/source/_templates/name.html @@ -0,0 +1,5 @@ +
+
BASE
+
STATS
+
PLOTS
+
diff --git a/docs/source/conf.py b/docs/source/conf.py index d1f9e40b..6406c244 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -124,4 +124,15 @@ "image_dark": "_static/ArviZ_white.png", } } +html_favicon = "_static/favicon.ico" html_static_path = ["_static"] +html_css_files = ["custom.css"] +html_sidebars = { + "**": [ + "navbar-logo.html", + "name.html", + "icon-links.html", + "search-button-field.html", + "sbt-sidebar-nav.html", + ] +} diff --git a/pyproject.toml b/pyproject.toml index fcc6f720..9a1c2feb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,8 +26,8 @@ classifiers = [ ] dynamic = ["version", "description"] dependencies = [ - "arviz-base", - "arviz-stats @ git+https://github.com/arviz-devs/arviz-stats", + "arviz-base==0.2", + "arviz-stats[xarray]==0.2", ] [tool.flit.module] diff --git a/src/arviz_plots/_version.py b/src/arviz_plots/_version.py index d917ff8b..6500e9fb 100644 --- a/src/arviz_plots/_version.py +++ b/src/arviz_plots/_version.py @@ -1,2 +1,2 @@ """Base ArviZ version.""" -__version__ = "0.1.0" +__version__ = "0.2.0" diff --git a/src/arviz_plots/plots/distplot.py b/src/arviz_plots/plots/distplot.py index 544b485f..edeb171f 100644 --- a/src/arviz_plots/plots/distplot.py +++ b/src/arviz_plots/plots/distplot.py @@ -66,7 +66,7 @@ def plot_dist( How to represent the marginal density. Defaults to ``rcParams["plot.density_kind"]`` point_estimate : {"mean", "median", "mode"}, optional - Which point estimate to plot. Defaults to ``rcParams["plot.point_estimate"]`` + Which point estimate to plot. Defaults to rcParam :data:`stats.point_estimate` ci_kind : {"eti", "hdi"}, optional Which credible interval to use. Defaults to ``rcParams["stats.ci_kind"]`` ci_prob : float, optional @@ -173,7 +173,7 @@ def plot_dist( if ci_kind is None: ci_kind = rcParams["stats.ci_kind"] if "stats.ci_kind" in rcParams else "eti" if point_estimate is None: - point_estimate = rcParams["plot.point_estimate"] + point_estimate = rcParams["stats.point_estimate"] if kind is None: kind = rcParams["plot.density_kind"] if plot_kwargs is None: diff --git a/src/arviz_plots/plots/forestplot.py b/src/arviz_plots/plots/forestplot.py index f4a2a7bf..80979aed 100644 --- a/src/arviz_plots/plots/forestplot.py +++ b/src/arviz_plots/plots/forestplot.py @@ -63,7 +63,7 @@ def plot_forest( Whether to plot intervals for each chain or not. Ignored when the "chain" dimension is not present. point_estimate : {"mean", "median", "mode"}, optional - Which point estimate to plot. Defaults to ``rcParams["plot.point_estimate"]`` + Which point estimate to plot. Defaults to rcParam :data:`stats.point_estimate` ci_kind : {"eti", "hdi"}, optional Which credible interval to use. Defaults to ``rcParams["stats.ci_kind"]`` ci_probs : (float, float), optional @@ -187,14 +187,14 @@ def plot_forest( :context: close-figs >>> from arviz_plots import visuals - >>> from arviz_stats.base import ess + >>> import arviz_stats # make accessor available >>> >>> c_aux = centered["posterior"].expand_dims( >>> column=3 >>> ).assign_coords(column=["labels", "forest", "ess"]) >>> pc = plot_forest(c_aux, combined=True) >>> pc.map( - >>> visuals.scatter_x, "ess", data=ess(centered), + >>> visuals.scatter_x, "ess", data=centered.azstats.ess().ds, >>> coords={"column": "ess"}, color="C0" >>> ) @@ -217,7 +217,7 @@ def plot_forest( if ci_kind is None: ci_kind = rcParams["stats.ci_kind"] if "stats.ci_kind" in rcParams else "eti" if point_estimate is None: - point_estimate = rcParams["plot.point_estimate"] + point_estimate = rcParams["stats.point_estimate"] if plot_kwargs is None: plot_kwargs = {} if pc_kwargs is None: @@ -328,7 +328,7 @@ def plot_forest( np.linspace(-0.2, 0.2, distribution.sizes["model"]), coords={"model": distribution.model}, ) - chain_lim = 0.4 * (model_spacing[1] - model_spacing[0]) + chain_lim = 0.4 * (model_spacing[1] - model_spacing[0]).item() chain_spacing = xr.DataArray( np.linspace(-chain_lim, chain_lim, distribution.sizes["chain"]), coords={"chain": distribution.chain},