nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 149 lines 3.8 kB view raw
1{ 2 lib, 3 buildPythonPackage, 4 fetchFromGitHub, 5 6 # build-system 7 setuptools, 8 9 # patches 10 replaceVars, 11 antlr4, 12 fetchpatch, 13 14 # nativeBuildInputs 15 jre_headless, 16 17 # dependencies 18 antlr4-python3-runtime, 19 omegaconf, 20 packaging, 21 22 # tests 23 pytest8_3CheckHook, 24 pythonAtLeast, 25}: 26 27buildPythonPackage (finalAttrs: { 28 pname = "hydra-core"; 29 version = "1.3.2"; 30 pyproject = true; 31 32 src = fetchFromGitHub { 33 owner = "facebookresearch"; 34 repo = "hydra"; 35 tag = "v${finalAttrs.version}"; 36 hash = "sha256-kD4BStnstr5hwyAOxdpPzLAJ9MZqU/CPiHkaD2HnUPI="; 37 }; 38 39 patches = [ 40 (replaceVars ./antlr4.patch { 41 antlr_jar = "${antlr4.out}/share/java/antlr-${antlr4.version}-complete.jar"; 42 }) 43 # https://github.com/facebookresearch/hydra/pull/2731 44 (fetchpatch { 45 name = "setuptools-67.5.0-test-compatibility.patch"; 46 url = "https://github.com/facebookresearch/hydra/commit/25873841ed8159ab25a0c652781c75cc4a9d6e08.patch"; 47 hash = "sha256-oUfHlJP653o3RDtknfb8HaaF4fpebdR/OcbKHzJFK/Q="; 48 }) 49 ]; 50 51 postPatch = '' 52 # We substitute the path to the jar with the one from our antlr4 53 # package, so this file becomes unused 54 rm -v build_helpers/bin/antlr*-complete.jar 55 ''; 56 57 build-system = [ 58 setuptools 59 ]; 60 61 nativeBuildInputs = [ jre_headless ]; 62 63 pythonRelaxDeps = [ 64 "antlr4-python3-runtime" 65 ]; 66 67 dependencies = [ 68 antlr4-python3-runtime 69 omegaconf 70 packaging 71 ]; 72 73 nativeCheckInputs = [ pytest8_3CheckHook ]; 74 75 pytestFlags = [ 76 "-Wignore::UserWarning" 77 ]; 78 79 # Test environment setup broken under Nix for a few tests: 80 disabledTests = [ 81 "test_bash_completion_with_dot_in_path" 82 "test_install_uninstall" 83 "test_config_search_path" 84 # does not raise UserWarning 85 "test_initialize_compat_version_base" 86 ] 87 ++ lib.optionals (pythonAtLeast "3.13") [ 88 # AssertionError: Regex pattern did not match 89 "test_failure" 90 ] 91 ++ lib.optionals (pythonAtLeast "3.14") [ 92 # AssertionError: Regex pattern did not match 93 "test_partial_failure" 94 95 # AssertionError: Mismatch between expected and actual text 96 "test_write_protect_config_node" 97 98 # ValueError: badly formed help string 99 "TestBasicLauncherIntegration" 100 "test_cli_error" 101 "test_completion_plugin" 102 "test_completion_plugin_multirun" 103 "test_configuring_experiments" 104 "test_examples_using_the_config_object" 105 "test_extending_configs" 106 "test_file_completion" 107 "test_missing_default_value" 108 "test_multi_select" 109 "test_searchpath_addition" 110 "test_tutorial_config_file" 111 "test_tutorial_config_file_bad_key" 112 "test_tutorial_config_groups" 113 "test_tutorial_defaults" 114 "test_tutorial_logging" 115 "test_tutorial_simple_cli_app" 116 "test_tutorial_working_directory" 117 "test_tutorial_working_directory_original_cwd" 118 "test_with_flags" 119 ]; 120 121 disabledTestPaths = [ 122 "tests/test_hydra.py" 123 ] 124 ++ lib.optionals (pythonAtLeast "3.14") [ 125 # ValueError: badly formed help string 126 "tests/test_callbacks.py" 127 "tests/test_env_defaults.py" 128 "tests/test_examples/test_advanced_package_overrides.py" 129 "tests/test_examples/test_basic_sweep.py" 130 "tests/test_examples/test_configure_hydra.py" 131 "tests/test_examples/test_experimental.py" 132 "tests/test_examples/test_instantiate_examples.py" 133 "tests/test_examples/test_structured_configs_tutorial.py" 134 ]; 135 136 pythonImportsCheck = [ 137 "hydra" 138 # See https://github.com/NixOS/nixpkgs/issues/208843 139 "hydra.version" 140 ]; 141 142 meta = { 143 description = "Framework for configuring complex applications"; 144 homepage = "https://hydra.cc"; 145 changelog = "https://github.com/facebookresearch/hydra/blob/${finalAttrs.src.tag}/NEWS.md"; 146 license = lib.licenses.mit; 147 maintainers = with lib.maintainers; [ bcdarwin ]; 148 }; 149})