sof-firmware: 2024.09.2 -> 2025.01 (#378401)
[NixPkgs.git] / pkgs / by-name / ha / hatch / package.nix
blob215d6a45f1d0d355e1331eeb983ca3d55dadb319
2   lib,
3   stdenv,
4   python3Packages,
5   fetchFromGitHub,
6   replaceVars,
7   git,
8   cargo,
9   versionCheckHook,
10   writableTmpDirAsHomeHook,
11   darwin,
12   nix-update-script,
15 python3Packages.buildPythonApplication rec {
16   pname = "hatch";
17   version = "1.14.0";
18   pyproject = true;
20   src = fetchFromGitHub {
21     owner = "pypa";
22     repo = "hatch";
23     tag = "hatch-v${version}";
24     hash = "sha256-JwFPNoFoNqAXkLCGhliLN98VAS+VCwRzo+JqWLIrxsw=";
25   };
27   patches = [ (replaceVars ./paths.patch { uv = lib.getExe python3Packages.uv; }) ];
29   build-system = with python3Packages; [
30     hatchling
31     hatch-vcs
32   ];
34   pythonRemoveDeps = [ "uv" ];
36   dependencies = with python3Packages; [
37     click
38     hatchling
39     httpx
40     hyperlink
41     keyring
42     packaging
43     pexpect
44     platformdirs
45     rich
46     shellingham
47     tomli-w
48     tomlkit
49     userpath
50     virtualenv
51     zstandard
52   ];
54   nativeCheckInputs =
55     with python3Packages;
56     [
57       binary
58       git
59       pytestCheckHook
60       pytest-mock
61       pytest-xdist
62       setuptools
63     ]
64     ++ [
65       cargo
66       versionCheckHook
67       writableTmpDirAsHomeHook
68     ]
69     ++ lib.optionals stdenv.hostPlatform.isDarwin [
70       darwin.ps
71     ];
73   versionCheckProgramArg = [ "--version" ];
75   pytestFlagsArray =
76     [
77       # AssertionError on the version metadata
78       # https://github.com/pypa/hatch/issues/1877
79       "--deselect=tests/backend/metadata/test_spec.py::TestCoreMetadataV21::test_all"
80       "--deselect=tests/backend/metadata/test_spec.py::TestCoreMetadataV21::test_license_expression"
81       "--deselect=tests/backend/metadata/test_spec.py::TestCoreMetadataV22::test_all"
82       "--deselect=tests/backend/metadata/test_spec.py::TestCoreMetadataV22::test_license_expression"
83       "--deselect=tests/backend/metadata/test_spec.py::TestCoreMetadataV23::test_all"
84       "--deselect=tests/backend/metadata/test_spec.py::TestCoreMetadataV23::test_license_expression"
85       "--deselect=tests/backend/metadata/test_spec.py::TestCoreMetadataV23::test_license_files"
86       "--deselect=tests/backend/metadata/test_spec.py::TestProjectMetadataFromCoreMetadata::test_license_files"
87     ]
88     ++ lib.optionals stdenv.hostPlatform.isDarwin [
89       # Dependency/versioning errors in the CLI tests, only seem to show up on Darwin
90       # https://github.com/pypa/hatch/issues/1893
91       "--deselect=tests/cli/env/test_create.py::test_sync_dependencies_pip"
92       "--deselect=tests/cli/env/test_create.py::test_sync_dependencies_uv"
93       "--deselect=tests/cli/project/test_metadata.py::TestBuildDependenciesMissing::test_no_compatibility_check_if_exists"
94       "--deselect=tests/cli/run/test_run.py::TestScriptRunner::test_dependencies"
95       "--deselect=tests/cli/run/test_run.py::TestScriptRunner::test_dependencies_from_tool_config"
96       "--deselect=tests/cli/run/test_run.py::test_dependency_hash_checking"
97       "--deselect=tests/cli/run/test_run.py::test_sync_dependencies"
98       "--deselect=tests/cli/run/test_run.py::test_sync_project_dependencies"
99       "--deselect=tests/cli/run/test_run.py::test_sync_project_features"
100       "--deselect=tests/cli/version/test_version.py::test_no_compatibility_check_if_exists"
101     ];
103   disabledTests =
104     [
105       # AssertionError: assert (1980, 1, 2, 0, 0, 0) == (2020, 2, 2, 0, 0, 0)
106       "test_default"
107       "test_editable_default"
108       "test_editable_default_extra_dependencies"
109       "test_editable_default_force_include"
110       "test_editable_default_force_include_option"
111       "test_editable_default_symlink"
112       "test_editable_exact"
113       "test_editable_exact_extra_dependencies"
114       "test_editable_exact_force_include"
115       "test_editable_exact_force_include_build_data_precedence"
116       "test_editable_exact_force_include_option"
117       "test_editable_pth"
118       "test_explicit_path"
120       # Loosen hatchling runtime version dependency
121       "test_core"
122       # New failing
123       "test_guess_variant"
124       "test_open"
125       "test_no_open"
126       "test_uv_env"
127       "test_pyenv"
128       "test_pypirc"
129       # Relies on FHS
130       # Could not read ELF interpreter from any of the following paths: /bin/sh, /usr/bin/env, /bin/dash, /bin/ls
131       "test_new_selected_python"
132     ]
133     ++ lib.optionals stdenv.hostPlatform.isDarwin [
134       # This test assumes it is running on macOS with a system shell on the PATH.
135       # It is not possible to run it in a nix build using a /nix/store shell.
136       # See https://github.com/pypa/hatch/pull/709 for the relevant code.
137       "test_populate_default_popen_kwargs_executable"
139       # Those tests fail because the final wheel is named '...2-macosx_11_0_arm64.whl' instead of
140       # '...2-macosx_14_0_arm64.whl'
141       "test_macos_archflags"
142       "test_macos_max_compat"
143     ]
144     ++ lib.optionals stdenv.hostPlatform.isAarch64 [ "test_resolve" ];
146   disabledTestPaths =
147     [
148       # ModuleNotFoundError: No module named 'hatchling.licenses.parse'
149       # https://github.com/pypa/hatch/issues/1850
150       "tests/backend/licenses/test_parse.py"
151       "tests/backend/licenses/test_supported.py"
152     ]
153     ++ lib.optionals stdenv.hostPlatform.isDarwin [
154       # AssertionError: assert [call('test h...2p32/bin/sh')] == [call('test h..., shell=True)]
155       # At index 0 diff:
156       #    call('test hatch-test.py3.10', shell=True, executable='/nix/store/b34ianga4diikh0kymkpqwmvba0mmzf7-bash-5.2p32/bin/sh')
157       # != call('test hatch-test.py3.10', shell=True)
158       "tests/cli/fmt/test_fmt.py"
159       "tests/cli/test/test_test.py"
160     ];
162   passthru = {
163     updateScript = nix-update-script {
164       extraArgs = [
165         "--version-regex"
166         "hatch-v([0-9.]+)"
167       ];
168     };
169   };
171   meta = {
172     description = "Modern, extensible Python project manager";
173     homepage = "https://hatch.pypa.io/latest/";
174     changelog = "https://github.com/pypa/hatch/blob/hatch-v${version}/docs/history/hatch.md";
175     license = lib.licenses.mit;
176     maintainers = with lib.maintainers; [ onny ];
177     mainProgram = "hatch";
178   };