gnu: Add rust-crypto-hash-0.3.
[jackhill/guix/guix.git] / gnu / packages / protobuf.scm
index 556bca6..857adf1 100644 (file)
@@ -5,6 +5,8 @@
 ;;; Copyright © 2017, 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2020 Vinicius Monego <monego@posteo.net>
+;;; Copyright © 2020 Brett Gilio <brettg@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
   #:use-module (guix build-system emacs)
   #:use-module (guix build-system ruby)
   #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (guix utils)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages check)
   #:use-module (gnu packages gcc)
   #:use-module (gnu packages libevent)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages python-build)
+  #:use-module (gnu packages python-check)
   #:use-module (gnu packages python-xyz)
   #:use-module (gnu packages ruby))
 
@@ -78,7 +84,7 @@ data in motion, or as a file format for data at rest.")
 (define-public protobuf
   (package
     (name "protobuf")
-    (version "3.11.3")
+    (version "3.14.0")
     (source (origin
               (method url-fetch)
               (uri (string-append "https://github.com/google/protobuf/releases/"
@@ -86,7 +92,7 @@ data in motion, or as a file format for data at rest.")
                                   version ".tar.gz"))
               (sha256
                (base32
-                "0l8a1sgzhwwx5j5hv9n9zx8vkdwwn5gvd9dcpkkz4h0j17k1zywz"))))
+                "0nan2wkkwkcx3qyx0cf5vfzjcjhr5qgh4jfx6v2lwpf5q03mmv2h"))))
     (build-system gnu-build-system)
     (inputs `(("zlib" ,zlib)))
     (outputs (list "out"
@@ -117,7 +123,8 @@ internal RPC protocols and file formats.")
 
 ;; Tensorflow requires version 3.6 specifically.
 (define-public protobuf-3.6
-  (package/inherit protobuf
+  (package
+    (inherit protobuf)
     (version "3.6.1")
     (source (origin
               (method url-fetch)
@@ -130,8 +137,8 @@ internal RPC protocols and file formats.")
 
 ;; The 3.5 series are the last versions that do not require C++ 11.
 (define-public protobuf-3.5
-  (package/inherit
-   protobuf
+  (package
+    (inherit protobuf)
    (version "3.5.1")
    (source (origin
               (method url-fetch)
@@ -158,7 +165,7 @@ internal RPC protocols and file formats.")
 (define-public protobuf-c
   (package
     (name "protobuf-c")
-    (version "1.3.2")
+    (version "1.3.3")
     (source (origin
               (method url-fetch)
               (uri (string-append "https://github.com/protobuf-c/protobuf-c/"
@@ -166,7 +173,7 @@ internal RPC protocols and file formats.")
                                   "/protobuf-c-" version ".tar.gz"))
               (sha256
                (base32
-                "0x4ybd9rfd878p2imz0hb8zxfd7l60vbdw7cg84dnysr9kqm3wjk"))))
+                "0y3yaanq97si7iyld06p8w20m0shpj7sf4xwzbhhvijhxw36d592"))))
     (build-system gnu-build-system)
     (inputs `(("protobuf" ,protobuf)))
     (native-inputs `(("pkg-config" ,pkg-config)))
@@ -188,7 +195,7 @@ code.")
      (origin
        (method git-fetch)
        (uri (git-reference
-             (url "https://github.com/mapbox/protozero.git")
+             (url "https://github.com/mapbox/protozero")
              (commit (string-append "v" version))))
        (file-name (git-file-name name version))
        (sha256
@@ -206,15 +213,17 @@ encoder in C++.  The developer using protozero has to manually translate the
 (define-public python-protobuf
   (package
     (name "python-protobuf")
-    (version "3.11.3")
+    (version "3.12.4")
     (source
      (origin
        (method url-fetch)
        (uri (pypi-uri "protobuf" version))
        (sha256
         (base32
-         "07qby3yc2a8a1vsxnc79j687q4r68k1d3npni7bldwmd3m6rfz67"))))
+         "0mj6z58aiw532s1mq48m9xdrm3gdyp2vv9cdinfb5wmnfpm5m7n9"))))
     (build-system python-build-system)
+    (native-inputs
+     `(("python-wheel" ,python-wheel)))
     (propagated-inputs
      `(("python-six" ,python-six)))
     (home-page "https://github.com/google/protobuf")
@@ -224,12 +233,65 @@ encoder in C++.  The developer using protozero has to manually translate the
 mechanism for serializing structured data.")
     (license license:bsd-3)))
 
+(define-public python-pure-protobuf
+  (package
+    (name "python-pure-protobuf")
+    (version "2.0.1")
+    (source
+     (origin
+       ;; The PyPI tarball is broken: it has no tests.
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/eigenein/protobuf")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "15dp5pvazd0jx4wzzh79080ah7hkpd3axh40al9vhzs2hf3v90hx"))))
+    (build-system python-build-system)
+    (native-inputs
+     `(("python-flake8" ,python-flake8)
+       ("python-pytest" ,python-pytest)
+       ("python-pytest-cov" ,python-pytest-cov)
+       ("python-isort" ,python-isort)))
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-before 'check 'setup-test-env
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (py3sitedir
+                     (string-append out "/lib/python"
+                                    ,(version-major+minor
+                                      (package-version python))
+                                    "/site-packages")))
+               (setenv "PYTHONPATH"
+                       (string-append py3sitedir ":"
+                                      (getenv "PYTHONPATH"))))
+             #t))
+         (replace 'check
+           (lambda _
+             (invoke "pytest" "--cov-report" "term-missing" "--cov"
+                     "pure_protobuf")
+             (invoke "flake8" "pure_protobuf" "tests"
+                     "--ignore=F541")
+             (invoke "isort" "-rc" "-c" "pure_protobuf" "tests")
+             #t)))))
+    (home-page "https://pypi.org/project/pure-protobuf/")
+    (synopsis "Protobuf implementation using dataclasses")
+    (description
+     "@code{python-pure-protobuf} takes advantage of the standard
+dataclasses module to define message types.  Protocol buffers are a
+language-neutral, platform-neutral extensible mechanism for serializing
+structured data.")
+    (license license:expat)))
+
 (define-public python2-protobuf
   (package-with-python2 python-protobuf))
 
 ;; For tensorflow.
 (define-public python-protobuf-3.6
-  (package/inherit python-protobuf
+  (package
+    (inherit python-protobuf)
     (name "python-protobuf")
     (version (package-version protobuf-3.6) )
     (source
@@ -265,7 +327,7 @@ source files.")
     (source (origin
               (method git-fetch)
               (uri (git-reference
-                    (url "https://github.com/ruby-protobuf/protobuf.git")
+                    (url "https://github.com/ruby-protobuf/protobuf")
                     (commit (string-append "v" version))))
               (file-name (git-file-name name version))
               (sha256
@@ -334,7 +396,8 @@ source files.")
     (propagated-inputs
      `(("ruby-activesupport" ,ruby-activesupport)
        ("ruby-middleware" ,ruby-middleware)
-       ("ruby-thor" ,ruby-thor)))
+       ("ruby-thor" ,ruby-thor)
+       ("ruby-thread-safe" ,ruby-thread-safe)))
     (home-page "https://github.com/ruby-protobuf/protobuf")
     (synopsis "Implementation of Google's Protocol Buffers in Ruby")
     (description "Protobuf is an implementation of Google's Protocol Buffers