1{
2 lib,
3 antlr4,
4 antlr4-python3-runtime,
5 attrs,
6 buildPythonPackage,
7 fetchFromGitHub,
8 setuptools,
9 jre_minimal,
10 pydevd,
11 pytest-mock,
12 pytest7CheckHook,
13 pythonAtLeast,
14 pythonOlder,
15 pyyaml,
16 replaceVars,
17}:
18
19buildPythonPackage rec {
20 pname = "omegaconf";
21 version = "2.3.0";
22 pyproject = true;
23
24 disabled = pythonOlder "3.6";
25
26 src = fetchFromGitHub {
27 owner = "omry";
28 repo = "omegaconf";
29 tag = "v${version}";
30 hash = "sha256-Qxa4uIiX5TAyQ5rFkizdev60S4iVAJ08ES6FpNqf8zI=";
31 };
32
33 patches = [
34 (replaceVars ./antlr4.patch {
35 antlr_jar = "${antlr4.out}/share/java/antlr-${antlr4.version}-complete.jar";
36 })
37
38 # https://github.com/omry/omegaconf/pull/1137
39 ./0000-add-support-for-dataclasses_missing_type.patch
40 ];
41
42 postPatch = ''
43 # We substitute the path to the jar with the one from our antlr4
44 # package, so this file becomes unused
45 rm -v build_helpers/bin/antlr*-complete.jar
46
47 sed -i 's/antlr4-python3-runtime==.*/antlr4-python3-runtime/' requirements/base.txt
48 '';
49
50 build-system = [ setuptools ];
51
52 nativeBuildInputs = [ jre_minimal ];
53
54 dependencies = [
55 antlr4-python3-runtime
56 pyyaml
57 ];
58
59 nativeCheckInputs = [
60 attrs
61 pydevd
62 pytest-mock
63 pytest7CheckHook
64 ];
65
66 pythonImportsCheck = [ "omegaconf" ];
67
68 pytestFlags = [
69 "-Wignore::DeprecationWarning"
70 "-Wignore::UserWarning"
71 ];
72
73 disabledTests = [
74 # assert (1560791320562868035 == 1560791320562868035) == False
75 "test_eq"
76 ]
77 ++ lib.optionals (pythonAtLeast "3.13") [
78 # pathlib._local.Path != pathlib.Path type check mismatch
79 "test_errors"
80 "test_to_yaml"
81 "test_type_str"
82 ];
83
84 meta = with lib; {
85 description = "Framework for configuring complex applications";
86 homepage = "https://github.com/omry/omegaconf";
87 changelog = "https://github.com/omry/omegaconf/blob/v${version}/NEWS.md";
88 license = licenses.bsd3;
89 maintainers = with maintainers; [ bcdarwin ];
90 };
91}