nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pythonAtLeast,
6
7 # build-system
8 hatchling,
9 uv-dynamic-versioning,
10
11 # dependencies
12 docstring-parser,
13 typing-extensions,
14
15 # optional-dependencies
16 tomli,
17 tomli-w,
18 pyyaml,
19
20 # tests
21 matplotlib,
22 numpy,
23 orion,
24 pytest-benchmark,
25 pytest-regressions,
26 pytestCheckHook,
27}:
28
29buildPythonPackage (finalAttrs: {
30 pname = "simple-parsing";
31 version = "0.1.8";
32 pyproject = true;
33
34 src = fetchFromGitHub {
35 owner = "lebrice";
36 repo = "SimpleParsing";
37 tag = "v${finalAttrs.version}";
38 hash = "sha256-Nsr+I+BoVxockRGQAjG+ushRQ4CtWgkHrg5aVorSrvw=";
39 };
40
41 build-system = [
42 hatchling
43 uv-dynamic-versioning
44 ];
45
46 dependencies = [
47 docstring-parser
48 typing-extensions
49 ];
50
51 optional-dependencies = {
52 toml = [
53 tomli
54 tomli-w
55 ];
56 yaml = [ pyyaml ];
57 };
58
59 pythonImportsCheck = [ "simple_parsing" ];
60
61 nativeCheckInputs = [
62 matplotlib
63 numpy
64 orion
65 pytest-benchmark
66 pytest-regressions
67 pytestCheckHook
68 ];
69
70 pytestFlags = [ "--benchmark-disable" ];
71
72 disabledTests = [
73 # AssertionError
74 # https://github.com/lebrice/SimpleParsing/issues/338
75 "test_bool_args_in_help"
76 "test_desc_from_cls_docstring"
77 "test_docstring_builds_upon_bases"
78 "test_help_string"
79 "test_help_string_displays_default_factory_arguments"
80 "test_help_takes_value_from_docstring"
81 "test_issue_48"
82 "test_running_example_outputs_expected_without_arg"
83 "test_subgroup_partial_with_nested_field"
84 "test_weird_docstring_with_field_like"
85 ]
86 ++ lib.optionals (pythonAtLeast "3.14") [
87 # AssertionError ("usagepython314mpytesthmixed..." != "usagepython314mpytesthmixed")
88 "test_each_type_is_used_correctly"
89 "test_issue_46"
90 "test_issue_46_solution2"
91
92 # TypeError: dest= is required for options like '---------'
93 "test_pass_invalid_value_to_add_config_path_arg"
94 ];
95
96 meta = {
97 description = "Simple, Elegant, Typed Argument Parsing with argparse";
98 changelog = "https://github.com/lebrice/SimpleParsing/releases/tag/${finalAttrs.src.tag}";
99 homepage = "https://github.com/lebrice/SimpleParsing";
100 license = lib.licenses.mit;
101 maintainers = with lib.maintainers; [ GaetanLepage ];
102 };
103})