diff options
Diffstat (limited to 'gnu/packages/python-build.scm')
-rw-r--r-- | gnu/packages/python-build.scm | 492 |
1 files changed, 319 insertions, 173 deletions
diff --git a/gnu/packages/python-build.scm b/gnu/packages/python-build.scm index 17f8892c05..70719c44d4 100644 --- a/gnu/packages/python-build.scm +++ b/gnu/packages/python-build.scm @@ -4,10 +4,13 @@ ;;; Copyright © 2016 Leo Famulari <leo@famulari.name> ;;; Copyright © 2020, 2023 Marius Bakke <marius@gnu.org> ;;; Copyright © 2020 Tanguy Le Carrour <tanguy@bioneland.org> -;;; Copyright © 2018, 2021, 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com> +;;; Copyright © 2018, 2021, 2022, 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com> +;;; Copyright © 2019 Vagrant Cascadian <vagrant@debian.org> ;;; Copyright © 2021 Tobias Geerinckx-Rice <me@tobias.gr> -;;; Copyright © 2021, 2022 Ricardo Wurmus <rekado@elephly.net> +;;; Copyright © 2020, 2021, 2022, 2023 Ricardo Wurmus <rekado@elephly.net> ;;; Copyright © 2022 Garek Dyszel <garekdyszel@disroot.org> +;;; Copyright © 2022 Greg Hogan <code@greghogan.com> + ;;; ;;; This file is part of GNU Guix. ;;; @@ -28,6 +31,7 @@ #:use-module (gnu packages) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix build-system python) + #:use-module (guix build-system pyproject) #:use-module (guix gexp) #:use-module (guix download) #:use-module (guix git-download) @@ -41,109 +45,48 @@ ;;; ;;; Code: -(define-public python-pip + +;;; These are dependencies used by the build systems contained herein; they +;;; feel a bit out of place but are kept here to prevent circular module +;;; dependencies. +(define-public python-pathspec (package - (name "python-pip") - (version "22.2.2") + (name "python-pathspec") + (version "0.11.1") (source (origin (method url-fetch) - (uri (pypi-uri "pip" version)) + (uri (pypi-uri "pathspec" version)) (sha256 (base32 - "0jwac0bhfp48w4fqibf1ysrs2grksdv92hwqm7bmdw2jn2fr5l9z")))) + "11qnlcanr1mqcpqpq1hmnwrs26csbsa2bafc7biq09x91y0dx617")))) (build-system python-build-system) - (arguments - '(#:tests? #f)) ; there are no tests in the pypi archive. - (home-page "https://pip.pypa.io/") - (synopsis "Package manager for Python software") + (home-page "https://github.com/cpburnz/python-pathspec") + (synopsis "Utility library for gitignore style pattern matching of file paths") (description - "Pip is a package manager for Python software, that finds packages on the -Python Package Index (PyPI).") - (license license:expat))) + "This package provides a utility library for gitignore style pattern +matching of file paths.") + (license license:mpl2.0))) -(define-public python-setuptools +(define-public python-pluggy (package - (name "python-setuptools") - (version "64.0.3") - (source - (origin - (method url-fetch) - (uri (pypi-uri "setuptools" version)) - (sha256 - (base32 - "1sllqf0bhsl2yilf1w0xnlz0r4yaksmwaj0ap91zdc6kgbigdjiv")) - (modules '((guix build utils))) - (snippet - ;; TODO: setuptools now bundles the following libraries: - ;; packaging, pyparsing, six and appdirs. How to unbundle? - ;; Remove included binaries which are used to build self-extracting - ;; installers for Windows. - '(for-each delete-file (find-files "setuptools" - "^(cli|gui).*\\.exe$"))))) - (build-system python-build-system) - ;; FIXME: Tests require pytest, which itself relies on setuptools. - ;; One could bootstrap with an internal untested setuptools. - (arguments (list #:tests? #f)) - (home-page "https://pypi.org/project/setuptools/") - (synopsis "Library designed to facilitate packaging Python projects") - (description "Setuptools is a fully-featured, stable library designed to -facilitate packaging Python projects, where packaging includes: -@itemize -@item Python package and module definitions -@item distribution package metadata -@item test hooks -@item project installation -@item platform-specific details. -@end itemize") - (license (list license:psfl ;setuptools itself - license:expat ;six, appdirs, pyparsing - license:asl2.0 ;packaging is dual ASL2/BSD-2 - license:bsd-2)))) + (name "python-pluggy") + (version "1.0.0") + (source + (origin + (method url-fetch) + (uri (pypi-uri "pluggy" version)) + (sha256 + (base32 + "0n8iadlas2z1b4h0fc73b043c7iwfvx9rgvqm1azjmffmhxkf922")))) + (build-system python-build-system) + (native-inputs (list python-setuptools-scm)) + (synopsis "Plugin and hook calling mechanism for Python") + (description "Pluggy is an extraction of the plugin manager as used by +Pytest but stripped of Pytest specific details.") + (home-page "https://pypi.org/project/pluggy/") + (license license:expat))) -;; This is the last version with use_2to3 support. -(define-public python-setuptools-57 - (package - (inherit python-setuptools) - (version "57.5.0") - (source (origin - (inherit (package-source python-setuptools)) - (uri (pypi-uri "setuptools" version)) - (sha256 - (base32 - "091sp8lrin7qllrhhx7y0iiv5gdb1d3l8a1ip5knk77ma1njdlyr")))))) - -(define-public python-wheel - (package - (name "python-wheel") - (version "0.37.0") - (source - (origin - (method url-fetch) - (uri (pypi-uri "wheel" version)) - (sha256 - (base32 - "1bbga5i49rj1cwi4sjpkvfhl1f8vl9lfky2lblsy768nk4wp5vz2")))) - (build-system python-build-system) - (arguments - ;; FIXME: The test suite runs "python setup.py bdist_wheel", which in turn - ;; fails to find the newly-built bdist_wheel library, even though it is - ;; available on PYTHONPATH. What search path is consulted by setup.py? - '(#:tests? #f)) - (home-page "https://bitbucket.org/pypa/wheel/") - (synopsis "Format for built Python packages") - (description - "A wheel is a ZIP-format archive with a specially formatted filename and -the @code{.whl} extension. It is designed to contain all the files for a PEP -376 compatible install in a way that is very close to the on-disk format. Many -packages will be properly installed with only the @code{Unpack} step and the -unpacked archive preserves enough information to @code{Spread} (copy data and -scripts to their final locations) at any later time. Wheel files can be -installed with a newer @code{pip} or with wheel's own command line utility.") - (license license:expat))) - -;;; XXX: Not really at home, but this seems the best place to prevent circular -;;; module dependencies. (define-public python-toml (package (name "python-toml") @@ -174,21 +117,8 @@ Language (TOML) configuration files.") (uri (pypi-uri "tomli_w" version)) (sha256 (base32 "1fg13bfq5qy1ym4x77815nhxh1xpfs0drhn9r9464cz00m1l6qzl")))) - (build-system python-build-system) - (arguments - (list - #:tests? #f ;to avoid extra dependencies - #:phases - #~(modify-phases %standard-phases - ;; XXX: PEP 517 manual build copied from python-isort. - (replace 'build - (lambda _ - (invoke "python" "-m" "build" "--wheel" "--no-isolation" "."))) - (replace 'install - (lambda _ - (let ((whl (car (find-files "dist" "\\.whl$")))) - (invoke "pip" "--no-cache-dir" "--no-input" - "install" "--no-deps" "--prefix" #$output whl))))))) + (build-system pyproject-build-system) + (arguments (list #:tests? #f)) ;to avoid extra dependencies (native-inputs (list python-pypa-build python-flit-core)) (home-page "https://github.com/hukkin/tomli-w") (synopsis "Minimal TOML writer") @@ -239,34 +169,23 @@ Python file, so it can be easily copied into your project.") (define-public python-tomli (package (name "python-tomli") - (version "2.0.0") + (version "2.0.1") (source (origin (method url-fetch) (uri (pypi-uri "tomli" version)) (sha256 - (base32 "1q8lrh9ypa6zpgbc5f7z23p7phzblp4vpxdrpfr1wajhb17w74n2")))) - (build-system python-build-system) + (base32 "0kwazq3i18rphcr8gak4fgzdcj5w5bbn4k4j2l6ma32gj496qlny")))) + (build-system pyproject-build-system) (arguments `(#:tests? #f ;disabled to avoid extra dependencies #:phases (modify-phases %standard-phases - (replace 'build + (add-before 'build 'add-self-to-path (lambda _ - (setenv "PYTHONPATH" (string-append (getcwd) ":" - (getenv "GUIX_PYTHONPATH"))) - (invoke "python" "-m" "build" "--wheel" "--no-isolation" - "--skip-dependency-check"))) - (replace 'install - (lambda* (#:key outputs #:allow-other-keys) - (let ((out (assoc-ref outputs "out")) - (whl (car (find-files "dist" "\\.whl$")))) - (invoke "pip" "--no-cache-dir" "--no-input" - "install" "--no-deps" "--prefix" out whl))))))) - (native-inputs - `(("python-flit-core-bootstrap" ,python-flit-core-bootstrap) - ("python-pypa-build" ,python-pypa-build) - ("python-six", python-six-bootstrap))) + ;; The build system of tomli requires... tomli. + (setenv "PYTHONPATH" "src")))))) + (native-inputs (list python-flit-core-bootstrap python-six-bootstrap)) (home-page "https://github.com/hukkin/tomli") (synopsis "Small and fast TOML parser") (description "Tomli is a minimal TOML parser that is fully compatible with @@ -274,6 +193,171 @@ Python file, so it can be easily copied into your project.") @code{python-toml}.") (license license:expat))) +(define-public python-trove-classifiers + (package + (name "python-trove-classifiers") + (version "2023.3.9") + (source (origin + (method url-fetch) + (uri (pypi-uri "trove-classifiers" version)) + (sha256 + (base32 + "00xvldq94dy0zxz40idbbx40smrkfvq75r26ywszxg6lq7wg4hpf")))) + (build-system pyproject-build-system) + (arguments (list #:build-backend "setuptools.build_meta" + #:tests? #f)) ;keep dependencies to a minimum + (native-inputs (list python-wheel)) + (home-page "https://github.com/pypa/trove-classifiers") + (synopsis "Canonical source for classifiers on PyPI") + (description "This package is the canonical source for classifiers use on +PyPI (pypi.org).") + (license license:asl2.0))) + +(define-public python-typing-extensions + (package + (name "python-typing-extensions") + (version "4.5.0") + (source (origin + (method url-fetch) + (uri (pypi-uri "typing_extensions" version)) + (sha256 + (base32 + "1jx7ki3sji60v7h2805b2phq9ynsvshj5xiygdh9kmirj6kz9daw")))) + (build-system pyproject-build-system) + ;; Disable the test suite to keep the dependencies to a minimum. Also, + ;; the test suite requires Python's test module, not available in Guix. + (arguments (list #:tests? #f)) + (native-inputs (list python-flit-core)) + (home-page "https://github.com/python/typing_extensions") + (synopsis "Experimental type hints for Python") + (description + "The typing_extensions module contains additional @code{typing} hints not +yet present in the of the @code{typing} standard library. +Included are implementations of: +@enumerate +@item ClassVar +@item ContextManager +@item Counter +@item DefaultDict +@item Deque +@item NewType +@item NoReturn +@item overload +@item Protocol +@item runtime +@item Text +@item Type +@item TYPE_CHECKING +@item AsyncGenerator +@end enumerate\n") + (license license:psfl))) + + +;;; +;;; Python builder packages. +;;; +(define-public python-pip + (package + (name "python-pip") + (version "23.1") + (source + (origin + (method url-fetch) + (uri (pypi-uri "pip" version)) + (sha256 + (base32 + "0jnk639v9h7ghslm4jnlic6rj3v29nygflx1hgxxndg5gs4kk1a0")))) + (build-system python-build-system) + (arguments + '(#:tests? #f)) ; there are no tests in the pypi archive. + (home-page "https://pip.pypa.io/") + (synopsis "Package manager for Python software") + (description + "Pip is a package manager for Python software, that finds packages on the +Python Package Index (PyPI).") + (license license:expat))) + +(define-public python-setuptools + (package + (name "python-setuptools") + (version "67.6.1") + (source + (origin + (method url-fetch) + (uri (pypi-uri "setuptools" version)) + (sha256 + (base32 + "16myxkpa89r045il88zcygdy1zbi2mvvpz5b4a70p9jhklmfjz95")) + (modules '((guix build utils))) + (snippet + ;; TODO: setuptools now bundles the following libraries: + ;; packaging, pyparsing, six and appdirs. How to unbundle? + ;; Remove included binaries which are used to build self-extracting + ;; installers for Windows. + '(for-each delete-file (find-files "setuptools" + "^(cli|gui).*\\.exe$"))))) + (build-system python-build-system) + ;; FIXME: Tests require pytest, which itself relies on setuptools. + ;; One could bootstrap with an internal untested setuptools. + (arguments (list #:tests? #f)) + (home-page "https://pypi.org/project/setuptools/") + (synopsis "Library designed to facilitate packaging Python projects") + (description "Setuptools is a fully-featured, stable library designed to +facilitate packaging Python projects, where packaging includes: +@itemize +@item Python package and module definitions +@item distribution package metadata +@item test hooks +@item project installation +@item platform-specific details. +@end itemize") + (license (list license:psfl ;setuptools itself + license:expat ;six, appdirs, pyparsing + license:asl2.0 ;packaging is dual ASL2/BSD-2 + license:bsd-2)))) + +;; This is the last version with use_2to3 support. +(define-public python-setuptools-57 + (package + (inherit python-setuptools) + (version "57.5.0") + (source (origin + (inherit (package-source python-setuptools)) + (uri (pypi-uri "setuptools" version)) + (sha256 + (base32 + "091sp8lrin7qllrhhx7y0iiv5gdb1d3l8a1ip5knk77ma1njdlyr")))))) + +(define-public python-wheel + (package + (name "python-wheel") + (version "0.40.0") + (source + (origin + (method url-fetch) + (uri (pypi-uri "wheel" version)) + (sha256 + (base32 + "0ww8fgkvwv35ypj4cnngczdwp6agr4qifvk2inb32azfzbrrc4fd")))) + (build-system python-build-system) + (arguments + ;; FIXME: The test suite runs "python setup.py bdist_wheel", which in turn + ;; fails to find the newly-built bdist_wheel library, even though it is + ;; available on PYTHONPATH. What search path is consulted by setup.py? + '(#:tests? #f)) + (home-page "https://github.com/pypa/wheel") + (synopsis "Format for built Python packages") + (description + "A wheel is a ZIP-format archive with a specially formatted filename and +the @code{.whl} extension. It is designed to contain all the files for a PEP +376 compatible install in a way that is very close to the on-disk format. Many +packages will be properly installed with only the @code{Unpack} step and the +unpacked archive preserves enough information to @code{Spread} (copy data and +scripts to their final locations) at any later time. Wheel files can be +installed with a newer @code{pip} or with wheel's own command line utility.") + (license license:expat))) + +;;; TODO: Deprecate with https://github.com/pypa/pyproject-hooks. (define-public python-pep517-bootstrap (hidden-package (package @@ -412,14 +496,22 @@ order to make bootstrapping easier.") (define-public python-poetry-core (package (name "python-poetry-core") - (version "1.0.7") + (version "1.5.2") (source (origin (method url-fetch) - (uri (pypi-uri "poetry-core" version)) + (uri (pypi-uri "poetry_core" version)) (sha256 - (base32 "01n2rbsvks7snrq3m1d08r3xz9q2715ajb62fdb6rvqnb9sirhcq")))) - (build-system python-build-system) + (base32 "053c8dw632p7jkhjb51k0wcx6hdw4r3lk97mds76df653qxnqmf6")))) + (build-system pyproject-build-system) + (arguments + `(#:tests? #f ;disabled to avoid extra dependencies + #:phases + (modify-phases %standard-phases + (add-before 'build 'add-self-to-path + (lambda _ + ;; The build system requires itself. + (setenv "PYTHONPATH" "src")))))) (home-page "https://github.com/python-poetry/poetry-core") (synopsis "Poetry PEP 517 build back-end") (description @@ -433,13 +525,13 @@ compatible build front-ends to build Poetry managed projects.") (define-public python-flit-core-bootstrap (package (name "python-flit-core-bootstrap") - (version "3.5.1") + (version "3.8.0") (source (origin (method url-fetch) (uri (pypi-uri "flit" version)) (sha256 - (base32 "04152qj46sqbnlrj7ch9p7svjrrlpzbk0qr39g2yr0s4f5vp6frf")))) + (base32 "0dz9sp2zlhkmk6sm5gapbbb30f7xq3n3jn5zxx5pkp25ppsaiwnh")))) (build-system python-build-system) (propagated-inputs (list python-toml)) @@ -464,7 +556,7 @@ compatible build front-ends to build Poetry managed projects.") ;; The sanity-check phase fails because flit depends on tomli at ;; run-time, but this core variant avoids it to avoid a cycle. (delete 'sanity-check)))) - (home-page "https://github.com/takluyver/flit") + (home-page "https://github.com/pypa/flit") (synopsis "Core package of the Flit Python build system") (description "This package provides @code{flit-core}, a PEP 517 build backend for packages using Flit. The only public interface is the API @@ -481,45 +573,21 @@ specified by PEP 517, @code{flit_core.buildapi}.") (define-public python-flit-scm (package (name "python-flit-scm") - (version "1.6.2") + (version "1.7.0") (source (origin (method url-fetch) (uri (pypi-uri "flit_scm" version)) (sha256 (base32 - "0p3lj2g1643m2dm14kihvfb6gn6jviglhm3dzdpn2c8zpqs17svg")))) - (build-system python-build-system) - (arguments - (list - #:tests? #f ;no test suite - #:phases - #~(modify-phases %standard-phases - (add-after 'unpack 'relax-setuptools-scm-version - (lambda _ - (substitute* "pyproject.toml" - (("setuptools_scm~=6.4") - "setuptools_scm>=6.3")))) - ;; XXX: PEP 517 manual build/install procedures copied from - ;; python-isort. - (replace 'build - (lambda _ - ;; ZIP does not support timestamps before 1980. - (setenv "SOURCE_DATE_EPOCH" "315532800") - (invoke "python" "-m" "build" "--wheel" "--no-isolation" "."))) - (replace 'install - (lambda* (#:key outputs #:allow-other-keys) - (let ((whl (car (find-files "dist" "\\.whl$")))) - (invoke "pip" "--no-cache-dir" "--no-input" - "install" "--no-deps" "--prefix" #$output whl))))))) - (native-inputs - (list python-pypa-build - python-flit-core - python-setuptools-scm - python-tomli)) - (propagated-inputs - (list python-flit-core - python-setuptools-scm - python-tomli)) + "1ckbkykfr7f7wzjzgh0gm7h6v3pqzx2l28rw6dsvl6zk4kxxc6wn")))) + (build-system pyproject-build-system) + (arguments (list #:tests? #f ;to avoid extra dependencies + ;; flit-scm wants to use flit-core, which it renames to + ;; 'buildapi', but that isn't found even when adding the + ;; current directory to PYTHONPATH. Use setuptools' + ;; builder instead. + #:build-backend "setuptools.build_meta")) + (propagated-inputs (list python-flit-core python-setuptools-scm python-tomli)) (home-page "https://gitlab.com/WillDaSilva/flit_scm") (synopsis "PEP 518 build backend combining flit_core and setuptools_scm") (description "This package provides a PEP 518 build backend that uses @@ -530,16 +598,16 @@ system, then @code{flit_core} to build the package.") (define-public python-setuptools-scm (package (name "python-setuptools-scm") - (version "6.3.2") + (version "7.1.0") (source (origin (method url-fetch) (uri (pypi-uri "setuptools_scm" version)) (sha256 - (base32 "1wm0i27siyy1yqr9rv7lqvb65agay9051yi8jzmi8dgb3q4ai6m4")))) + (base32 "09wg4zg30ir1c2cvwqipaz3hwaxz503fgw5zdvaxgakilx2q6l3c")))) (build-system python-build-system) - (propagated-inputs - `(("python-packaging",python-packaging-bootstrap) - ("python-tomli" ,python-tomli))) + (arguments (list #:tests? #f)) ;avoid extra dependencies such as pytest + (propagated-inputs (list python-packaging-bootstrap python-tomli + python-typing-extensions)) (home-page "https://github.com/pypa/setuptools_scm/") (synopsis "Manage Python package versions in SCM metadata") (description @@ -569,3 +637,81 @@ installed, will expose packages in a local directory on @code{sys.path} in ``editable mode''. In other words, changes to the package source will be reflected in the package visible to Python, without needing a reinstall.") (license license:expat))) + +(define-public python-hatchling + (package + (name "python-hatchling") + (version "1.14.0") + (source (origin + (method url-fetch) + (uri (pypi-uri "hatchling" version)) + (sha256 + (base32 + "1nn5cyc9fgrbawz38drfkl2s588k2gn3yqdm2cldbx9zy0fsjbj6")))) + (build-system pyproject-build-system) + (arguments + (list #:tests? #f ;to keep dependencies to a minimum + #:phases #~(modify-phases %standard-phases + (add-before 'build 'add-src-to-path + ;; Hatchling uses itself to build itself. + (lambda _ + (setenv "PYTHONPATH" "src")))))) + (propagated-inputs (list python-editables + python-packaging-bootstrap + python-pathspec + python-pluggy + python-tomli + python-trove-classifiers)) + (home-page "https://hatch.pypa.io/latest/") + (synopsis "Modern, extensible Python build backend") + (description "Hatch is a modern, extensible Python project manager. It +has features such as: +@itemize +@item Standardized build system with reproducible builds by default +@item Robust environment management with support for custom scripts +@item Easy publishing to PyPI or other indexes +@item Version management +@item Configurable project generation with sane defaults +@item Responsive CLI, ~2-3x faster than equivalent tools. +@end itemize") + (license license:expat))) + +(define-public python-hatch-fancy-pypi-readme + (package + (name "python-hatch-fancy-pypi-readme") + (version "22.8.0") + (source (origin + (method url-fetch) + (uri (pypi-uri "hatch_fancy_pypi_readme" version)) + (sha256 + (base32 + "0sn2wsfbpsbf2mqhjvw62h1cfy5mz3d7iqyqvs5c20cnl0n2i4fs")))) + (build-system pyproject-build-system) + (arguments (list #:tests? #f)) ;avoid extra test dependencies + (propagated-inputs (list python-hatchling python-tomli + python-typing-extensions)) + (home-page "https://github.com/hynek/hatch-fancy-pypi-readme") + (synopsis "Fancy PyPI READMEs with Hatch") + (description "This hatch plugin allows defining a project description in +terms of concatenated fragments that are based on static strings, files and +parts of files defined using cut-off points or regular expressions.") + (license license:expat))) + +(define-public python-hatch-vcs + (package + (name "python-hatch-vcs") + (version "0.3.0") + (source (origin + (method url-fetch) + (uri (pypi-uri "hatch_vcs" version)) + (sha256 + (base32 + "1viz2mdfxfqpsd5f30410q6smj90qfxihvy9idzwd0p4ziy11iff")))) + (arguments (list #:tests? #f)) ;avoid extra test dependencies + (build-system pyproject-build-system) + (propagated-inputs (list python-hatchling python-setuptools-scm)) + (home-page "https://github.com/ofek/hatch-vcs") + (synopsis "Hatch plugin for versioning with your preferred VCS") + (description "This package is a plugin for Hatch that uses your preferred +version control system (like Git) to determine project versions.") + (license license:expat))) |