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