Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib 2, buildPythonPackage 3, fetchFromGitHub 4, pythonOlder 5 6# build 7, pdm-pep517 8 9# docs 10, docutils 11, sphinxHook 12, sphinx-rtd-theme 13, sphinx-autodoc-typehints 14 15# runtime 16, tomli 17, packaging 18 19# optionals 20, pydantic 21, platformdirs 22, sphinx 23, tabulate 24 25# tests 26, pytestCheckHook 27}: 28 29buildPythonPackage rec { 30 pname = "pytoolconfig"; 31 version = "1.2.5"; 32 format = "pyproject"; 33 34 disabled = pythonOlder "3.8"; 35 36 src = fetchFromGitHub { 37 owner = "bagel897"; 38 repo = "pytoolconfig"; 39 rev = "refs/tags/v${version}"; 40 hash = "sha256-b7er/IgXr2j9dSnI87669BXWA5CXNTzwa1DTpl8PBZ4="; 41 }; 42 43 outputs = [ 44 "out" 45 "doc" 46 ]; 47 48 PDM_PEP517_SCM_VERSION = version; 49 50 nativeBuildInputs = [ 51 pdm-pep517 52 53 # docs 54 docutils 55 sphinx-autodoc-typehints 56 sphinx-rtd-theme 57 sphinxHook 58 ] ++ passthru.optional-dependencies.doc; 59 60 postPatch = '' 61 substituteInPlace pyproject.toml \ 62 --replace "packaging>=22.0" "packaging" 63 ''; 64 65 propagatedBuildInputs = [ 66 packaging 67 ] ++ lib.optionals (pythonOlder "3.11") [ 68 tomli 69 ]; 70 71 passthru.optional-dependencies = { 72 validation = [ 73 pydantic 74 ]; 75 global = [ 76 platformdirs 77 ]; 78 doc = [ 79 sphinx 80 tabulate 81 ]; 82 }; 83 84 pythonImportsCheck = [ 85 "pytoolconfig" 86 ]; 87 88 nativeCheckInputs = [ 89 pytestCheckHook 90 ] ++ lib.flatten (builtins.attrValues passthru.optional-dependencies); 91 92 meta = with lib; { 93 changelog = "https://github.com/bagel897/pytoolconfig/releases/tag/v${version}"; 94 description = "Python tool configuration"; 95 homepage = "https://github.com/bagel897/pytoolconfig"; 96 license = licenses.lgpl3Plus; 97 maintainers = with maintainers; [ fab hexa ]; 98 }; 99}