[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
11/28: gnu: Add python-psycopg.
From: |
guix-commits |
Subject: |
11/28: gnu: Add python-psycopg. |
Date: |
Sat, 22 Jan 2022 04:23:44 -0500 (EST) |
mbakke pushed a commit to branch master
in repository guix.
commit 5ec4129907e9f122265ffe5891530fc2e4326e27
Author: Marius Bakke <marius@gnu.org>
AuthorDate: Fri Jan 21 20:55:53 2022 +0100
gnu: Add python-psycopg.
* gnu/packages/databases.scm (python-psycopg): New variable.
---
gnu/packages/databases.scm | 75 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 75 insertions(+)
diff --git a/gnu/packages/databases.scm b/gnu/packages/databases.scm
index 0e0007ef65..4986451d59 100644
--- a/gnu/packages/databases.scm
+++ b/gnu/packages/databases.scm
@@ -115,6 +115,7 @@
#:use-module (gnu packages maths)
#:use-module (gnu packages multiprecision)
#:use-module (gnu packages ncurses)
+ #:use-module (gnu packages networking)
#:use-module (gnu packages onc-rpc)
#:use-module (gnu packages pantheon)
#:use-module (gnu packages parallel)
@@ -3466,6 +3467,80 @@ designed to be easy and intuitive to use.")
with the @code{psycopg} PostgreSQL driver.")
(license license:lgpl3+)))
+(define-public python-psycopg
+ (package
+ (name "python-psycopg")
+ (version "3.0.8")
+ (source (origin
+ ;; Fetch from git because PyPI contains only cythonized sources.
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/psycopg/psycopg")
+ (commit version)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "16i19jqd9lg9r7bc63ssh527cccrpf49g1nlayikk5qlswpzp75y"))))
+ (build-system python-build-system)
+ (arguments
+ (list #:phases
+ #~(modify-phases %standard-phases
+ (add-before 'build 'change-directory
+ (lambda _
+ (chdir "psycopg")))
+ (add-after 'build 'build-c-extensions
+ (lambda _
+ (with-directory-excursion "../psycopg_c"
+ ((assoc-ref %standard-phases 'build)))))
+ (add-after 'install 'install-c-extensions
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ ;; For some reason setup.py refuses to install if the
+ ;; installation directory is not on PYTHONPATH.
+ (setenv "PYTHONPATH" (site-packages inputs outputs))
+ (with-directory-excursion "../psycopg_c"
+ ((assoc-ref %standard-phases 'install)
+ #:inputs inputs
+ #:outputs outputs))))
+ (add-before 'check 'start-postgresql
+ (lambda _
+ (let ((dbdir (string-append (getcwd) "/../pgdir")))
+ (invoke "initdb" "-D" dbdir)
+ (invoke "pg_ctl" "-D" dbdir
+ "-o" (string-append "-k " dbdir)
+ "-l" (string-append dbdir "/db.log")
+ "start")
+
+ (invoke "psql" "-h" dbdir "-d" "postgres"
+ "-c" "CREATE DATABASE nixbld;"))))
+ (replace 'check
+ (lambda* (#:key inputs tests? #:allow-other-keys)
+ (when tests?
+ (setenv "TZDIR" (search-input-directory inputs
+ "share/zoneinfo"))
+ (with-directory-excursion ".."
+ (invoke "pytest" "-vv"
+ "-o" "asyncio_mode=auto"
+ ;; FIXME: Many of the typing tests are failing,
+ ;; conveniently tagged as slow...
+ "-k" "not slow"))))))))
+ (native-inputs
+ (list python-cython-3
+ python-mypy
+ python-psycopg-pool
+ python-pytest
+ python-pytest-asyncio
+ python-tenacity
+ pproxy
+ tzdata-for-tests))
+ (inputs
+ (list postgresql))
+ (home-page "https://www.psycopg.org/")
+ (synopsis "PostgreSQL driver for Python")
+ (description
+ "Psycopg 3 is a new implementation of the popular @code{psycopg2}
+database adapter for Python.")
+ (license license:lgpl3+)))
+
(define-public python-sadisplay
(package
(name "python-sadisplay")
- branch master updated (e22957fc15 -> 97176b4d9c), guix-commits, 2022/01/22
- 03/28: gnu: Add pproxy., guix-commits, 2022/01/22
- 01/28: gnu: python-psycopg2: Update to 2.9.3., guix-commits, 2022/01/22
- 02/28: gnu: postgresql: Add 14.1., guix-commits, 2022/01/22
- 04/28: gnu: python-cython: Add 3.0.0a10., guix-commits, 2022/01/22
- 12/28: gnu: python-pandas: Remove old version., guix-commits, 2022/01/22
- 11/28: gnu: Add python-psycopg.,
guix-commits <=
- 14/28: gnu: python-tqdm: Update to 4.62.3., guix-commits, 2022/01/22
- 06/28: gnu: Add python-typeguard., guix-commits, 2022/01/22
- 08/28: gnu: python-pytest-mock: Cope with test warnings., guix-commits, 2022/01/22
- 07/28: gnu: python-tenacity: Update to 8.0.1., guix-commits, 2022/01/22
- 05/28: gnu: python-mypy: Update to 0.931., guix-commits, 2022/01/22
- 09/28: gnu: python-pytest-asyncio: Update to 0.17.2., guix-commits, 2022/01/22
- 17/28: gnu: python-flask: Update to 2.0.2., guix-commits, 2022/01/22
- 20/28: gnu: Deprecate python-flask-restplus., guix-commits, 2022/01/22
- 24/28: gnu: behave: Update to 1.2.7.dev2., guix-commits, 2022/01/22
- 10/28: gnu: Add python-psycopg-pool., guix-commits, 2022/01/22