projects/guix·blob version-1.4.0 · refs

559 lines · 21.7 KiB

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