[PATCH 0/5] Add some Python build-related packages.

  • Open
  • quality assurance status badge
Details
3 participants
  • Vinicius Monego
  • obonnefon
  • Simon Tournier
Owner
unassigned
Submitted by
Vinicius Monego
Severity
normal
V
V
Vinicius Monego wrote on 5 Dec 2023 16:18
(address . guix-patches@gnu.org)(name . Vinicius Monego)(address . monego@posteo.net)
cover.1701788624.git.monego@posteo.net
This patchset adds Hatch, scikit-build-core and spin.

Hatch is a project manager, commonly found as a dependency in other packages.

scikit-build-core is a rewrite of scikit-build. It bridges Python with CMake-built libraries.

spin is a CLI tool mainly used to compile projects that use meson-python.

Vinicius Monego (5):
gnu: Add python-userpath.
gnu: Add hatch.
gnu: Add python-pytest-subprocess.
gnu: Add python-scikit-build-core.
gnu: Add python-spin.

gnu/packages/python-check.scm | 29 ++++++
gnu/packages/python-science.scm | 26 ++++++
gnu/packages/python-xyz.scm | 157 ++++++++++++++++++++++++++++++++
3 files changed, 212 insertions(+)


base-commit: c15a1cd88f80a90437f4b0159f22dfc84b9e6851
--
2.39.2
V
V
Vinicius Monego wrote on 5 Dec 2023 16:21
[PATCH 1/5] gnu: Add python-userpath.
(address . 67642@debbugs.gnu.org)(name . Vinicius Monego)(address . monego@posteo.net)
0a91ba04f027579cc6c50b555cb1da7feab879cd.1701788624.git.monego@posteo.net
* gnu/packages/python-xyz.scm (python-userpath): New variable.

Change-Id: Ic263ee8e1208273b225aa7e2c14dd85f085254e7
---
gnu/packages/python-xyz.scm | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)

