diff options
author | Dmitry Bogatov <git#v1@kaction.cc> | 2022-05-29 15:25:41 -0400 |
---|---|---|
committer | Dmitry Bogatov <git#v1@kaction.cc> | 2022-05-31 18:00:30 -0400 |
commit | d65f2b385a5285c9858fe7a8e11ac984d286288f (patch) | |
tree | a78b4093b10466f2423701f9efee0ca982f3c275 /pkgs/development/python-modules/pydantic | |
parent | 19ceefe041d6663b5b86bf04b9b370c68842bb50 (diff) |
python3.pkgs.pydantic: build offline documentation
Diffstat (limited to 'pkgs/development/python-modules/pydantic')
-rw-r--r-- | pkgs/development/python-modules/pydantic/default.nix | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/pkgs/development/python-modules/pydantic/default.nix b/pkgs/development/python-modules/pydantic/default.nix index aac95982ceaef..a886b5ba78cee 100644 --- a/pkgs/development/python-modules/pydantic/default.nix +++ b/pkgs/development/python-modules/pydantic/default.nix @@ -9,11 +9,23 @@ , python-dotenv , pythonOlder , typing-extensions +# dependencies for building documentation. +, ansi2html +, markdown-include +, mkdocs +, mkdocs-exclude +, mkdocs-material +, mdx-truly-sane-lists +, sqlalchemy +, ujson +, orjson +, hypothesis }: buildPythonPackage rec { pname = "pydantic"; version = "1.9.0"; + outputs = [ "out" "doc" ]; disabled = pythonOlder "3.7"; src = fetchFromGitHub { @@ -23,8 +35,24 @@ buildPythonPackage rec { sha256 = "sha256-C4WP8tiMRFmkDkQRrvP3yOSM2zN8pHJmX9cdANIckpM="; }; + postPatch = '' + sed -i '/flake8/ d' Makefile + ''; + nativeBuildInputs = [ cython + + # dependencies for building documentation + ansi2html + markdown-include + mdx-truly-sane-lists + mkdocs + mkdocs-exclude + mkdocs-material + sqlalchemy + ujson + orjson + hypothesis ]; propagatedBuildInputs = [ @@ -43,6 +71,18 @@ buildPythonPackage rec { export HOME=$(mktemp -d) ''; + # Must include current directory into PYTHONPATH, since documentation + # building process expects "import pydantic" to work. + preBuild = '' + PYTHONPATH=$PWD:$PYTHONPATH make docs + ''; + + # Layout documentation in same way as "sphinxHook" does. + postInstall = '' + mkdir -p $out/share/doc/$name + mv ./site $out/share/doc/$name/html + ''; + enableParallelBuilding = true; pythonImportsCheck = [ "pydantic" ]; |