diff --git a/pkgs/development/python-modules/arviz-plots/default.nix b/pkgs/development/python-modules/arviz-plots/default.nix new file mode 100644 index 000000000000..c0f2a3649117 --- /dev/null +++ b/pkgs/development/python-modules/arviz-plots/default.nix @@ -0,0 +1,121 @@ +{ + lib, + stdenv, + buildPythonPackage, + fetchFromGitHub, + + # build-system + flit-core, + + # dependencies + arviz-base, + arviz-stats, + + # optional-dependencies + # bokeh + bokeh, + # doc + h5netcdf, + jupyter-sphinx, + myst-nb, + myst-parser, + numpydoc, + plotly, + sphinx, + sphinx-book-theme, + sphinx-copybutton, + sphinx-design, + # matplotlib + matplotlib, + # plotly + webcolors, + # test + hypothesis, + kaleido, + pytest, + pytest-cov, + + # tests + pytestCheckHook, +}: + +buildPythonPackage (finalAttrs: { + pname = "arviz-plots"; + version = "0.8.0"; + pyproject = true; + + src = fetchFromGitHub { + owner = "arviz-devs"; + repo = "arviz-plots"; + tag = "v${finalAttrs.version}"; + hash = "sha256-x4UoUSKz+MAI082afnGhfoy2ad/hPK89Y1B2oEnxhsg="; + }; + + build-system = [ + flit-core + ]; + + dependencies = [ + arviz-base + arviz-stats + ] + # Otherwise, import fails with "ModuleNotFoundError: No module named 'xarray_einstats'" + ++ arviz-stats.optional-dependencies.xarray; + + optional-dependencies = { + bokeh = [ + bokeh + ]; + doc = [ + h5netcdf + jupyter-sphinx + myst-nb + myst-parser + numpydoc + plotly + sphinx + sphinx-book-theme + sphinx-copybutton + sphinx-design + ]; + matplotlib = [ + matplotlib + ]; + plotly = [ + plotly + webcolors + ]; + test = [ + h5netcdf + hypothesis + kaleido + pytest + pytest-cov + ]; + }; + + pythonImportsCheck = [ "arviz_plots" ]; + + env = lib.optionalAttrs stdenv.hostPlatform.isDarwin { + # Prevents 'Fatal Python error: Aborted' on darwin during checkPhase + MPLBACKEND = "Agg"; + }; + + nativeCheckInputs = [ + bokeh + h5netcdf + hypothesis + matplotlib + plotly + pytestCheckHook + webcolors + ]; + + meta = { + description = "ArviZ modular plotting"; + homepage = "https://github.com/arviz-devs/arviz-plots"; + changelog = "https://github.com/arviz-devs/arviz-plots/blob/${finalAttrs.src.tag}/CHANGELOG.md"; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ GaetanLepage ]; + }; +}) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 09ad902c29f4..16cd5cb6ab46 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -964,6 +964,8 @@ self: super: with self; { arviz-base = callPackage ../development/python-modules/arviz-base { }; + arviz-plots = callPackage ../development/python-modules/arviz-plots { }; + arviz-stats = callPackage ../development/python-modules/arviz-stats { }; arxiv = callPackage ../development/python-modules/arxiv { };