diff mbox series

[bug#57540,RFC,v2,10/19] gnu: Add python-hatchling.* gnu/packages/python-xyz.scm (python-hatchling): New variable.

Message ID 87fsh3vxt2.fsf@disroot.org
State Accepted
Headers show
Series [bug#57540] Add ocaml-elpi (a dependency of coq-mathcomp-analysis) | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git-branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue
cbaines/comparison success View comparision
cbaines/git-branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

Garek Dyszel Sept. 7, 2022, 6:34 p.m. UTC
* gnu/packages/python-xyz.scm (python-hatchling): New variable.
---
 gnu/packages/python-xyz.scm | 64 +++++++++++++++++++++++++++++++++++++
 1 file changed, 64 insertions(+)
diff mbox series

Patch

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index cc5b85c3a1..8dd8d902a5 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -30771,3 +30771,67 @@  (define-public python-version
        "This package provides a simple utility for checking the python version.")
       ;; MIT License
       (license license:expat))))
+
+(define-public python-hatchling
+  (package
+    (name "python-hatchling")
+    (version "1.8.1")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/pypa/hatch")
+                    (commit (string-append "hatchling-v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1q25kqw71g8mjwfjz9ph0iigdqa26zzxgmqm0v0bp0z1j8rcl237"))))
+    ;; python-pypa-build needed for bootstrapping.
+    ;; Otherwise we get a circular reference:
+    ;; python-hatchling trying to build itself, without
+    ;; first having hatchling installed.
+    (inputs (list python
+                  python-pypa-build
+                  python-editables
+                  python-importlib-metadata
+                  python-version
+                  python-packaging-next
+                  python-pathspec
+                  python-pluggy-1.0 ; TODO: Not detected by pytest?
+                  python-tomli
+                  python-platformdirs))
+    (build-system python-build-system)
+    (arguments
+     `(#:phases (modify-phases %standard-phases
+                  ;; Copied directly from the build process for
+                  ;; python-jsonschema-next.
+                  (replace 'build
+                    (lambda _
+                      (chdir "backend")
+                      ;; 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"
+                                (assoc-ref %outputs "out")
+                                whl))))
+                  (replace 'check
+                    (lambda* (#:key tests? #:allow-other-keys)
+                      (when tests?
+                        (invoke "pytest" "-vv")))))))
+    (home-page "https://ofek.dev/projects/hatch/")
+    (synopsis "Modern, extensible Python project management")
+    (description "Modern, extensible Python project management")
+    ;; MIT License
+    (license license:expat)))