1{ lib, buildPythonPackage, fetchFromGitHub, isPy27, pythonOlder, fetchpatch
2, cachecontrol
3, cachy
4, cleo
5, clikit
6, html5lib
7, httpretty
8, importlib-metadata
9, intreehooks
10, keyring
11, lockfile
12, pexpect
13, pkginfo
14, poetry-core
15, pytestCheckHook
16, pytest-cov
17, pytest-mock
18, requests
19, requests-toolbelt
20, shellingham
21, tomlkit
22, virtualenv
23}:
24
25buildPythonPackage rec {
26 pname = "poetry";
27 version = "1.1.11";
28 format = "pyproject";
29 disabled = isPy27;
30
31 src = fetchFromGitHub {
32 owner = "python-poetry";
33 repo = pname;
34 rev = version;
35 sha256 = "1f3y3gav2snvcf2h9mbkinvnlcyl9kndf6bh6j0vxkxzlmb4zilx";
36 };
37
38 postPatch = ''
39 substituteInPlace pyproject.toml \
40 --replace 'importlib-metadata = {version = "^1.6.0", python = "<3.8"}' \
41 'importlib-metadata = {version = ">=1.6", python = "<3.8"}' \
42 --replace 'version = "^21.2.0"' 'version = ">=21.2"'
43 '';
44
45 nativeBuildInputs = [ intreehooks ];
46
47 propagatedBuildInputs = [
48 cachecontrol
49 cachy
50 cleo
51 clikit
52 html5lib
53 keyring
54 lockfile
55 pexpect
56 pkginfo
57 poetry-core
58 requests
59 requests-toolbelt
60 shellingham
61 tomlkit
62 virtualenv
63 ] ++ lib.optionals (pythonOlder "3.8") [ importlib-metadata ];
64
65 postInstall = ''
66 mkdir -p "$out/share/bash-completion/completions"
67 "$out/bin/poetry" completions bash > "$out/share/bash-completion/completions/poetry"
68 mkdir -p "$out/share/zsh/vendor-completions"
69 "$out/bin/poetry" completions zsh > "$out/share/zsh/vendor-completions/_poetry"
70 mkdir -p "$out/share/fish/vendor_completions.d"
71 "$out/bin/poetry" completions fish > "$out/share/fish/vendor_completions.d/poetry.fish"
72 '';
73
74 checkInputs = [ pytestCheckHook httpretty pytest-mock pytest-cov ];
75 preCheck = "export HOME=$TMPDIR";
76 disabledTests = [
77 # touches network
78 "git"
79 "solver"
80 "load"
81 "vcs"
82 "prereleases_if_they_are_compatible"
83 "test_executor"
84 # requires git history to work correctly
85 "default_with_excluded_data"
86 # toml ordering has changed
87 "lock"
88 # fs permission errors
89 "test_builder_should_execute_build_scripts"
90 ];
91
92 patches = [
93 # The following patch addresses a minor incompatibility with
94 # pytest-mock. This is addressed upstream in
95 # https://github.com/python-poetry/poetry/pull/3457
96 (fetchpatch {
97 url = "https://github.com/python-poetry/poetry/commit/8ddceb7c52b3b1f35412479707fa790e5d60e691.diff";
98 sha256 = "yHjFb9xJBLFOqkOZaJolKviTdtST9PMFwH9n8ud2Y+U=";
99 })
100 ];
101
102 # allow for package to use pep420's native namespaces
103 pythonNamespaces = [ "poetry" ];
104
105 meta = with lib; {
106 homepage = "https://python-poetry.org/";
107 description = "Python dependency management and packaging made easy";
108 license = licenses.mit;
109 maintainers = with maintainers; [ jakewaksbaum ];
110 };
111}