diff mbox series

[bug#55390] gnu: Add python-preshed

Message ID 8735h3gee4.fsf@gmail.com
State Accepted
Headers show
Series [bug#55390] gnu: Add python-preshed | expand

Checks

Context Check Description
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue

Commit Message

Artyom V. Poptsov May 21, 2022, 2:16 p.m. UTC
Hello,

this patch adds preshed[1] under the name 'python-preshed'.

The package depends on:
- 'python-murmurhash' (this package was recently merged to Guix.)
- 'python-cymem' (this package is awaiting the merge.)

'python-preshed' is the one of the dependencies of spaCy -- an NLP
library for Python.[2]

- Artyom

References:
1. "Cython hash tables that assume keys are pre-hashed"
   https://github.com/explosion/preshed
2. https://spacy.io/
diff mbox series

Patch

From af05b2f142efce971baa7d2843d96f493273967b Mon Sep 17 00:00:00 2001
From: "Artyom V. Poptsov" <poptsov.artyom@gmail.com>
Date: Sat, 21 May 2022 11:37:47 +0300
Subject: [PATCH] gnu: Add python-preshed

* gnu/packages/python-xyz.scm (python-preshed): New variable.
---
 gnu/packages/python-xyz.scm | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 832d5bd578..2eb876ed69 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -31492,3 +31492,35 @@  easy to tie memory to a Python object's life-cycle, so that the memory is freed
 when the object is garbage collected.")
   (license license:expat)))
 
+(define-public python-preshed
+  (package
+    (name "python-preshed")
+    (version "3.0.6")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri "preshed" version))
+              (sha256
+               (base32
+                "0akpydd23xqxx9d04drsnw9140rb3cv07r1zpzqz5wm0lf47afzv"))))
+    (build-system python-build-system)
+    (native-inputs (list python-cython python-cymem python-pytest))
+    (inputs (list python python-cymem python-murmurhash))
+    (arguments
+     (list #:modules
+           '((ice-9 ftw) (ice-9 match)
+             (guix build utils)
+             (guix build python-build-system))
+           #:phases
+           #~(modify-phases %standard-phases
+               (add-after 'unpack 'set-source-file-times-to-1980
+                 (lambda _
+                   (let ((circa-1980 (* 10 366 24 60 60)))
+                     (ftw "."
+                          (lambda (file stat flag)
+                            (utime file circa-1980 circa-1980) #t))))))))
+    (home-page "https://github.com/explosion/preshed")
+    (synopsis "Cython hash tables that assume keys are pre-hashed")
+    (description
+     "Simple but high performance Cython hash table mapping pre-randomized keys
+to void* values.")
+    (license license:expat)))
-- 
2.25.1