1{
2 lib,
3 argcomplete,
4 buildPythonPackage,
5 fetchFromGitHub,
6 hatchling,
7 hatch-vcs,
8 installShellFiles,
9 packaging,
10 platformdirs,
11 pytestCheckHook,
12 pythonOlder,
13 tomli,
14 userpath,
15 git,
16}:
17
18buildPythonPackage rec {
19 pname = "pipx";
20 version = "1.8.0";
21 pyproject = true;
22
23 disabled = pythonOlder "3.8";
24
25 src = fetchFromGitHub {
26 owner = "pypa";
27 repo = "pipx";
28 tag = version;
29 hash = "sha256-TEF5zBAB0tvfY0dsZOnu2r9P+pheMr/OOI6CCY8PItg=";
30 };
31
32 build-system = [
33 hatchling
34 hatch-vcs
35 ];
36
37 dependencies = [
38 argcomplete
39 packaging
40 platformdirs
41 userpath
42 ]
43 ++ lib.optionals (pythonOlder "3.11") [ tomli ];
44
45 nativeBuildInputs = [
46 installShellFiles
47 argcomplete
48 ];
49
50 nativeCheckInputs = [
51 pytestCheckHook
52 git
53 ];
54
55 preCheck = ''
56 export HOME=$(mktemp -d)
57 '';
58
59 pytestFlags = [
60 # start local pypi server and use in tests
61 "--net-pypiserver"
62 ];
63
64 disabledTestPaths = [
65 "tests/test_install_all_packages.py"
66 ];
67
68 disabledTests = [
69 # disable tests which are difficult to emulate due to shell manipulations
70 "path_warning"
71 "script_from_internet"
72 "ensure_null_pythonpath"
73 # disable tests, which require internet connection
74 "install"
75 "inject"
76 "ensure_null_pythonpath"
77 "missing_interpreter"
78 "cache"
79 "internet"
80 "run"
81 "runpip"
82 "upgrade"
83 "suffix"
84 "legacy_venv"
85 "determination"
86 "json"
87 "test_auto_update_shared_libs"
88 "test_cli"
89 "test_cli_global"
90 "test_fetch_missing_python"
91 "test_list_does_not_trigger_maintenance"
92 "test_list_pinned_packages"
93 "test_list_short"
94 "test_list_standalone_interpreter"
95 "test_list_unused_standalone_interpreters"
96 "test_list_used_standalone_interpreters"
97 "test_pin"
98 "test_skip_maintenance"
99 "test_unpin"
100 "test_unpin_warning"
101 ];
102
103 postInstall = ''
104 installShellCompletion --cmd pipx \
105 --bash <(register-python-argcomplete pipx --shell bash) \
106 --zsh <(register-python-argcomplete pipx --shell zsh) \
107 --fish <(register-python-argcomplete pipx --shell fish)
108 '';
109
110 meta = with lib; {
111 description = "Install and run Python applications in isolated environments";
112 mainProgram = "pipx";
113 homepage = "https://github.com/pypa/pipx";
114 changelog = "https://github.com/pypa/pipx/blob/${version}/CHANGELOG.md";
115 license = licenses.mit;
116 maintainers = with maintainers; [ yshym ];
117 };
118}