[PATCH] gnu: Add python-cymem

  • Done
  • quality assurance status badge
Details
2 participants
  • Ludovic Courtès
  • Artyom V. Poptsov
Owner
unassigned
Submitted by
Artyom V. Poptsov
Severity
normal
A
A
Artyom V. Poptsov wrote on 12 May 2022 21:47
(address . guix-patches@gnu.org)
87fsle7cui.fsf@gmail.com
Hello,

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

- Artyom

From 4acef69146d41714e9912fb1576f6f64b267eaa2 Mon Sep 17 00:00:00 2001
From: "Artyom V. Poptsov" <poptsov.artyom@gmail.com>
Date: Thu, 12 May 2022 22:43:29 +0300
Subject: [PATCH] gnu: Add python-cymem

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

Toggle diff (61 lines)
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index fdfdd3fef3..421a298ccd 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -121,6 +121,7 @@
;;; Copyright © 2022 Peter Polidoro <peter@polidoro.io>
;;; Copyright © 2022 Wamm K. D. <jaft.r@outlook.com>
;;; Copyright © 2022 Jai Vetrivelan <jaivetrivelan@gmail.com>
+;;; Copyright © 2022 Artyom V. Poptsov <poptsov.artyom@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -31150,3 +31151,46 @@ object, which can be useful if you want to force your objects into a table.")
"The @code{deep-merge} Python library provides a toolset to deeply merge
nested data structures in Python like lists and dictionaries.")
(license license:expat)))
+
+(define-public python-cymem
+ (package
+ (name "python-cymem")
+ (version "2.0.6")
+ (source (origin
+ (method url-fetch)
+ (uri (pypi-uri "cymem" version))
+ (sha256
+ (base32
+ "0pkyy60zk9654sj991w111p1l0m8wvz36nslw96x6nb9h6sjb5qn"))))
+ (build-system python-build-system)
+ (native-inputs
+ (list python-cython
+ python-pytest))
+ (inputs
+ (list python))
+ (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
+ ;; XXX One of the tests uses a ZIP library to pack up some of the
+ ;; source tree, and fails with "ZIP does not support timestamps
+ ;; before 1980". Work around this by setting the file times in the
+ ;; source tree to sometime in early 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/cymem")
+ (synopsis "Cython memory pool for RAII-style memory management")
+ (description
+ "Cymem provides two small memory-management helpers for Cython. They make it
+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)))
+
--
2.25.1
--
Artyom "avp" Poptsov <poptsov.artyom@gmail.com>
CADR Hackerspace co-founder: https://cadrspace.ru/
GPG: D0C2 EAC1 3310 822D 98DE B57C E9C5 A2D9 0898 A02F
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEE0MLqwTMQgi2Y3rV86cWi2QiYoC8FAmJ9ZDUACgkQ6cWi2QiY
oC+YPwf/TUfqfOeqxb+2RNeniqglnpkkqdq7Rg68R3mkPtw5qdqgz/Zt4LDrOmbI
ofNCeEPmW3T7hAFwtvEnM93TYF1xs6zPDuF4fIJpg8X+IMVfEZWWFSR6ufeGCnft
k8RtGUoPkLyjAdXcuAjvLBhEPj9Y0EfTPozmSzRZwPrLr2yXF92cjQoM69GWxP7g
gsXHqFWH3vEbJro8qZ6folLL+Z4KUrtNh5RI01exj2Cm+R6IJUzjfjl6pO+bDTm/
CCFhey7zYmbywl54Y9qgBbwwYQbVPC8sW2JwMU2fMfoQeJJoW6PYELRUQTG85sfc
b/LqGBaeN55eHNmKbo0ok5wKJyatPQ==
=xPWm
-----END PGP SIGNATURE-----

A
A
Artyom V. Poptsov wrote on 21 May 2022 16:16
Re: [PATCH] gnu: Add python-preshed
(address . guix-patches@gnu.org)
8735h3gee4.fsf@gmail.com
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"
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(+)

Toggle diff (42 lines)
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
--
Artyom "avp" Poptsov <poptsov.artyom@gmail.com>
CADR Hackerspace co-founder: https://cadrspace.ru/
GPG: D0C2 EAC1 3310 822D 98DE B57C E9C5 A2D9 0898 A02F
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEE0MLqwTMQgi2Y3rV86cWi2QiYoC8FAmKI9CMACgkQ6cWi2QiY
oC8EpwgApbbTMpvRQHIqHVzZeCUfV7U8PIc1XDsREhKt7vit0wzVu3Ilav5A4kFO
YL5HBsECweDsLxsDfxMCUQeipHAwqMsWTeF0s1Y3OttA/v6cshnhBrbYCSK9BQQ8
8Xl3T7Igh4cdEQ89+Yun3S1p8oo5ij6GHn4exPwz7DLS5qZfK2Oo0oWK1+eJiSxe
MiFb74xs5OjtBVqVXykgPhmK99gSGmspwrjtjGvevum6Mp2yzOH0a9e1iCEIPf8W
XI8v35bFxAQTeFdF6p15ADvhHwYGpaZ0IvsPm7uULk5I6xnvCfiWx6S82TA1UpYJ
xr8zm6dDc+l0SQqWxsY9DM32a1U7Jg==
=040f
-----END PGP SIGNATURE-----

L
L
Ludovic Courtès wrote on 24 May 2022 16:46
Re: bug#55390: [PATCH] gnu: Add python-cymem
(name . Artyom V. Poptsov)(address . poptsov.artyom@gmail.com)(address . 55390-done@debbugs.gnu.org)
87zgj7j8eu.fsf@gnu.org
Hi Artyom,

"Artyom V. Poptsov" <poptsov.artyom@gmail.com> skribis:

Toggle quote (2 lines)
> this patch adds cymem[1] under the name 'python-cymem'.

[...]

Toggle quote (2 lines)
> this patch adds preshed[1] under the name 'python-preshed'.

Applied both, thanks!

Ludo’.
Closed
?