[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
354/470: gnu: Add python-orjson.
From: |
guix-commits |
Subject: |
354/470: gnu: Add python-orjson. |
Date: |
Sun, 30 Apr 2023 14:04:56 -0400 (EDT) |
efraim pushed a commit to branch rust-team
in repository guix.
commit 5f808fcdfd8d7d0a6cdf576ea37d663c4e09946a
Author: Ricardo Wurmus <rekado@elephly.net>
AuthorDate: Thu Mar 23 17:03:14 2023 +0100
gnu: Add python-orjson.
* gnu/packages/python-xyz.scm (python-orjson): New variable.
---
gnu/packages/python-xyz.scm | 97 ++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 96 insertions(+), 1 deletion(-)
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index e2d082091f..d815e044f5 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -7,7 +7,7 @@
;;; Copyright © 2014, 2015 Federico Beffa <beffa@fbengineering.ch>
;;; Copyright © 2015 Omar Radwan <toxemicsquire4@gmail.com>
;;; Copyright © 2015 Pierre-Antoine Rault <par@rigelk.eu>
-;;; Copyright © 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 Ricardo
Wurmus <rekado@elephly.net>
+;;; Copyright © 2015-2023 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2015, 2016, 2020 Christine Lemmer-Webber
<cwebber@dustycloud.org>
;;; Copyright © 2015 Eric Dvorsak <eric@dvorsak.fr>
;;; Copyright © 2015, 2016 David Thompson <davet@gnu.org>
@@ -166,6 +166,7 @@
#:use-module (gnu packages cmake)
#:use-module (gnu packages compression)
#:use-module (gnu packages cpp)
+ #:use-module (gnu packages crates-io)
#:use-module (gnu packages crypto)
#:use-module (gnu packages databases)
#:use-module (gnu packages dbm)
@@ -267,6 +268,7 @@
#:use-module (guix gexp)
#:use-module (guix utils)
#:use-module (guix build-system gnu)
+ #:use-module (guix build-system cargo)
#:use-module (guix build-system cmake)
#:use-module (guix build-system pyproject)
#:use-module (guix build-system python)
@@ -2587,6 +2589,99 @@ a library.")
(description "DiskCache is a disk and file backed persistent cache.")
(license license:asl2.0)))
+(define-public python-orjson
+ (package
+ (name "python-orjson")
+ (version "3.8.8")
+ (source (origin
+ (method url-fetch)
+ (uri (pypi-uri "orjson" version))
+ (sha256
+ (base32
+ "1nn617pzn8smjkf7j593ybq16qfnj53bla52qjwzzrms4fjxg5n0"))))
+ (build-system cargo-build-system)
+ (arguments
+ (list
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'install 'build-python-module
+ (lambda _
+ ;; We don't use maturin.
+ (delete-file "pyproject.toml")
+ (call-with-output-file "pyproject.toml"
+ (lambda (port)
+ (format port "\
+[build-system]
+build-backend = 'setuptools.build_meta'
+requires = ['setuptools']
+")))
+ (call-with-output-file "setup.cfg"
+ (lambda (port)
+ (format port "\
+
+[metadata]
+name = orjson
+version = '~a'
+
+[options]
+packages = find:
+
+[options.packages.find]
+exclude =
+ src
+ integration
+ test
+ Cargo.toml
+" #$version)))
+ ;; ZIP does not support timestamps before 1980.
+ (setenv "SOURCE_DATE_EPOCH" "315532800")
+ (invoke "python" "-m" "build" "--wheel" "--no-isolation" ".")))
+ (add-after 'build-python-module 'install-python-module
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let ((whl (car (find-files "dist" "\\.whl$"))))
+ (invoke "pip" "--no-cache-dir" "--no-input"
+ "install" "--no-deps" "--prefix" #$output whl))))
+ (add-after 'install-python-module 'install-python-library
+ (lambda _
+ (let ((site (string-append #$output "/lib/python"
+ #$(version-major+minor
+ (package-version python))
+ "/site-packages")))
+ (mkdir-p site)
+ (copy-file "target/release/liborjson.so"
+ (string-append site "/orjson.so"))))))
+ #:cargo-inputs
+ `(("rust-ahash" ,rust-ahash-0.8)
+ ("rust-arrayvec" ,rust-arrayvec-0.7)
+ ("rust-associative-cache" ,rust-associative-cache-1)
+ ("rust-beef" ,rust-beef-0.5)
+ ("rust-bytecount" ,rust-bytecount-0.6)
+ ("rust-chrono" ,rust-chrono-0.4)
+ ("rust-compact-str" ,rust-compact-str-0.7)
+ ("rust-encoding-rs" ,rust-encoding-rs-0.8)
+ ("rust-itoa" ,rust-itoa-1)
+ ("rust-itoap" ,rust-itoap-1)
+ ("rust-once-cell" ,rust-once-cell-1)
+ ("rust-pyo3-ffi" ,rust-pyo3-ffi-0.18)
+ ("rust-ryu" ,rust-ryu-1)
+ ("rust-serde" ,rust-serde-1)
+ ("rust-serde-json" ,rust-serde-json-1)
+ ("rust-simdutf8" ,rust-simdutf8-0.1)
+ ("rust-smallvec" ,rust-smallvec-1))
+ #:install-source? #false))
+ (native-inputs
+ (list python-wrapper
+ python-pypa-build
+ python-wheel))
+ (home-page "https://github.com/ijl/orjson")
+ (synopsis "Python JSON library supporting dataclasses, datetimes, and
numpy")
+ (description "Orjson is a fast, correct JSON library for Python. It
+benchmarks as the fastest Python library for JSON and is more correct than the
+standard @code{json} library or other third-party libraries. It serializes
+dataclass, datetime, numpy, and UUID instances natively.")
+ ;; Either of these licenses
+ (license (list license:asl2.0 license:expat))))
+
(define-public python-argparse-addons
(package
(name "python-argparse-addons")
- 317/470: gnu: Add rust-radium-0.7., (continued)
- 317/470: gnu: Add rust-radium-0.7., guix-commits, 2023/04/30
- 324/470: gnu: rust-windows-aarch64-gnullvm-0.42: Update to 0.42.2., guix-commits, 2023/04/30
- 328/470: gnu: Add rust-windows-targets-0.42., guix-commits, 2023/04/30
- 330/470: gnu: rust-arbitrary-1: Update to 1.3.0., guix-commits, 2023/04/30
- 331/470: gnu: rust-derive-arbitrary-1: Update to 1.3.0., guix-commits, 2023/04/30
- 334/470: gnu: rust-bytecheck-derive-0.6: Update to 0.6.10., guix-commits, 2023/04/30
- 341/470: gnu: rust-serde-derive-1: Update to 1.0.158., guix-commits, 2023/04/30
- 340/470: gnu: Add rust-syn-2., guix-commits, 2023/04/30
- 343/470: gnu: rust-serde-1: Update to 1.0.158., guix-commits, 2023/04/30
- 346/470: gnu: Add rust-structmeta-0.1., guix-commits, 2023/04/30
- 354/470: gnu: Add python-orjson.,
guix-commits <=
- 357/470: gnu: Add rust-bitflags-2., guix-commits, 2023/04/30
- 358/470: gnu: rust-curl-sys-0.4: Update to 0.4.61+curl-8.0.1., guix-commits, 2023/04/30
- 361/470: gnu: rust-fastrand-1: Update to 1.9.0., guix-commits, 2023/04/30
- 369/470: gnu: rust-syscallz-0.15: Update to 0.16.2., guix-commits, 2023/04/30
- 392/470: gnu: rust-wayland-sys-0.29: Update to 0.29.5., guix-commits, 2023/04/30
- 393/470: gnu: rust-core-graphics-0.22: Update to 0.22.3., guix-commits, 2023/04/30
- 395/470: gnu: rust-x11-dl-2: Update to 2.21.0., guix-commits, 2023/04/30
- 403/470: gnu: Add rust-x11rb-0.10., guix-commits, 2023/04/30
- 419/470: gnu: rust-serde-1: Update to 1.0.160., guix-commits, 2023/04/30
- 427/470: gnu: Add rust-glutin-wgl-sys-0.4., guix-commits, 2023/04/30