Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / python-modules / pytest-examples / default.nix
blob3ac626a3f997a822eace0fc1743f6a08f405d108
1 { lib
2 , black
3 , buildPythonPackage
4 , fetchFromGitHub
5 , hatchling
6 , pytest
7 , pytestCheckHook
8 , pythonOlder
9 , pythonRelaxDepsHook
10 , ruff
13 buildPythonPackage rec {
14   pname = "pytest-examples";
15   version = "0.0.10";
16   format = "pyproject";
18   disabled = pythonOlder "3.8";
20   src = fetchFromGitHub {
21     owner = "pydantic";
22     repo = "pytest-examples";
23     rev = "refs/tags/v${version}";
24     hash = "sha256-jCxOGDJlFkMH9VtaaPsE5zt+p3Z/mrVzhdNSI51/nVM=";
25   };
27   postPatch = ''
28     # ruff binary is used directly, the ruff Python package is not needed
29     substituteInPlace pytest_examples/lint.py \
30       --replace "'ruff'" "'${ruff}/bin/ruff'"
31   '';
33   pythonRemoveDeps = [
34     "ruff"
35   ];
37   nativeBuildInputs = [
38     hatchling
39     pythonRelaxDepsHook
40   ];
42   buildInputs = [
43     pytest
44   ];
46   propagatedBuildInputs = [
47     black
48     ruff
49   ];
51   nativeCheckInputs = [
52     pytestCheckHook
53   ];
55   pythonImportsCheck = [
56     "pytest_examples"
57   ];
59   disabledTests = [
60     # Test fails with latest ruff v0.1.2
61     # See https://github.com/pydantic/pytest-examples/issues/26
62     "test_ruff_error"
63   ];
65   meta = with lib; {
66     description = "Pytest plugin for testing examples in docstrings and markdown files";
67     homepage = "https://github.com/pydantic/pytest-examples";
68     changelog = "https://github.com/pydantic/pytest-examples/releases/tag/v${version}";
69     license = licenses.mit;
70     maintainers = with maintainers; [ fab ];
71   };