[PATCH] gnu: Add python-snappy.

  • Done
  • quality assurance status badge
Details
3 participants
  • Mathieu Othacehe
  • Troy Figiel
  • Tomas Volf
Owner
unassigned
Submitted by
Troy Figiel
Severity
normal

Debbugs page

Troy Figiel wrote 1 years ago
(address . guix-patches@gnu.org)
87mstr3gac.fsf@troyfigiel.com
* gnu/packages/python-compression.scm (python-snappy): New variable.

Change-Id: I0142f49745104db8458c0becf222eb4088c9ee58
---
gnu/packages/python-compression.scm | 31 +++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)

Toggle diff (53 lines)
diff --git a/gnu/packages/python-compression.scm b/gnu/packages/python-compression.scm
index bc96bc05d3..364f741392 100644
--- a/gnu/packages/python-compression.scm
+++ b/gnu/packages/python-compression.scm
@@ -7,6 +7,7 @@
;;; Copyright © 2020 Nicolas Goaziou <mail@nicolasgoaziou.fr>
;;; Copyright © 2020, 2022, 2023 Marius Bakke <marius@gnu.org>
;;; Copyright © 2021 Brendan Tildesley <mail@brendan.scot>
+;;; Copyright © 2023 Troy Figiel <troy@troyfigiel.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -416,6 +417,36 @@ (define-public python-lzstring
(description "Lz-string is a string compressor library for Python.")
(license license:expat)))
+(define-public python-snappy
+ (package
+ (name "python-snappy")
+ (version "0.6.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (pypi-uri "python-snappy" version))
+ (sha256
+ (base32 "0amv12w0ybn6n1lk36x70a3l8bdjv4mn7iflb59wqsi00smhg8dn"))))
+ (build-system python-build-system)
+ (arguments
+ '(#:phases (modify-phases %standard-phases
+ (replace 'check
+ (lambda* (#:key tests? #:allow-other-keys)
+ (when tests?
+ (invoke "pytest" "-vv" "-k"
+ ;; CFFI is only supported for PyPy builds.
+ (string-append "not test_snappy_cffi_enum "
+ "and not test_snappy_all_cffi"))))))))
+ (inputs (list snappy))
+ (native-inputs (list python-pytest))
+ (home-page "https://github.com/andrix/python-snappy")
+ (synopsis "Python bindings for the Snappy compression library")
+ (description
+ "@code{python-snappy} provides bindings to the Snappy library
+and can be used to compress and decompress files and streams. It can also be
+used directly from the command line.")
+ (license license:bsd-3)))
+
(define-public bitshuffle
(package
(name "bitshuffle")

base-commit: f24b14767d362a84e6469682b4fe303b50f4b589
--
2.40.1
Troy Figiel wrote 1 years ago
Naming collision
(address . 68147@debbugs.gnu.org)
87v88fu4jy.fsf@troyfigiel.com
Interestingly, both `python-snappy' and `snappy' are available on PyPI
(https://pypi.org/project/snappy/).These are two completely distinct
packages and in this issue I only package `python-snappy'.

If I understand the Python naming rules, if someone were to package
`snappy' in the future, both would be associated to the `python-snappy'
variable in Guix. What would be the best approach to handle this
potential naming collision?

Best wishes,

Troy
-----BEGIN PGP SIGNATURE-----

iQJIBAEBCgAyFiEE5HwNzSdo36E4/NzWxnyRgbOJP7AFAmWQLnEUHHRyb3lAdHJv
eWZpZ2llbC5jb20ACgkQxnyRgbOJP7D2XQ//YqsW/c6ijOyyMrCNx/7QqKPYqV73
FvAhw7TedAwv1+S+7LVNlPs3SWVBxZzeKi4ksbordlaMpMNI8NivRZmffc5nfghp
s0PH4YAo7AymOk+H1f1KV5hSf6BZ0ZH3Fvo+84Gbl9C7TSBRnGUCBdRrFtV40CaA
U5sKpMv3SbQiJ4oTOSMGax+fuM3uIzrsKMLCIgUj/kXcAEWtwFkYeh/ubNgorvsT
uVoHTQK5Yhfki5yHL88l91rJs5njvr+aSHHby7i5tO4i0NGgVI808Ah5LuMlxOzE
7nnyO4eOM9jdgZVOjkeP3KJVo6oEu6u6Teg/fbSBYbXscm0n5CVbXnYDUwmmtKOl
zFtgXoDPx7yfVgF0epf0aZ6JhY3LsiGgJOjmipLCjt9YJhSeK8M+h7eTQa+xalqC
LyCRQ2tBNWmDCKOhcA8lMyKIkOLmAqJIFjVycYsDLyDpmNs9550zebJUtQMt9WTW
CpJVXZbkdxQBaGW/p0K0VvIh6+2nPBKkvlGQ5KN8BcErEhXbcSUbhgNQE7ZpQkQW
ByTEXxJnoIxfBSwFu4MN2dVJMBt3icsnnjaCTwkkxemJo2oNwldvCF6PTIqcB/wh
dDy9dNtmvz5XbZhmjVv/EKwWaCeTHIb8sgmx6Vlv0V50NhcsWpoXq9N2H3iRcwi3
ahymJxwUN0KmPmc=
=skQE
-----END PGP SIGNATURE-----

Tomas Volf wrote 1 years ago
(name . Troy Figiel)(address . troy@troyfigiel.com)(address . 68147@debbugs.gnu.org)
ZZBRs_VQ0rndRiq_@ws
On 2023-12-30 15:51:29 +0100, Troy Figiel wrote:
Toggle quote (9 lines)
> Interestingly, both `python-snappy' and `snappy' are available on PyPI
> (https://pypi.org/project/snappy/). These are two completely distinct
> packages and in this issue I only package `python-snappy'.
>
> If I understand the Python naming rules, if someone were to package
> `snappy' in the future, both would be associated to the `python-snappy'
> variable in Guix. What would be the best approach to handle this
> potential naming collision?

As far as I can tell, names of PyPI packages in guix are basically formed by
adding `python-' prefix to the PyPI name. So here the correct name would be
`python-python-snappy'. I agree that it looks... weird, however it does prevent
the collision.

It will prevent any user confusion, while adhering to a pattern that is already
elsewhere, so I think it is worth it.

Have a nice day,
Tomas Volf

--
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEt4NJs4wUfTYpiGikL7/ufbZ/wakFAmWQUbMACgkQL7/ufbZ/
walI4xAAjCQKdpFjzOCA1VVZiUiC5Q0MpJXmstGFkJc1q2A8O59dQRIYPfd4BnIG
tOoVkDJFaj+Rn/K9ldN41eQQR9HY8n9s4BnapZExPZXCrUfQ/GcVE9h0Q34XrX5B
nv8dnOTW+ZcSjkiz7Ff1CDm3CF0DPRQJRCPIrNpHCE8/gvkWJZVZZclG1/1n3RiN
rDCtH54O8nzO0k4/cRGp33oMkl7p23lXJ+eDQqS2oxG6NpkRFmXwTH4l6v1Zk+8z
gpmlfvjwMEympFP3N83VTYsRNf7a8O5drvEajX2AY92Bbc08ahEe7/eAETqP/qfm
w+1VTuAcbMuIHCyVXH6gkaZUgm5Y9wCwdUBYmnj/mKVjQDZLuq885VWEw6bp7iK9
PaDqxk1DCxCWYGrIooItqj8ReAFB2u0L+BEU2OlYRkNWUDW3yqH/0QVnEdQ2OBE7
7LQqqDXOD2Q4/Ezb+k/P1Y9OAm/uJxte0Z1vxMmK0A2P6GfNKTy/mqV8vfMlDMpN
PHy41rSGfZnXMTHYniK8OwIEcmq+zIbpNPt7vbIoavPQeR0RvB5Ayi8rE1O3MV1o
Ml2941KjzMbTjlSwW0np7SBIA7Shls4nrworfx8LWhD25bqHkTOYaG9HFfSj5w6M
vuWSnTE5cJw4y2xPhrAKMT8pR2sG1eB5vFwSvOMaLcOtBhwZwMA=
=TW4v
-----END PGP SIGNATURE-----


Troy Figiel wrote 1 years ago
Re: [bug#68147] Naming collision
(address . 68147@debbugs.gnu.org)
87cyuexyiu.fsf@troyfigiel.com
Hi Tomas,

I like your approach, I was thinking in the same direction. Having a
slightly more convoluted name would be preferable over having to change
the API later on.

I will submit a new patch with a comment regarding its name. Snappy
seems to be a desired namespace :)

Best wishes,

Troy

Tomas Volf <~@wolfsden.cz> writes:

Toggle quote (25 lines)
> On 2023-12-30 15:51:29 +0100, Troy Figiel wrote:
>> Interestingly, both `python-snappy' and `snappy' are available on PyPI
>> (https://pypi.org/project/snappy/). These are two completely distinct
>> packages and in this issue I only package `python-snappy'.
>>
>> If I understand the Python naming rules, if someone were to package
>> `snappy' in the future, both would be associated to the `python-snappy'
>> variable in Guix. What would be the best approach to handle this
>> potential naming collision?
>
> As far as I can tell, names of PyPI packages in guix are basically formed by
> adding `python-' prefix to the PyPI name. So here the correct name would be
> `python-python-snappy'. I agree that it looks... weird, however it does prevent
> the collision.
>
> It will prevent any user confusion, while adhering to a pattern that is already
> elsewhere, so I think it is worth it.
>
> Have a nice day,
> Tomas Volf
>
> --
> There are only two hard things in Computer Science:
> cache invalidation, naming things and off-by-one errors.
>
<#secure method=pgpmime mode=sign>
Troy Figiel wrote 1 years ago
[PATCH v2] gnu: Add python-python-snappy.
(address . 68147@debbugs.gnu.org)
87bk9yxtn8.fsf@troyfigiel.com
* gnu/packages/python-compression.scm (python-python-snappy): New variable.
---
gnu/packages/python-compression.scm | 34 +++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)

Toggle diff (56 lines)
diff --git a/gnu/packages/python-compression.scm b/gnu/packages/python-compression.scm
index bc96bc05d3..6f249dd3af 100644
--- a/gnu/packages/python-compression.scm
+++ b/gnu/packages/python-compression.scm
@@ -7,6 +7,7 @@
;;; Copyright © 2020 Nicolas Goaziou <mail@nicolasgoaziou.fr>
;;; Copyright © 2020, 2022, 2023 Marius Bakke <marius@gnu.org>
;;; Copyright © 2021 Brendan Tildesley <mail@brendan.scot>
+;;; Copyright © 2023 Troy Figiel <troy@troyfigiel.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -416,6 +417,39 @@ (define-public python-lzstring
(description "Lz-string is a string compressor library for Python.")
(license license:expat)))
+(define-public python-python-snappy
+ (package
+ ;; PyPI contains both `snappy' and `python-snappy' as completely distinct
+ ;; packages. To avoid a name collision in Guix, we use the variable name
+ ;; `python-python-snappy' for the package called `python-snappy' on PyPI.
+ (name "python-python-snappy")
+ (version "0.6.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (pypi-uri "python-snappy" version))
+ (sha256
+ (base32 "0amv12w0ybn6n1lk36x70a3l8bdjv4mn7iflb59wqsi00smhg8dn"))))
+ (build-system python-build-system)
+ (arguments
+ '(#:phases (modify-phases %standard-phases
+ (replace 'check
+ (lambda* (#:key tests? #:allow-other-keys)
+ (when tests?
+ (invoke "pytest" "-vv" "-k"
+ ;; CFFI is only supported for PyPy builds.
+ (string-append "not test_snappy_cffi_enum "
+ "and not test_snappy_all_cffi"))))))))
+ (inputs (list snappy))
+ (native-inputs (list python-pytest))
+ (home-page "https://github.com/andrix/python-snappy")
+ (synopsis "Python bindings for the Snappy compression library")
+ (description
+ "@code{python-python-snappy} provides bindings to the Snappy library and
+can be used to compress and decompress files and streams. It can also be used
+directly from the command line.")
+ (license license:bsd-3)))
+
(define-public bitshuffle
(package
(name "bitshuffle")

base-commit: ee0cf3b9ff4cd5a9d3637d09677195ea9ee1a8c0
--
2.42.0
Mathieu Othacehe wrote 1 years ago
(name . Troy Figiel)(address . troy@troyfigiel.com)(address . 68147-done@debbugs.gnu.org)
874jfmevis.fsf@gnu.org
Toggle quote (2 lines)
> * gnu/packages/python-compression.scm (python-python-snappy): New variable.

Applied, thanks,

Mathieu
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 68147@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 68147
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help