gnu: r-opencyto: Update to 2.8.4.
[jackhill/guix/guix.git] / gnu / packages / python-build.scm
CommitLineData
13bb41f8 1;;; GNU Guix --- Functional package management for GNU
ed210c1b 2;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
13bb41f8
MC
3;;; Copyright © 2015, 2020 Efraim Flashner <efraim@flashner.co.il>
4;;; Copyright © 2016 Leo Famulari <leo@famulari.name>
5;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
6;;; Copyright © 2020 Tanguy Le Carrour <tanguy@bioneland.org>
987861f7 7;;; Copyright © 2018, 2021, 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
c0e60ccf 8;;; Copyright © 2021 Tobias Geerinckx-Rice <me@tobias.gr>
a1cb645d 9;;; Copyright © 2021, 2022 Ricardo Wurmus <rekado@elephly.net>
13c1ed6a 10;;; Copyright © 2022 Garek Dyszel <garekdyszel@disroot.org>
13bb41f8
MC
11;;;
12;;; This file is part of GNU Guix.
13;;;
14;;; GNU Guix is free software; you can redistribute it and/or modify it
15;;; under the terms of the GNU General Public License as published by
16;;; the Free Software Foundation; either version 3 of the License, or (at
17;;; your option) any later version.
18;;;
19;;; GNU Guix is distributed in the hope that it will be useful, but
20;;; WITHOUT ANY WARRANTY; without even the implied warranty of
21;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22;;; GNU General Public License for more details.
23;;;
24;;; You should have received a copy of the GNU General Public License
25;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
26
27(define-module (gnu packages python-build)
05e3638b 28 #:use-module (gnu packages)
13bb41f8
MC
29 #:use-module ((guix licenses) #:prefix license:)
30 #:use-module (guix build-system python)
84558f25 31 #:use-module (guix gexp)
13bb41f8 32 #:use-module (guix download)
95878336 33 #:use-module (guix git-download)
13bb41f8
MC
34 #:use-module (guix packages))
35
36;;; Commentary:
37;;;
38;;; Python packages to build... Python packages. Since they are bound to be
39;;; relied on by many, their dependencies should be kept minimal, and this
40;;; module should not depend on other modules containing Python packages.
41;;;
42;;; Code:
43
44(define-public python-wheel
45 (package
46 (name "python-wheel")
59d7550d 47 (version "0.37.0")
13bb41f8
MC
48 (source
49 (origin
50 (method url-fetch)
51 (uri (pypi-uri "wheel" version))
52 (sha256
53 (base32
59d7550d 54 "1bbga5i49rj1cwi4sjpkvfhl1f8vl9lfky2lblsy768nk4wp5vz2"))))
13bb41f8
MC
55 (build-system python-build-system)
56 (arguments
57 ;; FIXME: The test suite runs "python setup.py bdist_wheel", which in turn
58 ;; fails to find the newly-built bdist_wheel library, even though it is
59 ;; available on PYTHONPATH. What search path is consulted by setup.py?
60 '(#:tests? #f))
61 (home-page "https://bitbucket.org/pypa/wheel/")
62 (synopsis "Format for built Python packages")
63 (description
64 "A wheel is a ZIP-format archive with a specially formatted filename and
65the @code{.whl} extension. It is designed to contain all the files for a PEP
66376 compatible install in a way that is very close to the on-disk format. Many
67packages will be properly installed with only the @code{Unpack} step and the
68unpacked archive preserves enough information to @code{Spread} (copy data and
69scripts to their final locations) at any later time. Wheel files can be
70installed with a newer @code{pip} or with wheel's own command line utility.")
71 (license license:expat)))
72
13bb41f8
MC
73;;; XXX: Not really at home, but this seems the best place to prevent circular
74;;; module dependencies.
75(define-public python-toml
76 (package
77 (name "python-toml")
c0e60ccf 78 (version "0.10.2")
13bb41f8
MC
79 (source
80 (origin
81 (method url-fetch)
82 (uri (pypi-uri "toml" version))
83 (sha256
c0e60ccf 84 (base32 "13z6rff86bzdpl094x0vmfvls779931xj90dlbs9kpfm138s3gdk"))))
13bb41f8
MC
85 (build-system python-build-system)
86 (arguments
87 `(#:tests? #f)) ;no tests suite in release
88 (home-page "https://github.com/uiri/toml")
89 (synopsis "Library for TOML")
90 (description
91 "@code{toml} is a library for parsing and creating Tom's Obvious, Minimal
92Language (TOML) configuration files.")
93 (license license:expat)))
dbcd2050 94
84558f25
MC
95(define-public python-tomli-w
96 (package
97 (name "python-tomli-w")
98 (version "1.0.0")
99 (source
100 (origin
101 (method url-fetch)
102 (uri (pypi-uri "tomli_w" version))
103 (sha256
104 (base32 "1fg13bfq5qy1ym4x77815nhxh1xpfs0drhn9r9464cz00m1l6qzl"))))
105 (build-system python-build-system)
106 (arguments
107 (list
108 #:tests? #f ;to avoid extra dependencies
109 #:phases
110 #~(modify-phases %standard-phases
111 ;; XXX: PEP 517 manual build copied from python-isort.
112 (replace 'build
113 (lambda _
114 (invoke "python" "-m" "build" "--wheel" "--no-isolation" ".")))
115 (replace 'install
116 (lambda _
117 (let ((whl (car (find-files "dist" "\\.whl$"))))
118 (invoke "pip" "--no-cache-dir" "--no-input"
119 "install" "--no-deps" "--prefix" #$output whl)))))))
120 (native-inputs (list python-pypa-build python-flit-core))
121 (home-page "https://github.com/hukkin/tomli-w")
122 (synopsis "Minimal TOML writer")
123 (description "Tomli-W is a Python library for writing TOML. It is a
124write-only counterpart to Tomli, which is a read-only TOML parser.")
125 (license license:expat)))
126
3bd962bc
RW
127(define-public python-pytoml
128 (package
129 (name "python-pytoml")
130 (version "0.1.21")
131 (source
132 (origin
133 (method url-fetch)
134 (uri (pypi-uri "pytoml" version))
135 (sha256
136 (base32
137 "1rv1byiw82k7mj6aprcrqi2vdabs801y97xhfnrz7kxds34ggv4f"))))
138 (build-system python-build-system)
139 (home-page "https://github.com/avakar/pytoml")
140 (synopsis "Parser for TOML")
141 (description "This package provides a Python parser for TOML-0.4.0.")
142 (license license:expat)))
13bb41f8 143
05e3638b
MC
144(define-public python-six-bootstrap
145 (package
146 (name "python-six-bootstrap")
4a43e64b 147 (version "1.16.0")
05e3638b
MC
148 (source
149 (origin
150 (method url-fetch)
151 (uri (pypi-uri "six" version))
152 (sha256
153 (base32
4a43e64b 154 "09n9qih9rpj95q3r4a40li7hk6swma11syvgwdc68qm1fxsc6q8y"))))
05e3638b
MC
155 (build-system python-build-system)
156 (arguments `(#:tests? #f)) ;to avoid pytest dependency
157 (home-page "https://pypi.org/project/six/")
158 (synopsis "Python 2 and 3 compatibility utilities")
159 (description
160 "Six is a Python 2 and 3 compatibility library. It provides utility
161functions for smoothing over the differences between the Python versions with
162the goal of writing Python code that is compatible on both Python versions.
163Six supports every Python version since 2.5. It is contained in only one
164Python file, so it can be easily copied into your project.")
165 (license license:x11)))
166
a6d9dbb1
MC
167(define-public python-tomli
168 (package
169 (name "python-tomli")
d71de56b 170 (version "2.0.0")
a6d9dbb1
MC
171 (source
172 (origin
173 (method url-fetch)
174 (uri (pypi-uri "tomli" version))
175 (sha256
d71de56b 176 (base32 "1q8lrh9ypa6zpgbc5f7z23p7phzblp4vpxdrpfr1wajhb17w74n2"))))
a6d9dbb1
MC
177 (build-system python-build-system)
178 (arguments
179 `(#:tests? #f ;disabled to avoid extra dependencies
180 #:phases
181 (modify-phases %standard-phases
182 (replace 'build
183 (lambda _
184 (setenv "PYTHONPATH" (string-append (getcwd) ":"
185 (getenv "GUIX_PYTHONPATH")))
186 (invoke "python" "-m" "build" "--wheel" "--no-isolation"
187 "--skip-dependency-check")))
188 (replace 'install
189 (lambda* (#:key outputs #:allow-other-keys)
190 (let ((out (assoc-ref outputs "out"))
191 (whl (car (find-files "dist" "\\.whl$"))))
192 (invoke "pip" "--no-cache-dir" "--no-input"
193 "install" "--no-deps" "--prefix" out whl)))))))
194 (native-inputs
3b3fb280 195 `(("python-flit-core-bootstrap" ,python-flit-core-bootstrap)
a6d9dbb1
MC
196 ("python-pypa-build" ,python-pypa-build)
197 ("python-six", python-six-bootstrap)))
198 (home-page "https://github.com/hukkin/tomli")
199 (synopsis "Small and fast TOML parser")
200 (description "Tomli is a minimal TOML parser that is fully compatible with
201@url{https://toml.io/en/v1.0.0,TOML v1.0.0}. It is about 2.4 times as fast as
202@code{python-toml}.")
203 (license license:expat)))
204
13bb41f8
MC
205(define-public python-pep517-bootstrap
206 (hidden-package
207 (package
208 (name "python-pep517-bootstrap")
209 (version "0.9.1")
210 (source
211 (origin
212 (method url-fetch)
213 (uri (pypi-uri "pep517" version))
214 (sha256
215 (base32
216 "0zqidxah03qpnp6zkg3zd1kmd5f79hhdsfmlc0cldaniy80qddxf"))))
217 (build-system python-build-system)
218 (arguments
219 `(#:tests? #f)) ;to avoid circular dependencies
220 (propagated-inputs
8394619b 221 (list python-toml python-wheel))
13bb41f8
MC
222 (home-page "https://github.com/pypa/pep517")
223 (synopsis "Wrappers to build Python packages using PEP 517 hooks")
224 (description
225 "Wrappers to build Python packages using PEP 517 hooks.")
226 (license license:expat))))
227
05e3638b
MC
228(define-public python-pyparsing
229 (package
230 (name "python-pyparsing")
8c95987c 231 (version "3.0.6")
05e3638b
MC
232 (source
233 (origin
234 (method url-fetch)
235 (uri (pypi-uri "pyparsing" version))
236 (sha256
8c95987c 237 (base32 "109b9r802wb472hgmxclljprh5cid0w3p6mk9alba7pg2c0frgfr"))))
05e3638b
MC
238 (build-system python-build-system)
239 (outputs '("out" "doc"))
240 (arguments
241 `(#:tests? #f ;no test target
242 #:phases
243 (modify-phases %standard-phases
244 (add-after 'install 'install-doc
245 (lambda* (#:key outputs #:allow-other-keys)
246 (let* ((doc (string-append (assoc-ref outputs "doc")
247 "/share/doc/" ,name "-" ,version))
248 (html-doc (string-append doc "/html"))
249 (examples (string-append doc "/examples")))
250 (mkdir-p html-doc)
251 (mkdir-p examples)
252 (for-each
253 (lambda (dir tgt)
254 (map (lambda (file)
255 (install-file file tgt))
256 (find-files dir ".*")))
257 (list "docs" "htmldoc" "examples")
258 (list doc html-doc examples))))))))
259 (home-page "https://github.com/pyparsing/pyparsing")
260 (synopsis "Python parsing class library")
261 (description
262 "The pyparsing module is an alternative approach to creating and
263executing simple grammars, vs. the traditional lex/yacc approach, or the use
264of regular expressions. The pyparsing module provides a library of classes
265that client code uses to construct the grammar directly in Python code.")
28bddb7d 266 (license license:expat)))
05e3638b 267
8c95987c 268;;; This is the last release compatible with Python 2.
05e3638b
MC
269(define-public python-pyparsing-2.4.7
270 (package
271 (inherit python-pyparsing)
272 (version "2.4.7")
273 (source
274 (origin
275 (method url-fetch)
276 (uri (pypi-uri "pyparsing" version))
277 (sha256
278 (base32 "1hgc8qrbq1ymxbwfbjghv01fm3fbpjwpjwi0bcailxxzhf3yq0y2"))))))
279
05e3638b
MC
280(define-public python-packaging-bootstrap
281 (package
282 (name "python-packaging-bootstrap")
4b076fb9 283 (version "21.3")
05e3638b
MC
284 (source
285 (origin
286 (method url-fetch)
287 (uri (pypi-uri "packaging" version))
05e3638b
MC
288 (sha256
289 (base32
4b076fb9 290 "1sygirdrqgv4f1ckh9nhpcw1yfidrh3qjl86wq8vk6nq4wlw8iyx"))))
05e3638b
MC
291 (build-system python-build-system)
292 (arguments `(#:tests? #f)) ;disabled to avoid extra dependencies
293 (propagated-inputs
8394619b 294 (list python-pyparsing python-six-bootstrap))
05e3638b
MC
295 (home-page "https://github.com/pypa/packaging")
296 (synopsis "Core utilities for Python packages")
297 (description "Packaging is a Python module for dealing with Python packages.
298It offers an interface for working with package versions, names, and dependency
299information.")
300 ;; From 'LICENSE': This software is made available under the terms of
301 ;; *either* of the licenses found in LICENSE.APACHE or LICENSE.BSD.
302 ;; Contributions to this software is made under the terms of *both* these
303 ;; licenses.
987861f7 304 (license (list license:asl2.0 license:bsd-2))))
05e3638b 305
7bca6320
MC
306;;; The name 'python-pypa-build' is chosen rather than 'python-build' to avoid
307;;; a name clash with python-build from (guix build-system python).
308(define-public python-pypa-build
309 (package
310 (name "python-pypa-build")
b734ce06 311 (version "0.7.0")
7bca6320
MC
312 (source (origin
313 (method url-fetch)
314 (uri (pypi-uri "build" version))
315 (sha256
316 (base32
b734ce06 317 "17xqija27x4my1yrnk6q2vwln60r39g2dhby9zg2l99qjgbdrahs"))))
7bca6320
MC
318 (build-system python-build-system)
319 (arguments
4b47c608
MC
320 `(#:tests? #f ;to tests in the PyPI release
321 #:phases (modify-phases %standard-phases
b734ce06
MC
322 (add-after 'unpack 'use-toml-instead-of-tomli
323 ;; Using toml instead of tomli eases bootstrapping.
4b47c608
MC
324 (lambda _
325 (substitute* "setup.cfg"
b734ce06
MC
326 (("tomli>=.*")
327 "toml\n")))))))
7bca6320 328 (propagated-inputs
b734ce06
MC
329 `(("python-packaging" ,python-packaging-bootstrap)
330 ("python-pep517", python-pep517-bootstrap)
7bca6320
MC
331 ("python-toml" ,python-toml)))
332 (home-page "https://pypa-build.readthedocs.io/en/latest/")
333 (synopsis "Simple Python PEP 517 package builder")
334 (description "The @command{build} command invokes the PEP 517 hooks to
335build a distribution package. It is a simple build tool and does not perform
336any dependency management. It aims to keep dependencies to a minimum, in
337order to make bootstrapping easier.")
338 (license license:expat)))
339
13bb41f8
MC
340(define-public python-poetry-core
341 (package
342 (name "python-poetry-core")
ac2bd4a3 343 (version "1.0.7")
13bb41f8
MC
344 (source
345 (origin
346 (method url-fetch)
347 (uri (pypi-uri "poetry-core" version))
348 (sha256
ac2bd4a3 349 (base32 "01n2rbsvks7snrq3m1d08r3xz9q2715ajb62fdb6rvqnb9sirhcq"))))
13bb41f8
MC
350 (build-system python-build-system)
351 (home-page "https://github.com/python-poetry/poetry-core")
352 (synopsis "Poetry PEP 517 build back-end")
353 (description
354 "The @code{poetry-core} module provides a PEP 517 build back-end
355implementation developed for Poetry. This project is intended to be
356a light weight, fully compliant, self-contained package allowing PEP 517
357compatible build front-ends to build Poetry managed projects.")
358 (license license:expat)))
95878336 359
3b3fb280
MC
360;;; This package exists to bootstrap python-tomli.
361(define-public python-flit-core-bootstrap
95878336 362 (package
3b3fb280 363 (name "python-flit-core-bootstrap")
02639161 364 (version "3.5.1")
95878336
MC
365 (source
366 (origin
367 (method url-fetch)
368 (uri (pypi-uri "flit" version))
369 (sha256
02639161 370 (base32 "04152qj46sqbnlrj7ch9p7svjrrlpzbk0qr39g2yr0s4f5vp6frf"))))
95878336
MC
371 (build-system python-build-system)
372 (propagated-inputs
8394619b 373 (list python-toml))
95878336
MC
374 (arguments
375 ;; flit-core has a test suite, but it requires Pytest. Disable it so
376 ;; as to not pull pytest as an input.
377 `(#:tests? #f
378 #:phases
379 (modify-phases %standard-phases
380 (replace 'build
381 ;; flit-core requires itself to build. Luckily, a
382 ;; bootstrapping script exists, which does so using just
383 ;; the checkout sources and Python.
384 (lambda _
385 (invoke "python" "flit_core/build_dists.py")))
386 (replace 'install
387 (lambda* (#:key inputs outputs #:allow-other-keys)
388 (let ((out (assoc-ref outputs "out"))
389 (whl (car (find-files "." "\\.whl$"))))
390 (invoke "pip" "--no-cache-dir" "--no-input"
391 "install" "--no-deps" "--prefix" out whl))))
392 ;; The sanity-check phase fails because flit depends on tomli at
393 ;; run-time, but this core variant avoids it to avoid a cycle.
394 (delete 'sanity-check))))
395 (home-page "https://github.com/takluyver/flit")
396 (synopsis "Core package of the Flit Python build system")
397 (description "This package provides @code{flit-core}, a PEP 517 build
398backend for packages using Flit. The only public interface is the API
399specified by PEP 517, @code{flit_core.buildapi}.")
400 (license license:bsd-3)))
3b3fb280
MC
401
402(define-public python-flit-core
403 (package/inherit python-flit-core-bootstrap
404 (name "python-flit-core")
405 (propagated-inputs
406 (modify-inputs (package-propagated-inputs python-flit-core-bootstrap)
407 (replace "python-toml" python-tomli)))))
ed210c1b 408
6cd01963
MC
409(define-public python-flit-scm
410 (package
411 (name "python-flit-scm")
412 (version "1.6.2")
413 (source (origin
414 (method url-fetch)
415 (uri (pypi-uri "flit_scm" version))
416 (sha256
417 (base32
418 "0p3lj2g1643m2dm14kihvfb6gn6jviglhm3dzdpn2c8zpqs17svg"))))
419 (build-system python-build-system)
420 (arguments
421 (list
422 #:tests? #f ;no test suite
423 #:phases
424 #~(modify-phases %standard-phases
425 (add-after 'unpack 'relax-setuptools-scm-version
426 (lambda _
427 (substitute* "pyproject.toml"
428 (("setuptools_scm~=6.4")
429 "setuptools_scm>=6.3"))))
430 ;; XXX: PEP 517 manual build/install procedures copied from
431 ;; python-isort.
432 (replace 'build
433 (lambda _
434 ;; ZIP does not support timestamps before 1980.
435 (setenv "SOURCE_DATE_EPOCH" "315532800")
436 (invoke "python" "-m" "build" "--wheel" "--no-isolation" ".")))
437 (replace 'install
438 (lambda* (#:key outputs #:allow-other-keys)
439 (let ((whl (car (find-files "dist" "\\.whl$"))))
440 (invoke "pip" "--no-cache-dir" "--no-input"
441 "install" "--no-deps" "--prefix" #$output whl)))))))
442 (native-inputs
443 (list python-pypa-build
444 python-flit-core
445 python-setuptools-scm
446 python-tomli))
447 (propagated-inputs
448 (list python-flit-core
449 python-setuptools-scm
450 python-tomli))
451 (home-page "https://gitlab.com/WillDaSilva/flit_scm")
452 (synopsis "PEP 518 build backend combining flit_core and setuptools_scm")
453 (description "This package provides a PEP 518 build backend that uses
454@code{setuptools_scm} to generate a version file from your version control
455system, then @code{flit_core} to build the package.")
456 (license license:expat)))
457
ed210c1b
MC
458(define-public python-setuptools-scm
459 (package
460 (name "python-setuptools-scm")
461 (version "6.3.2")
462 (source (origin
463 (method url-fetch)
464 (uri (pypi-uri "setuptools_scm" version))
465 (sha256
466 (base32 "1wm0i27siyy1yqr9rv7lqvb65agay9051yi8jzmi8dgb3q4ai6m4"))))
467 (build-system python-build-system)
468 (propagated-inputs
469 `(("python-packaging",python-packaging-bootstrap)
470 ("python-tomli" ,python-tomli)))
471 (home-page "https://github.com/pypa/setuptools_scm/")
472 (synopsis "Manage Python package versions in SCM metadata")
473 (description
474 "Setuptools_scm handles managing your Python package versions in
475@dfn{software configuration management} (SCM) metadata instead of declaring
476them as the version argument or in a SCM managed file.")
477 (license license:expat)))
13c1ed6a
GD
478
479(define-public python-editables
480 (package
481 (name "python-editables")
482 (version "0.3")
483 (source (origin
484 (method git-fetch)
485 (uri (git-reference
486 (url "https://github.com/pfmoore/editables")
487 (commit version)))
488 (file-name (git-file-name name version))
489 (sha256
490 (base32
491 "1gbfkgzmrmbd4ycshm09fr2wd4f1n9gq7s567jgkavhfkn7s2pn1"))))
492 (build-system python-build-system)
493 (home-page "https://github.com/pfmoore/editables")
494 (synopsis "Editable installations")
495 (description "This library supports the building of wheels which, when
496installed, will expose packages in a local directory on @code{sys.path} in
497``editable mode''. In other words, changes to the package source will be
498reflected in the package visible to Python, without needing a reinstall.")
499 (license license:expat)))