1{ lib
2, buildPythonPackage
3, bootstrapped-pip
4, fetchFromGitHub
5, mock
6, scripttest
7, virtualenv
8, pretend
9, pytest
10
11# coupled downsteam dependencies
12, pip-tools
13}:
14
15buildPythonPackage rec {
16 pname = "pip";
17 version = "23.0.1";
18 format = "other";
19
20 src = fetchFromGitHub {
21 owner = "pypa";
22 repo = pname;
23 rev = "refs/tags/${version}";
24 hash = "sha256-BSonlwKmegrlrQTTIL0avPi61/TY2M0f7kOZpSzPRQk=";
25 name = "${pname}-${version}-source";
26 };
27
28 nativeBuildInputs = [ bootstrapped-pip ];
29
30 postPatch = ''
31 # Remove vendored Windows PE binaries
32 # Note: These are unused but make the package unreproducible.
33 find -type f -name '*.exe' -delete
34 '';
35
36 # pip detects that we already have bootstrapped_pip "installed", so we need
37 # to force it a little.
38 pipInstallFlags = [ "--ignore-installed" ];
39
40 nativeCheckInputs = [ mock scripttest virtualenv pretend pytest ];
41 # Pip wants pytest, but tests are not distributed
42 doCheck = false;
43
44 passthru.tests = { inherit pip-tools; };
45
46 meta = {
47 description = "The PyPA recommended tool for installing Python packages";
48 license = with lib.licenses; [ mit ];
49 homepage = "https://pip.pypa.io/";
50 changelog = "https://pip.pypa.io/en/stable/news/#v${lib.replaceStrings [ "." ] [ "-" ] version}";
51 priority = 10;
52 };
53}