Merge pull request #218673 from SuperSandro2000/nixos-render-docs-python-cleanup

nixos-render-docs: use packageOverrides to construct python packages

Sandro f17f17af a571deb0

Changed files
+41 -49
pkgs
development
python-modules
markdown-it-py
mdit-py-plugins
myst-parser
tools
nix
nixos-render-docs
+22 -19
pkgs/development/python-modules/markdown-it-py/default.nix
···
{ lib
, attrs
, buildPythonPackage
+
, commonmark
, fetchFromGitHub
, flit-core
, linkify-it-py
+
, markdown
, mdurl
-
, psutil
-
, py
-
, pytest-benchmark
+
, mistletoe
+
, mistune
+
, myst-parser
+
, panflute
+
, pyyaml
+
, sphinx
+
, sphinx-book-theme
+
, sphinx-copybutton
+
, sphinx-design
, pytest-regressions
, pytestCheckHook
, pythonOlder
-
, typing-extensions
-
# allow disabling tests for the nixos manual build.
-
# the test suite closure is just too large.
-
, disableTests ? false
}:
buildPythonPackage rec {
···
];
propagatedBuildInputs = [
-
attrs
-
linkify-it-py
mdurl
-
] ++ lib.optionals (pythonOlder "3.8") [
-
typing-extensions
];
nativeCheckInputs = [
-
psutil
-
py
-
] ++ lib.optionals (! disableTests) [
-
pytest-benchmark
pytest-regressions
pytestCheckHook
-
];
+
] ++ passthru.optional-dependencies.linkify;
-
pytestFlagsArray = [
-
"--benchmark-skip"
-
];
+
# disable and remove benchmark tests
+
preCheck = ''
+
rm -r benchmarking
+
'';
pythonImportsCheck = [
"markdown_it"
];
+
+
passthru.optional-dependencies = {
+
compare = [ commonmark markdown mistletoe mistune panflute ];
+
linkify = [ linkify-it-py ];
+
rtd = [ attrs myst-parser pyyaml sphinx sphinx-copybutton sphinx-design sphinx-book-theme ];
+
};
meta = with lib; {
description = "Markdown parser in Python";
+1 -4
pkgs/development/python-modules/mdit-py-plugins/default.nix
···
, markdown-it-py
, pytest-regressions
, pytestCheckHook
-
# allow disabling tests for the nixos manual build.
-
# the test suite closure is just too large.
-
, disableTests ? false
}:
buildPythonPackage rec {
···
markdown-it-py
];
-
nativeCheckInputs = lib.optionals (!disableTests) [
+
nativeCheckInputs = [
pytestCheckHook
pytest-regressions
];
+1 -1
pkgs/development/python-modules/myst-parser/default.nix
···
pytest-regressions
sphinx-pytest
pytestCheckHook
-
];
+
] ++ markdown-it-py.optional-dependencies.linkify;
disabledTests = [
# AssertionError due to different files
+17 -25
pkgs/tools/nix/nixos-render-docs/default.nix
···
python = ((if stdenv.isDarwin then python3 else python3Minimal).override {
self = python;
includeSiteCustomize = true;
-
});
-
-
# TODO add our own small test suite, maybe add tests for these deps to channels?
-
markdown-it-py-no-tests = python.pkgs.markdown-it-py.override {
-
disableTests = true;
+
}).override {
+
packageOverrides = final: prev: {
+
markdown-it-py = prev.markdown-it-py.overridePythonAttrs (_: {
+
doCheck = false;
+
});
+
mdit-py-plugins = prev.mdit-py-plugins.overridePythonAttrs (_: {
+
doCheck = false;
+
});
+
};
};
-
mdit-py-plugins-no-tests = python.pkgs.mdit-py-plugins.override {
-
markdown-it-py = markdown-it-py-no-tests;
-
disableTests = true;
-
};
-
-
makeDeps = pkgs: small:
-
if small
-
then [
-
markdown-it-py-no-tests
-
mdit-py-plugins-no-tests
-
]
-
else [
-
pkgs.markdown-it-py
-
pkgs.mdit-py-plugins
-
];
in
python.pkgs.buildPythonApplication rec {
···
src = ./src;
};
-
nativeBuildInputs = [
-
python.pkgs.setuptools
-
python.pkgs.pytestCheckHook
+
nativeBuildInputs = with python.pkgs; [
+
setuptools
+
pytestCheckHook
];
-
propagatedBuildInputs = makeDeps python.pkgs true;
+
propagatedBuildInputs = with python.pkgs; [
+
markdown-it-py
+
mdit-py-plugins
+
];
pytestFlagsArray = [ "-vvrP" "tests/" ];
···
# build closures small. mypy has an unreasonably large build closure for docs builds.
passthru.tests.typing = runCommand "${pname}-mypy" {
nativeBuildInputs = [
-
(python3.withPackages (p: [ p.mypy p.pytest ] ++ makeDeps p false))
+
(python3.withPackages (ps: with ps; [ mypy pytest markdown-it-py mdit-py-plugins ]))
];
} ''
mypy --strict ${src}