File tree Expand file tree Collapse file tree 2 files changed +30
-21
lines changed
development/python-modules/uv Expand file tree Collapse file tree 2 files changed +30
-21
lines changed Original file line number Diff line number Diff line change 11{
22 buildPythonPackage ,
3- installShellFiles ,
4- rustPlatform ,
5- pkgs ,
6- versionCheckHook ,
3+ hatchling ,
4+ lib ,
5+ uv ,
76} :
87
98buildPythonPackage {
10- inherit ( pkgs . uv )
9+ inherit ( uv )
1110 pname
1211 version
1312 src
14- cargoDeps
1513 meta
16- cargoBuildFlags
17- postInstall
18- versionCheckProgramArg
1914 ;
15+ pyproject = true ;
2016
21- postPatch = ''
22- substituteInPlace python/uv/_find_uv.py \
23- --replace-fail '"""Return the uv binary path."""' "return '$out/bin/uv'"
24- '' ;
17+ build-system = [ hatchling ] ;
2518
26- nativeBuildInputs = [
27- installShellFiles
28- rustPlatform . cargoSetupHook
29- rustPlatform . maturinBuildHook
30- ] ;
19+ postPatch =
20+ # Do not rely on path lookup at runtime to find the uv binary.
21+ # Use the propagated binary instead.
22+ ''
23+ substituteInPlace python/uv/_find_uv.py \
24+ --replace-fail '"""Return the uv binary path."""' "return '${ lib . getExe uv } '"
25+ ''
26+ # Sidestep the maturin build system in favour of reusing the binary already built by nixpkgs,
27+ # to avoid rebuilding the uv binary for every active python package set.
28+ + ''
29+ substituteInPlace pyproject.toml \
30+ --replace-fail 'requires = ["maturin>=1.0,<2.0"]' 'requires = ["hatchling"]' \
31+ --replace-fail 'build-backend = "maturin"' 'build-backend = "hatchling.build"'
3132
32- nativeCheckInputs = [ versionCheckHook ] ;
33+ cat >> pyproject.toml <<EOF
34+ [tool.hatch.build]
35+ packages = ['python/uv']
36+
37+ EOF
38+ '' ;
39+
40+ postInstall = ''
41+ mkdir -p $out/bin && ln -s ${ lib . getExe uv } $out/bin/uv
42+ '' ;
3343
34- pyproject = true ;
3544 pythonImportsCheck = [ "uv" ] ;
3645}
Original file line number Diff line number Diff line change @@ -18674,7 +18674,7 @@ self: super: with self; {
1867418674
1867518675 uuid6 = callPackage ../development/python-modules/uuid6 { };
1867618676
18677- uv = callPackage ../development/python-modules/uv { };
18677+ uv = callPackage ../development/python-modules/uv { inherit (pkgs) uv; };
1867818678
1867918679 uv-build = callPackage ../development/python-modules/uv-build { };
1868018680
You can’t perform that action at this time.
0 commit comments