1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 mock,
6 pytestCheckHook,
7 pyyaml,
8 pythonAtLeast,
9 pythonOlder,
10}:
11
12buildPythonPackage rec {
13 pname = "configargparse";
14 version = "1.7";
15 format = "setuptools";
16
17 disabled = pythonOlder "3.7";
18
19 src = fetchFromGitHub {
20 owner = "bw2";
21 repo = "ConfigArgParse";
22 tag = version;
23 hash = "sha256-m77MY0IZ1AJkd4/Y7ltApvdF9y17Lgn92WZPYTCU9tA=";
24 };
25
26 patches = [
27 # https://github.com/bw2/ConfigArgParse/pull/295
28 ./python3.13-compat.patch
29 ];
30
31 optional-dependencies = {
32 yaml = [ pyyaml ];
33 };
34
35 nativeCheckInputs = [
36 pytestCheckHook
37 mock
38 ] ++ lib.flatten (lib.attrValues optional-dependencies);
39
40 disabledTests = lib.optionals (pythonAtLeast "3.13") [
41 # regex mismatch
42 "testMutuallyExclusiveArgs"
43 ];
44
45 pythonImportsCheck = [ "configargparse" ];
46
47 meta = with lib; {
48 description = "Drop-in replacement for argparse";
49 homepage = "https://github.com/bw2/ConfigArgParse";
50 changelog = "https://github.com/bw2/ConfigArgParse/releases/tag/${version}";
51 license = licenses.mit;
52 maintainers = with maintainers; [ willibutz ];
53 };
54}