Subject: [bug#40321] [PATCH] Add python-tortoise-orm

From: Lars-Dominik Braun <[email-masked]>
Date: Mon, 30 Mar 2020 08:43:34 +0200

Hi,

this patchset adds python-tortoise-orm and dependencies.

Cheers,
Lars

From 909bbc3a8bfc4ba83bd1df5803de8ad567916783 Mon Sep 17 00:00:00 2001
From: Lars-Dominik Braun <[email-masked]>
Date: Mon, 30 Mar 2020 08:28:15 +0200
Subject: [PATCH 1/5] gnu: Add python-aiounittest

* gnu/packages/check.scm (python-aiounittest): New variable
---
 gnu/packages/check.scm | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/gnu/packages/check.scm b/gnu/packages/check.scm
index 1b60b99ce1..e951c76737 100644
--- a/gnu/packages/check.scm
+++ b/gnu/packages/check.scm
@@ -2509,3 +2509,25 @@ system.  The code under test requires no modification to work with pyfakefs.")
 
 (define-public python2-pyfakefs
   (package-with-python2 python-pyfakefs))
+
+(define-public python-aiounittest
+  (package
+    (name "python-aiounittest")
+    (version "1.3.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "aiounittest" version))
+       (sha256
+        (base32
+         "1q4bhmi80smaa1lknvdna0sx3915naczlfna1fp435nf6cjyrjl1"))))
+    (build-system python-build-system)
+    (native-inputs
+     `(("python-coverage" ,python-coverage)
+       ("python-nose" ,python-nose)))
+    (home-page
+     "https://github.com/kwarunek/aiounittest")
+    (synopsis "Test asyncio code more easily")
+    (description "The aiounittest is a helper library to ease of your pain (and
+boilerplate), when writing a test of the asynchronous code (asyncio).")
+    (license license:expat)))
-- 
2.20.1

From dc6c1301afbd581c6f2107146f254cf5ba2f11e6 Mon Sep 17 00:00:00 2001
From: Lars-Dominik Braun <[email-masked]>
Date: Mon, 30 Mar 2020 08:32:30 +0200
Subject: [PATCH 2/5] gnu: Add python-aiosqlite

* gnu/packages/databases.scm (python-aiosqlite): New variable.
---
 gnu/packages/databases.scm | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/gnu/packages/databases.scm b/gnu/packages/databases.scm
index 9e60074dad..25c4fbc5bb 100644
--- a/gnu/packages/databases.scm
+++ b/gnu/packages/databases.scm
@@ -2716,6 +2716,29 @@ translate the complete SQLite API into Python.")
 (define-public python2-apsw
   (package-with-python2 python-apsw))
 
+(define-public python-aiosqlite
+  (package
+    (name "python-aiosqlite")
+    (version "0.11.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "aiosqlite" version))
+       (sha256
+        (base32
+         "1f3zdldp9zgrw6qz5fsp3wa5zw73cjf139pj4vf24ryv895320jg"))))
+    (build-system python-build-system)
+    (native-inputs
+     `(("python-aiounittest" ,python-aiounittest)))
+    (home-page "https://github.com/jreese/aiosqlite")
+    (synopsis
+     "Asyncio bridge for sqlite3")
+    (description
+     "The package aiosqlite replicates the standard sqlite3 module, but with
+async versions of all the standard connection and cursor methods, and context
+managers for automatically closing connections.")
+    (license license:expat)))
+
 (define-public python2-neo4j-driver
   (package
     (name "python2-neo4j-driver")
-- 
2.20.1

From ce37a0c106217449df95a3130381f833e77c79c6 Mon Sep 17 00:00:00 2001
From: Lars-Dominik Braun <[email-masked]>
Date: Mon, 30 Mar 2020 08:37:04 +0200
Subject: [PATCH 3/5] gnu: Add python-pypika

Not to be confused with python-pika, which is a different package.

* gnu/packages/databases.scm (python-pypika): New variable.
---
 gnu/packages/databases.scm | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/gnu/packages/databases.scm b/gnu/packages/databases.scm
index 25c4fbc5bb..669b8f9bc6 100644
--- a/gnu/packages/databases.scm
+++ b/gnu/packages/databases.scm
@@ -3047,6 +3047,27 @@ transforms idiomatic python function calls to well-formed SQL queries.")
 (define-public python2-sql
   (package-with-python2 python-sql))
 
+(define-public python-pypika
+  (package
+    (name "python-pypika")
+    (version "0.36.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "PyPika" version))
+       (sha256
+        (base32
+         "0qzn5vygirg52dlizm6ayzdc5llq8p2krrx0kymr236lrz89wqp8"))))
+    (build-system python-build-system)
+    (native-inputs
+     `(("python-parameterized" ,python-parameterized)))
+    (home-page "https://github.com/kayak/pypika")
+    (synopsis "SQL query builder API for Python")
+    (description
+     "PyPika is a python SQL query builder that exposes the full richness of
+the SQL language using a syntax that reflects the resulting query.")
+    (license license:asl2.0)))
+
 (define-public mongo-tools
   (package
     (name "mongo-tools")
-- 
2.20.1

From a779601922b55eb4d054924fe005cd9d0cf84508 Mon Sep 17 00:00:00 2001
From: Lars-Dominik Braun <[email-masked]>
Date: Mon, 30 Mar 2020 08:39:29 +0200
Subject: [PATCH 4/5] gnu: Add python-ciso8601

* gnu/packages/time.scm (python-ciso8601): New variable.
---
 gnu/packages/time.scm | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/gnu/packages/time.scm b/gnu/packages/time.scm
index f4dc8a2ffd..e0ef71d89a 100644
--- a/gnu/packages/time.scm
+++ b/gnu/packages/time.scm
@@ -235,6 +235,32 @@ datetime module, available in Python 2.3+.")
 (define-public python2-parsedatetime
   (package-with-python2 python-parsedatetime))
 
+(define-public python-ciso8601
+  (package
+    (name "python-ciso8601")
+    (version "2.1.3")
+    (source
+     (origin
+       (method git-fetch)
+       ;; Pypi package lacks file tests.py
+       (uri (git-reference
+             (url "https://github.com/closeio/ciso8601.git")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0g1aiyc1ayh0rnibyy416m5mmck38ksgdm3jsy0z3rxgmgb24951"))))
+    (build-system python-build-system)
+    (native-inputs
+     `(("python-pytz" ,python-pytz)))
+    (home-page "https://github.com/closeio/ciso8601")
+    (synopsis
+     "Fast ISO8601 date time parser")
+    (description
+     "The package ciso8601 converts ISO 8601 or RFC 3339 date time strings into
+Python datetime objects.")
+    (license expat)))
+
 (define-public python-tzlocal
   (package
     (name "python-tzlocal")
-- 
2.20.1

From 5ecd1b998615956436cd3b0b37c80f7bb149e88a Mon Sep 17 00:00:00 2001
From: Lars-Dominik Braun <[email-masked]>
Date: Mon, 30 Mar 2020 08:41:12 +0200
Subject: [PATCH 5/5] gnu: Add python-tortoise-orm

* gnu/packages/databases.scm (python-tortoise-orm): New variable.
---
 gnu/packages/databases.scm | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/gnu/packages/databases.scm b/gnu/packages/databases.scm
index 669b8f9bc6..a3b78932a3 100644
--- a/gnu/packages/databases.scm
+++ b/gnu/packages/databases.scm
@@ -2205,6 +2205,41 @@ can autogenerate peewee models using @code{pwiz}, a model generator.")
 (define-public python2-peewee
   (package-with-python2 python-peewee))
 
+(define-public python-tortoise-orm
+  (package
+    (name "python-tortoise-orm")
+    (version "0.16.3")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "tortoise-orm" version))
+       (sha256
+        (base32
+         "01hbvfyxs2qd1mjc96aipwsdxxhydw8ww686r4gsf87bl6f98dvz"))))
+    (build-system python-build-system)
+    ;; Disable tests for now. They pull in a lot of dependencies.
+    (arguments `(#:tests? #f))
+    (native-inputs
+     `(("python-ciso8601" ,python-ciso8601)
+       ("python-asynctest" ,python-asynctest)
+       ("python-nose2" ,python-nose2)))
+    (propagated-inputs
+     `(("python-aiosqlite" ,python-aiosqlite)
+       ("python-pypika" ,python-pypika)
+       ("python-typing-extensions"
+        ,python-typing-extensions)))
+    (home-page
+     "https://github.com/tortoise/tortoise-orm")
+    (synopsis
+     "Easy async ORM for python, built with relations in mind")
+    (description
+     "Tortoise ORM is an easy-to-use asyncio ORM (Object Relational Mapper)
+inspired by Django.  Tortoise ORM was build with relations in mind and
+admiration for the excellent and popular Django ORM.  It’s engraved in it’s
+design that you are working not with just tables, you work with relational
+data.")
+    (license license:asl2.0)))
+
 (define-public sqlcipher
   (package
     (name "sqlcipher")
-- 
2.20.1