1{ lib
2, aiofiles
3, buildPythonPackage
4, cached-property
5, colorama
6, fetchFromGitHub
7, git
8, jsonschema
9, pdm-backend
10, pytestCheckHook
11, pythonOlder
12}:
13
14buildPythonPackage rec {
15 pname = "griffe";
16 version = "0.29.0";
17 format = "pyproject";
18
19 disabled = pythonOlder "3.7";
20
21 src = fetchFromGitHub {
22 owner = "mkdocstrings";
23 repo = pname;
24 rev = "refs/tags/${version}";
25 hash = "sha256-WZJogwxhSScJpTFVJaMn6LyIyZtOAxTnY3232NW0bds=";
26 };
27
28 postPatch = ''
29 substituteInPlace pyproject.toml \
30 --replace 'dynamic = ["version"]' 'version = "${version}"' \
31 --replace 'license = "ISC"' 'license = {file = "LICENSE"}' \
32 --replace 'version = {source = "scm"}' 'license-expression = "ISC"'
33 '';
34
35 nativeBuildInputs = [
36 pdm-backend
37 ];
38
39 propagatedBuildInputs = [
40 colorama
41 ] ++ lib.optionals (pythonOlder "3.8") [
42 cached-property
43 ];
44
45 nativeCheckInputs = [
46 git
47 jsonschema
48 pytestCheckHook
49 ];
50
51 passthru.optional-dependencies = {
52 async = [
53 aiofiles
54 ];
55 };
56
57 pythonImportsCheck = [
58 "griffe"
59 ];
60
61 meta = with lib; {
62 description = "Signatures for entire Python programs";
63 homepage = "https://github.com/mkdocstrings/griffe";
64 changelog = "https://github.com/mkdocstrings/griffe/blob/${version}/CHANGELOG.md";
65 license = licenses.isc;
66 maintainers = with maintainers; [ fab ];
67 };
68}