1{
2 lib,
3 black,
4 buildPythonPackage,
5 fetchFromGitHub,
6 hatchling,
7 pytest,
8 pytestCheckHook,
9 pythonOlder,
10 ruff,
11}:
12
13buildPythonPackage rec {
14 pname = "pytest-examples";
15 version = "0.0.12";
16 pyproject = true;
17
18 disabled = pythonOlder "3.7";
19
20 src = fetchFromGitHub {
21 owner = "pydantic";
22 repo = "pytest-examples";
23 rev = "refs/tags/v${version}";
24 hash = "sha256-hTLTL3w4OEv8Pkzc/h9qDMnlhe6P+Q6XUImLVDsDKvk=";
25 };
26
27 postPatch = ''
28 # ruff binary is used directly, the ruff Python package is not needed
29 substituteInPlace pytest_examples/lint.py \
30 --replace-fail "'ruff'" "'${lib.getExe ruff}'"
31 '';
32
33 pythonRemoveDeps = [ "ruff" ];
34
35 build-system = [
36 hatchling
37 ];
38
39 buildInputs = [ pytest ];
40
41 dependencies = [ black ];
42
43 nativeCheckInputs = [ pytestCheckHook ];
44
45 pythonImportsCheck = [ "pytest_examples" ];
46
47 meta = {
48 description = "Pytest plugin for testing examples in docstrings and markdown files";
49 homepage = "https://github.com/pydantic/pytest-examples";
50 changelog = "https://github.com/pydantic/pytest-examples/releases/tag/v${version}";
51 license = lib.licenses.mit;
52 maintainers = with lib.maintainers; [ fab ];
53 };
54}