Toggle diff (36 lines)
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index f54a9b0f88..c233479e0c 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -30005,6 +30005,29 @@ (define-public python-inform
cleanly print different types of messages.")
(license license:gpl3+)))
+(define-public python-userpath
+ (package
+ (name "python-userpath")
+ (version "1.9.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (pypi-uri "userpath" version))
+ (sha256
+ (base32 "15i7w1sh60f7i23rqls72s6rdkgw4cxvz08p82v19jcqimr7d0ff"))))
+ (build-system pyproject-build-system)
+ (arguments
+ ;; See https://github.com/ofek/userpath/issues/43.
+ ;; In Guix, tests try to find the temporary build directory in PATH, but
+ ;; only the store output is present.
+ (list #:tests? #f))
+ (native-inputs (list python-hatchling python-pytest))
+ (propagated-inputs (list python-click))
+ (home-page "https://github.com/ofek/userpath")
+ (synopsis "Add locations to the user's PATH")
+ (description "This package provides a tool for modifying a user's PATH.")
+ (license license:expat)))
+
(define-public python-nestedtext
(package
(name "python-nestedtext")
--
2.39.2
V
V
Vinicius Monego wrote on 5 Dec 2023 16:21
[PATCH 2/5] gnu: Add hatch.
(address . 67642@debbugs.gnu.org)(name . Vinicius Monego)(address . monego@posteo.net)
524bfa0f56c3f6c46a81e2957adc109baf12b410.1701788624.git.monego@posteo.net
* gnu/packages/python-xyz.scm (hatch): New variable.

Change-Id: Iff0f0e8e8451277e468b7c3054540eca8d25e321
---
gnu/packages/python-xyz.scm | 77 +++++++++++++++++++++++++++++++++++++
1 file changed, 77 insertions(+)

Toggle diff (90 lines)
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index c233479e0c..28dbea691f 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -30028,6 +30028,83 @@ (define-public python-userpath
(description "This package provides a tool for modifying a user's PATH.")
(license license:expat)))
+(define-public hatch
+ (package
+ (name "hatch")
+ (version "1.7.0")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (pypi-uri "hatch" version))
+ (sha256
+ (base32 "0ipvj1pxdb6wb1sblh22h9gnh6byjnwcl7hfcnk88dmkslgp1z3s"))
+ (modules '((guix build utils)))
+ (snippet '(substitute* "pyproject.toml"
+ ;; We have virtualenv 20.3.1.
+ (("virtualenv>=20.16.2")
+ "virtualenv>=20.3.1")))))
+ (build-system pyproject-build-system)
+ (arguments
+ (list
+ #:test-flags
+ ;; XXX: tests below fail due to zipfile reporting incorrect zip dates.
+ #~(list "-k"
+ (string-append
+ "not "
+ (string-join
+ (list "test_default"
+ "test_explicit_path"
+ "test_editable_default"
+ "test_editable_default_dependencies"
+ "test_editable_default_force_include"
+ "test_editable_default_force_include_option"
+ "test_editable_exact"
+ "test_editable_exact_extra_dependencies"
+ "test_editable_exact_force_include"
+ "test_editable_exact_force_include_option"
+ "test_editable_exact_force_include_build_data_precedence"
+ "test_editable_pth")
+ " and not ")))
+ #:phases #~(modify-phases %standard-phases
+ (add-before 'check 'pre-check
+ (lambda _
+ (setenv "HOME" "/tmp"))))))
+ (native-inputs (list git-minimal
+ python-pytest
+ python-pytest-mock
+ python-pytest-xdist))
+ (propagated-inputs (list python-click
+ python-hatchling
+ python-httpx
+ python-hyperlink
+ python-keyring
+ python-packaging
+ python-pexpect
+ python-platformdirs
+ python-pyperclip
+ python-rich
+ python-shellingham
+ python-tomli-w
+ python-tomlkit
+ python-userpath
+ python-virtualenv))
+ (home-page "https://hatch.pypa.io/latest/")
+ (synopsis "Python project management")
+ (description "Hatch is a modern, extensible Python project manager.
+
+Features
+
+@itemize
+@item Standardized build system with reproducible builds by default
+@item Robust environment management with support for custom scripts
+@item Configurable Python distribution management
+@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-nestedtext
(package
(name "python-nestedtext")
--
2.39.2
V
V
Vinicius Monego wrote on 5 Dec 2023 16:21
[PATCH 3/5] gnu: Add python-pytest-subprocess.
(address . 67642@debbugs.gnu.org)(name . Vinicius Monego)(address . monego@posteo.net)
b8183426fb32041ab83d16ac50c0a7f794961ac3.1701788624.git.monego@posteo.net
* gnu/packages/python-check.scm (python-pytest-subprocess): New variable.

Change-Id: Id651d945836879e71eb30f51bc392f3027bcad6e
---
gnu/packages/python-check.scm | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)

Toggle diff (42 lines)
diff --git a/gnu/packages/python-check.scm b/gnu/packages/python-check.scm
index ea74472270..9befa4610a 100644
--- a/gnu/packages/python-check.scm
+++ b/gnu/packages/python-check.scm
@@ -2099,6 +2099,35 @@ (define-public python-stestr
help in debugging failures and optimizing the scheduler to improve speed.")
(license license:asl2.0)))
+(define-public python-pytest-subprocess
+ (package
+ (name "python-pytest-subprocess")
+ (version "1.5.0")
+ (source
+ (origin
+ (method git-fetch) ;no tests in PyPI archive
+ (uri (git-reference
+ (url "https://github.com/aklajnert/pytest-subprocess")
+ (commit version)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "103nxv37sjvxlwmw87hxsrphkxkryv4dgb65kjjfr4722r37vmxv"))))
+ (build-system pyproject-build-system)
+ (native-inputs (list python-anyio
+ python-coverage
+ python-docutils
+ python-nox
+ python-pygments
+ python-pytest
+ python-pytest-asyncio
+ python-pytest-rerunfailures))
+ (home-page "https://github.com/aklajnert/pytest-subprocess")
+ (synopsis "Fake subprocess for Pytest")
+ (description
+ "This package provides a plugin to fake subprocess for Pytest.")
+ (license license:expat)))
+
;; This is only used by python-sanic
(define-public python-pytest-sanic
(package
--
2.39.2
V
V
Vinicius Monego wrote on 5 Dec 2023 16:21
[PATCH 4/5] gnu: Add python-scikit-build-core.
(address . 67642@debbugs.gnu.org)(name . Vinicius Monego)(address . monego@posteo.net)
194362f7114b4070dc1c6ff53276c998828d81d6.1701788624.git.monego@posteo.net
* gnu/packages/python-xyz.scm (python-scikit-build-core): New variable.

Change-Id: I6dac2c5062d51eaa15cff67cd94a938014229182
---
gnu/packages/python-xyz.scm | 57 +++++++++++++++++++++++++++++++++++++
1 file changed, 57 insertions(+)

Toggle diff (70 lines)
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 28dbea691f..36bd4c04be 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -30855,6 +30855,63 @@ (define-public python-sane
;; Yet another variant of the X/MIT license.
"https://github.com/python-pillow/Sane/blob/master/COPYING"))))
+(define-public python-scikit-build-core
+ (package
+ (name "python-scikit-build-core")
+ (version "0.7.0")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (pypi-uri "scikit_build_core" version))
+ (sha256
+ (base32 "1lvzcmsq6wmv396a5lq7wl6lx8165pz55ymjbbinr32nki3g5xw5"))))
+ (build-system pyproject-build-system)
+ ;; Skip network tests.
+ (arguments
+ (list #:test-flags #~(list "-m" "not network"
+ ;; TODO: figure out why these tests fail.
+ ;; (they also need write permission)
+ "-k" (string-append
+ "not "
+ (string-join
+ (list "test_pep517_wheel"
+ "test_abi3_wheel"
+ "test_navigate_editable_pkg"
+ "test_pep517_mixed_wheel")
+ " and not ")))))
+ (propagated-inputs (list cmake
+ python-exceptiongroup
+ python-importlib-metadata
+ python-importlib-resources
+ python-packaging
+ python-pathspec
+ python-pyproject-metadata
+ python-tomli
+ python-typing-extensions))
+ (native-inputs (list pybind11
+ python-cattrs
+ python-fastjsonschema
+ python-hatch-fancy-pypi-readme
+ python-hatch-vcs
+ python-hatchling
+ python-numpy
+ python-pytest
+ python-pytest-subprocess
+ ;; Latest setuptools fails with "setup.py install is
+ ;; deprecated. Use build and pip or other standards-
+ ;; based tools".
+ python-setuptools-57
+ python-setuptools-scm
+ python-virtualenv
+ python-wheel))
+ (home-page "https://scikit-build-core.readthedocs.io/en/latest/")
+ (synopsis "Build backend for CMake based projects")
+ (description
+ "Scikit-build-core is a complete ground-up rewrite of scikit-build on top
+of modern packaging APIs. It provides a bridge between CMake and the Python
+build system, allowing you to make Python modules with CMake.")
+ (license license:asl2.0)))
+
(define-public python-scikit-build
(package
(name "python-scikit-build")
--
2.39.2
V
V
Vinicius Monego wrote on 5 Dec 2023 16:21
[PATCH 5/5] gnu: Add python-spin.
(address . 67642@debbugs.gnu.org)(name . Vinicius Monego)(address . monego@posteo.net)
37bad6d18c8d47e126f50b382dfb9b682329e018.1701788624.git.monego@posteo.net
* gnu/packages/python-science.scm (python-spin): New variable.

Change-Id: I794845d559f3f4f3ab9cf98b0e4a4321b470f7f8
---
gnu/packages/python-science.scm | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)

Toggle diff (39 lines)
diff --git a/gnu/packages/python-science.scm b/gnu/packages/python-science.scm
index 1b7ae663eb..d48eebb4a9 100644
--- a/gnu/packages/python-science.scm
+++ b/gnu/packages/python-science.scm
@@ -713,6 +713,32 @@ (define-public python-numpoly
(supported-systems '("x86_64-linux" "aarch64-linux" "powerpc64le-linux"))
(license license:bsd-2)))
+(define-public python-spin
+ (package
+ (name "python-spin")
+ (version "0.8")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (pypi-uri "spin" version))
+ (sha256
+ (base32 "0ff48nagfaai3j26g1db4zq2bwdv6kj5l7xhcs2l9kzg7qzrmhr7"))))
+ (build-system pyproject-build-system)
+ (propagated-inputs (list python-click python-colorama python-tomli))
+ (native-inputs (list python-pytest))
+ (home-page "https://github.com/scientific-python/spin")
+ (synopsis "Developer tool for scientific Python libraries")
+ (description "@code{spin} is a simple interface for common development
+tasks. It comes with a few common build commands out the box, but can
+easily be customized per project.
+
+The impetus behind developing the tool was the mass migration of scientific
+Python libraries (SciPy, scikit-image, and NumPy, etc.) to Meson, after
+distutils was deprecated. When many of the build and installation commands
+changed, it made sense to abstract away the nuisance of having to re-learn
+them.")
+ (license license:bsd-3)))
+
(define-public python-baycomp
(package
(name "python-baycomp")
--
2.39.2
O
O
obonnefon wrote on 8 Feb 08:35 +0100
[PATCH 0/5] Add some Python build-related packages.
(address . 67642@debbugs.gnu.org)
ab52db14-3971-44e8-a6ea-8164a368fd86@inrae.fr
I have tested this cook to build dolfinx v07 cook. It works. Thanks
O
S
S
Simon Tournier wrote on 27 Feb 14:14 +0100
Re: [bug#67642] [PATCH 2/5] gnu: Add hatch.
(name . Vinicius Monego)(address . monego@posteo.net)
87jzmqm4lt.fsf@gmail.com
Hi,

On mar., 05 déc. 2023 at 15:21, Vinicius Monego <monego@posteo.net> wrote:

Toggle quote (5 lines)
> +(define-public hatch
> + (package
> + (name "hatch")
> + (version "1.7.0")

Following a question in Café Guix, I am giving a look at this. And I
see that bug#58310 [1] has:

+ (name "python-hatch")
+ (version "1.10.0")

It leads to two questions:

1. Why the just name “hatch” and not “python-hatch”?

2. Why 1.7.0 and not 1.10.0 or higher?


1: [bug#58310] [PATCH 05/14] gnu: Add python-hatch.
Garek Dyszel via Guix-patches via <guix-patches@gnu.org>
Wed, 05 Oct 2022 13:46:04 -0400
id:878rluqi3n.fsf@disroot.org


Cheers,
simon
V
V
Vinicius Monego wrote on 12 Mar 22:15 +0100
02d29258-b178-4022-93c2-90673d714592@posteo.net
Hi Simon,

Em 27/02/2024 10:14, Simon Tournier escreveu:
Toggle quote (18 lines)
> Hi,
>
> On mar., 05 déc. 2023 at 15:21, Vinicius Monego <monego@posteo.net> wrote:
>
>> +(define-public hatch
>> + (package
>> + (name "hatch")
>> + (version "1.7.0")
> Following a question in Café Guix, I am giving a look at this. And I
> see that bug#58310 [1] has:
>
> + (name "python-hatch")
> + (version "1.10.0")
>
> It leads to two questions:
>
> 1. Why the just name “hatch” and not “python-hatch”?

I remember a convention to name applications without the python- prefix,
it was only used for libraries. See the pre-commit, gunicorn, hypercorn
packages for instance.

Toggle quote (16 lines)
>
> 2. Why 1.7.0 and not 1.10.0 or higher?
>
>
> 1: [bug#58310] [PATCH 05/14] gnu: Add python-hatch.
> Garek Dyszel via Guix-patches via <guix-patches@gnu.org>
> Wed, 05 Oct 2022 13:46:04 -0400
> id:878rluqi3n.fsf@disroot.org
> https://issues.guix.gnu.org/58310
> https://issues.guix.gnu.org/msgid/878rluqi3n.fsf@disroot.org
> https://yhetil.org/guix/878rluqi3n.fsf@disroot.org
>
>
> Cheers,
> simon

Looking at the date (2022-10-05), that patch seems to introduce
python-hatchling and not python-hatch. Hatchling 1.10.0 was released on
2022-09-19. The latest version of Hatch is 1.9.4, which was released 17
hours ago. Both packages are tagged in the same repository [1], but are
distinct packages. Hatchling is the build backend while hatch is a
Python project management tool.

Vinicius

?