1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, pythonOlder
5, hatchling
6, userpath
7, argcomplete
8, packaging
9, importlib-metadata
10, pip
11, pytestCheckHook
12}:
13
14buildPythonPackage rec {
15 pname = "pipx";
16 version = "1.1.0";
17 format = "pyproject";
18
19 disabled = pythonOlder "3.6";
20
21 # no tests in the pypi tarball, so we directly fetch from github
22 src = fetchFromGitHub {
23 owner = "pipxproject";
24 repo = pname;
25 rev = "refs/tags/${version}";
26 sha256 = "sha256-6cKKVOgHIoKNfGqvDWK5cwBGBDkgfyRuBRDV6fruBoA=";
27 };
28
29 nativeBuildInputs = [
30 hatchling
31 ];
32
33 propagatedBuildInputs = [
34 userpath
35 argcomplete
36 packaging
37 ] ++ lib.optionals (pythonOlder "3.8") [
38 importlib-metadata
39 ];
40
41 checkInputs = [
42 pytestCheckHook
43 ];
44
45 preCheck = ''
46 export HOME=$(mktemp -d)
47 '';
48
49 pytestFlagsArray = [
50 "--ignore=tests/test_install_all_packages.py"
51 # start local pypi server and use in tests
52 "--net-pypiserver"
53 ];
54 disabledTests = [
55 # disable tests which are difficult to emulate due to shell manipulations
56 "path_warning"
57 "script_from_internet"
58 "ensure_null_pythonpath"
59 # disable tests, which require internet connection
60 "install"
61 "inject"
62 "ensure_null_pythonpath"
63 "missing_interpreter"
64 "cache"
65 "internet"
66 "run"
67 "runpip"
68 "upgrade"
69 "suffix"
70 "legacy_venv"
71 "determination"
72 "json"
73 "test_list_short"
74 ];
75
76 meta = with lib; {
77 description =
78 "Install and Run Python Applications in Isolated Environments";
79 homepage = "https://github.com/pipxproject/pipx";
80 license = licenses.mit;
81 maintainers = with maintainers; [ yshym ];
82 };
83}