1{ lib
2, backports-cached-property
3, buildPythonPackage
4, cachecontrol
5, cachy
6, cleo
7, crashtest
8, dataclasses
9, deepdiff
10, dulwich
11, fetchFromGitHub
12, flatdict
13, html5lib
14, httpretty
15, importlib-metadata
16, installShellFiles
17, intreehooks
18, jsonschema
19, keyring
20, lockfile
21, packaging
22, pexpect
23, pkginfo
24, platformdirs
25, poetry-core
26, poetry-plugin-export
27, pytest-mock
28, pytest-xdist
29, pytestCheckHook
30, pythonAtLeast
31, pythonOlder
32, requests
33, requests-toolbelt
34, shellingham
35, stdenv
36, tomlkit
37, urllib3
38, virtualenv
39, xattr
40}:
41
42buildPythonPackage rec {
43 pname = "poetry";
44 version = "1.2.2";
45 format = "pyproject";
46
47 disabled = pythonOlder "3.7";
48
49 src = fetchFromGitHub {
50 owner = "python-poetry";
51 repo = pname;
52 rev = "refs/tags/${version}";
53 hash = "sha256-huIjLv1T42HEmePCQNJpKnNxJKdyD9MlEtc2WRPOjRE=";
54 };
55
56 postPatch = ''
57 substituteInPlace pyproject.toml \
58 --replace 'crashtest = "^0.3.0"' 'crashtest = "*"' \
59 --replace 'xattr = { version = "^0.9.7"' 'xattr = { version = "^0.10.0"'
60 '';
61
62 nativeBuildInputs = [
63 installShellFiles
64 ];
65
66 propagatedBuildInputs = [
67 cachecontrol
68 cachy
69 cleo
70 crashtest
71 dulwich
72 html5lib
73 jsonschema
74 keyring
75 packaging
76 pexpect
77 pkginfo
78 platformdirs
79 poetry-core
80 poetry-plugin-export
81 requests
82 requests-toolbelt
83 shellingham
84 tomlkit
85 virtualenv
86 ] ++ lib.optionals (stdenv.isDarwin) [
87 xattr
88 ] ++ lib.optionals (pythonOlder "3.10") [
89 importlib-metadata
90 ] ++ lib.optionals (pythonOlder "3.8") [
91 backports-cached-property
92 ] ++ cachecontrol.optional-dependencies.filecache;
93
94 postInstall = ''
95 installShellCompletion --cmd poetry \
96 --bash <($out/bin/poetry completions bash) \
97 --fish <($out/bin/poetry completions fish) \
98 --zsh <($out/bin/poetry completions zsh) \
99 '';
100
101 checkInputs = [
102 deepdiff
103 flatdict
104 pytestCheckHook
105 httpretty
106 pytest-mock
107 pytest-xdist
108 ];
109
110 preCheck = (''
111 export HOME=$TMPDIR
112 '' + lib.optionalString (stdenv.isDarwin && stdenv.isAarch64) ''
113 # https://github.com/python/cpython/issues/74570#issuecomment-1093748531
114 export no_proxy='*';
115 '');
116
117 postCheck = lib.optionalString (stdenv.isDarwin && stdenv.isAarch64) ''
118 unset no_proxy
119 '';
120
121 disabledTests = [
122 # touches network
123 "git"
124 "solver"
125 "load"
126 "vcs"
127 "prereleases_if_they_are_compatible"
128 "test_executor"
129 # requires git history to work correctly
130 "default_with_excluded_data"
131 # toml ordering has changed
132 "lock"
133 # fs permission errors
134 "test_builder_should_execute_build_scripts"
135 ] ++ lib.optionals (pythonAtLeast "3.10") [
136 # RuntimeError: 'auto_spec' might be a typo; use unsafe=True if this is intended
137 "test_info_setup_complex_pep517_error"
138 ];
139
140 # Allow for package to use pep420's native namespaces
141 pythonNamespaces = [
142 "poetry"
143 ];
144
145 meta = with lib; {
146 homepage = "https://python-poetry.org/";
147 description = "Python dependency management and packaging made easy";
148 license = licenses.mit;
149 maintainers = with maintainers; [ jakewaksbaum ];
150 };
151}