[PATCH 0/8] Add datasette and python-sqlite-utils.

  • Done
  • quality assurance status badge
Details
3 participants
  • Felix Gruber
  • Liliana Marie Prikler
  • Maxim Cournoyer
Owner
unassigned
Submitted by
Felix Gruber
Severity
normal
F
F
Felix Gruber wrote on 15 Jan 2023 22:47
(address . guix-patches@gnu.org)(name . Felix Gruber)(address . felgru@posteo.net)
20230115214753.25034-1-felgru@posteo.net
This patchset adds new packages for the database exploration and
manipulation tools datasette and sqlite-utils, as well as some missing
dependencies of those two packages.

Since datasette and sqlite-utils do not contain any tests in their pypi
source archives, I've tested both on the global power plant database,
which can be downloaded as CSV file from

First, I tested sqlite-utils by converting the power plants CSV file
to a sqlite database, using

sqlite-utils insert powerplants.db powerplants \
global_power_plant_database.csv --csv

Then I used datasette to explore the newly created database with

datasette serve powerplants.db -o

(Note the -o option to automatically open the datasette instance in
your webbrowser.)

So far everything seems to work.

Felix Gruber (8):
gnu: Add python-click-default-group-wheel.
gnu: Add python-sqlite-fts4.
gnu: Add python-sqlite-utils.
gnu: python-janus: Update to 1.0.0.
gnu: Add python-pluggy-next.
gnu: Add python-asgi-lifespan.
gnu: Add python-asgi-csrf.
gnu: Add datasette.

gnu/packages/databases.scm | 104 ++++++++++++++++++++++++++++++++++++
gnu/packages/python-web.scm | 50 ++++++++++++++++-
gnu/packages/python-xyz.scm | 45 ++++++++++++++--
3 files changed, 195 insertions(+), 4 deletions(-)

--
2.38.1
F
F
Felix Gruber wrote on 15 Jan 2023 22:50
[PATCH 1/8] gnu: Add python-click-default-group-wheel.
(address . 60838@debbugs.gnu.org)(name . Felix Gruber)(address . felgru@posteo.net)
20230115215056.25161-1-felgru@posteo.net
* gnu/packages/python-xyz.scm (python-click-default-group-wheel): New
variable.
---
gnu/packages/python-xyz.scm | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)

Toggle diff (46 lines)
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index c91561e787..1dbe9d611f 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -108,7 +108,7 @@
;;; Copyright © 2021 Simon Streit <simon@netpanic.org>
;;; Copyright © 2021 Daniel Meißner <daniel.meissner-i4k@ruhr-uni-bochum.de>
;;; Copyright © 2021, 2022 Pradana Aumars <paumars@courrier.dev>
-;;; Copyright © 2021, 2022 Felix Gruber <felgru@posteo.net>
+;;; Copyright © 2021, 2022, 2023 Felix Gruber <felgru@posteo.net>
;;; Copyright © 2021 Sébastien Lerique <sl@eauchat.org>
;;; Copyright © 2021 Raphaël Mélotte <raphael.melotte@mind.be>
;;; Copyright © 2021 ZmnSCPxj <ZmnSCPxj@protonmail.com>
@@ -14769,6 +14769,30 @@ (define-public python-click-default-group
(home-page "https://github.com/click-contrib/click-default-group")
(license license:bsd-3)))
+(define-public python-click-default-group-wheel
+ ;; Fork of python-click-default-group used by sqlite-utils and datasette.
+ ;; See https://github.com/click-contrib/click-default-group/issues/21
+ (package
+ (name "python-click-default-group-wheel")
+ (version "1.2.2")
+ (source (origin
+ (method url-fetch)
+ (uri (pypi-uri "click-default-group-wheel" version))
+ (sha256
+ (base32
+ "0ivpdng2391v8afd5j1xdv9vbbr9iafbdh6h5shqhgn0j8ns83g9"))))
+ (build-system python-build-system)
+ (arguments
+ '(#:tests? #f)) ; no tests in pypi package
+ (propagated-inputs (list python-click))
+ (home-page "https://github.com/sublee/click-default-group/")
+ (synopsis
+ "Extends click.Group to invoke a command without explicit subcommand name")
+ (description
+ "This package provides click-default-group with an additional pure
+Python wheel package, compatible with Pyodide.")
+ (license license:bsd-3)))
+
(define-public python-structlog
(package
(name "python-structlog")
--
2.38.1
F
F
Felix Gruber wrote on 15 Jan 2023 22:51
[PATCH 2/8] gnu: Add python-sqlite-fts4.
(address . 60838@debbugs.gnu.org)(name . Felix Gruber)(address . felgru@posteo.net)
20230115215132.25199-1-felgru@posteo.net
* gnu/packages/databases.scm (python-sqlite-fts4): New variable.
---
gnu/packages/databases.scm | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)

Toggle diff (31 lines)
diff --git a/gnu/packages/databases.scm b/gnu/packages/databases.scm
index 2a66efb2a0..375d34b051 100644
--- a/gnu/packages/databases.scm
+++ b/gnu/packages/databases.scm
@@ -3557,6 +3557,24 @@ (define-public python-alembic
SQLAlchemy Database Toolkit for Python.")
(license license:expat)))
+(define-public python-sqlite-fts4
+ (package
+ (name "python-sqlite-fts4")
+ (version "1.0.3")
+ (source (origin
+ (method url-fetch)
+ (uri (pypi-uri "sqlite-fts4" version))
+ (sha256
+ (base32
+ "034kx0ac556sywy1p4qcrc36l24w3q0xwswqv2z9s3k8yvm5xc3q"))))
+ (build-system python-build-system)
+ (native-inputs (list python-pytest))
+ (home-page "https://github.com/simonw/sqlite-fts4")
+ (synopsis "Python functions for working with SQLite FTS4 search")
+ (description "Custom SQLite functions written in Python for ranking
+documents indexed using the SQLite's FTS4 full text search extension.")
+ (license license:asl2.0)))
+
(define-public python-pickleshare
(package
(name "python-pickleshare")
--
2.38.1
F
F
Felix Gruber wrote on 15 Jan 2023 22:51
[PATCH 3/8] gnu: Add python-sqlite-utils.
(address . 60838@debbugs.gnu.org)(name . Felix Gruber)(address . felgru@posteo.net)
20230115215153.25235-1-felgru@posteo.net
* gnu/packages/databases.scm (python-sqlite-utils): New variable.
---
gnu/packages/databases.scm | 39 ++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)

Toggle diff (52 lines)
diff --git a/gnu/packages/databases.scm b/gnu/packages/databases.scm
index 375d34b051..9831a3b761 100644
--- a/gnu/packages/databases.scm
+++ b/gnu/packages/databases.scm
@@ -3575,6 +3575,45 @@ (define-public python-sqlite-fts4
documents indexed using the SQLite's FTS4 full text search extension.")
(license license:asl2.0)))
+(define-public python-sqlite-utils
+ (package
+ (name "python-sqlite-utils")
+ (version "3.30")
+ (source (origin
+ (method url-fetch)
+ (uri (pypi-uri "sqlite-utils" version))
+ (sha256
+ (base32
+ "0cvfbyvkh7gjh3ws3gj2yhjhr459nsz6c5vrkxjlad7isl95q01h"))))
+ (build-system python-build-system)
+ (arguments
+ '(#:tests? #f)) ; No tests provided in pypi package.
+ (propagated-inputs (list python-click python-click-default-group-wheel
+ python-dateutil python-sqlite-fts4
+ python-tabulate))
+ (home-page "https://github.com/simonw/sqlite-utils")
+ (synopsis
+ "CLI tool and Python utility functions for manipulating SQLite databases")
+ (description
+ "This package provides a CLI tool and Python utility functions for
+manipulating SQLite databases.
+
+It's main features are:
+@itemize
+@item Pipe JSON (or CSV or TSV) directly into a new SQLite database file,
+ automatically creating a table with the appropriate schema.
+@item Run in-memory SQL queries, including joins, directly against data
+ in CSV, TSV or JSON files and view the results.
+@item Configure SQLite full-text search against your database tables and
+ run search queries against them, ordered by relevance.
+@item Run transformations against your tables to make schema changes
+ that SQLite ALTER TABLE does not directly support, such as
+ changing the type of a column.
+@item Extract columns into separate tables to better normalize your
+ existing data.
+@end itemize")
+ (license license:asl2.0)))
+
(define-public python-pickleshare
(package
(name "python-pickleshare")
--
2.38.1
F
F
Felix Gruber wrote on 15 Jan 2023 22:52
[PATCH 4/8] gnu: python-janus: Update to 1.0.0.
(address . 60838@debbugs.gnu.org)(name . Felix Gruber)(address . felgru@posteo.net)
20230115215221.25274-1-felgru@posteo.net
* gnu/packages/python-xyz.scm (python-janus): Update to 1.0.0.
[propagated-inputs]: Add python-typing-extensions.
---
gnu/packages/python-xyz.scm | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

Toggle diff (31 lines)
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 1dbe9d611f..e614ffdf2b 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -291,13 +291,13 @@ (define-public python-xmldiff
(define-public python-janus
(package
(name "python-janus")
- (version "0.6.1")
+ (version "1.0.0")
(source
(origin
(method url-fetch)
(uri (pypi-uri "janus" version))
(sha256
- (base32 "030xvl2vghi5ispfalhvch1rl6i2jsy5bf1dgjafa7vifppy04j7"))))
+ (base32 "04hnrdcf03g1s0x3sr72sh9gnszz6kyfsl9dg8a4n0zvvhn6z5yz"))))
(build-system python-build-system)
(arguments
`(#:phases
@@ -307,6 +307,8 @@ (define-public python-janus
(when tests?
(add-installed-pythonpath inputs outputs)
(invoke "pytest" "--cov=janus" "--cov=tests")))))))
+ (propagated-inputs
+ (list python-typing-extensions))
(native-inputs
(list python-pytest python-pytest-cov python-pytest-asyncio))
(home-page "https://github.com/aio-libs/janus/")
--
2.38.1
F
F
Felix Gruber wrote on 15 Jan 2023 22:52
[PATCH 5/8] gnu: Add python-pluggy-next.
(address . 60838@debbugs.gnu.org)(name . Felix Gruber)(address . felgru@posteo.net)
20230115215241.25311-1-felgru@posteo.net
* gnu/packages/python-xyz.scm (python-pluggy-next): New variable.
---
gnu/packages/python-xyz.scm | 13 +++++++++++++
1 file changed, 13 insertions(+)

Toggle diff (26 lines)
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index e614ffdf2b..8ee6cee947 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -15287,6 +15287,19 @@ (define-public python-pluggy
(home-page "https://pypi.org/project/pluggy/")
(license license:expat)))
+;;; TODO: Make this the default python-pluggy in the next rebuild cycle.
+(define-public python-pluggy-next
+ (package
+ (inherit python-pluggy)
+ (version "1.0.0")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (pypi-uri "pluggy" version))
+ (sha256
+ (base32
+ "0n8iadlas2z1b4h0fc73b043c7iwfvx9rgvqm1azjmffmhxkf922"))))))
+
(define-public python-plumbum
(package
(name "python-plumbum")
--
2.38.1
F
F
Felix Gruber wrote on 15 Jan 2023 22:53
[PATCH 6/8] gnu: Add python-asgi-lifespan.
(address . 60838@debbugs.gnu.org)(name . Felix Gruber)(address . felgru@posteo.net)
20230115215303.25347-1-felgru@posteo.net
* gnu/packages/python-web.scm (python-asgi-lifespan): New variable.
---
gnu/packages/python-web.scm | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)

Toggle diff (45 lines)
diff --git a/gnu/packages/python-web.scm b/gnu/packages/python-web.scm
index 7daa1b636c..b6ea8f385d 100644
--- a/gnu/packages/python-web.scm
+++ b/gnu/packages/python-web.scm
@@ -49,7 +49,7 @@
;;; Copyright © 2021 Alice Brenon <alice.brenon@ens-lyon.fr>
;;; Copyright © 2022 John Kehayias <john.kehayias@protonmail.com>
;;; Copyright © 2022 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
-;;; Copyright © 2022 Felix Gruber <felgru@posteo.net>
+;;; Copyright © 2022, 2023 Felix Gruber <felgru@posteo.net>
;;; Copyright © 2022 Peter Polidoro <peter@polidoro.io>
;;; Copyright © 2022 Antero Mejr <antero@mailbox.org>
;;; Copyright © 2022 Luis Henrique Gomes Higino <luishenriquegh2701@gmail.com>
@@ -570,6 +570,29 @@ (define-public python-asgiref
WSGI. This package includes libraries for implementing ASGI servers.")
(license license:bsd-3)))
+(define-public python-asgi-lifespan
+ (package
+ (name "python-asgi-lifespan")
+ (version "1.0.1")
+ (source (origin
+ (method url-fetch)
+ (uri (pypi-uri "asgi-lifespan" version))
+ (sha256
+ (base32
+ "0zyvx8i43s1m2akqn5njwdh2zi6n05ji7mlvqx5pdi3k43dffcws"))))
+ (build-system python-build-system)
+ (arguments
+ '(#:tests? #f)) ; The pypi package does not contain the tests folder.
+ (native-inputs (list python-pytest python-pytest-asyncio python-pytest-cov))
+ (propagated-inputs (list python-sniffio))
+ (home-page "https://github.com/florimondmanca/asgi-lifespan")
+ (synopsis "Programmatic startup/shutdown of ASGI apps")
+ (description "Programmatically send startup/shutdown lifespan events
+into ASGI applications. When used in combination with an ASGI-capable
+HTTP client such as HTTPX, this allows mocking or testing ASGI
+applications without having to spin up an ASGI server.")
+ (license license:expat)))
+
(define-public python-css-html-js-minify
(package
(name "python-css-html-js-minify")
--
2.38.1
F
F
Felix Gruber wrote on 15 Jan 2023 22:53
[PATCH 7/8] gnu: Add python-asgi-csrf.
(address . 60838@debbugs.gnu.org)(name . Felix Gruber)(address . felgru@posteo.net)
20230115215330.25383-1-felgru@posteo.net
* gnu/packages/python-web.scm (python-asgi-csrf): New variable.
---
gnu/packages/python-web.scm | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)

Toggle diff (38 lines)
diff --git a/gnu/packages/python-web.scm b/gnu/packages/python-web.scm
index b6ea8f385d..ee6d8a9f59 100644
--- a/gnu/packages/python-web.scm
+++ b/gnu/packages/python-web.scm
@@ -570,6 +570,31 @@ (define-public python-asgiref
WSGI. This package includes libraries for implementing ASGI servers.")
(license license:bsd-3)))
+(define-public python-asgi-csrf
+ (package
+ (name "python-asgi-csrf")
+ (version "0.9")
+ (source (origin
+ (method url-fetch)
+ (uri (pypi-uri "asgi-csrf" version))
+ (sha256
+ (base32
+ "06klgxfxzjfkyjky3rkvmf2r07r7r2my53qq7g9qy6mcmvfkp7bf"))))
+ (build-system python-build-system)
+ (propagated-inputs (list python-itsdangerous python-multipart))
+ (native-inputs (list python-asgi-lifespan
+ python-httpx
+ python-pytest
+ python-pytest-asyncio
+ python-pytest-cov
+ python-starlette))
+ (home-page "https://github.com/simonw/asgi-csrf")
+ (synopsis "ASGI middleware for protecting against CSRF attacks")
+ (description "This middleware implements the Double Submit Cookie
+pattern, where a cookie is set that is then compared to a csrftoken
+hidden form field or a x-csrftoken HTTP header.")
+ (license license:asl2.0)))
+
(define-public python-asgi-lifespan
(package
(name "python-asgi-lifespan")
--
2.38.1
F
F
Felix Gruber wrote on 15 Jan 2023 22:53
[PATCH 8/8] gnu: Add datasette.
(address . 60838@debbugs.gnu.org)(name . Felix Gruber)(address . felgru@posteo.net)
20230115215347.25420-1-felgru@posteo.net
* gnu/packages/databases.scm (datasette): New variable.
---
gnu/packages/databases.scm | 47 ++++++++++++++++++++++++++++++++++++++
1 file changed, 47 insertions(+)

Toggle diff (64 lines)
diff --git a/gnu/packages/databases.scm b/gnu/packages/databases.scm
index 9831a3b761..4913d3a82e 100644
--- a/gnu/packages/databases.scm
+++ b/gnu/packages/databases.scm
@@ -59,6 +59,7 @@
;;; Copyright © 2022 muradm <mail@muradm.net>
;;; Copyright © 2022 Thomas Albers Raviola <thomas@thomaslabs.org>
;;; Copyright © 2021, 2022 jgart <jgart@dismail.de>
+;;; Copyright © 2023 Felix Gruber <felgru@posteo.net>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -5051,3 +5052,49 @@ (define-public python-dogpile.cache
provides API hooks which integrate these cache backends with the locking
mechanism of @code{dogpile}.")
(license license:expat)))
+
+(define-public datasette
+ (package
+ (name "datasette")
+ (version "0.64.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (pypi-uri "datasette" version))
+ (sha256
+ (base32
+ "1m8gr2rzap34cg8z7k3mrax373i3jc8fbpq73fxb602la5zc6c6a"))))
+ (build-system pyproject-build-system)
+ (arguments
+ (list
+ #:tests? #f ; pypi package contains no tests
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'loosen-requirements
+ (lambda _
+ ;; The package needlessly specifies exact versions
+ ;; of dependencies, when it works fine with others.
+ (substitute* "setup.py"
+ (("(black)==[0-9\\.]+" all package)
+ package)))))))
+ (propagated-inputs (list python-aiofiles
+ python-asgi-csrf
+ python-asgiref
+ python-click-7
+ python-click-default-group-wheel
+ python-httpx
+ python-hupper
+ python-itsdangerous
+ python-janus
+ python-jinja2
+ python-mergedeep
+ python-pint
+ python-pluggy-next
+ python-pyyaml
+ python-uvicorn))
+ (home-page "https://datasette.io/")
+ (synopsis "Multi-tool for exploring and publishing data")
+ (description "Datasette is a tool for exploring and publishing data.
+It helps people take data of any shape or size and publish that as an
+interactive, explorable website and accompanying API.")
+ (license license:asl2.0)))
--
2.38.1
F
F
Felix Gruber wrote on 17 Mar 2023 20:19
[PATCH v2 0/7] Add datasette and python-sqlite-utils.
(address . 60838@debbugs.gnu.org)(name . Felix Gruber)(address . felgru@posteo.net)
cover.1679080713.git.felgru@posteo.net
This new version of the patchset removes the commit to update
python-janus which has already been updated to 1.0.0 on master since I
originally sent my patches. It also updates datasette to its latest
upstream version 0.64.2.

Felix Gruber (7):
gnu: Add python-click-default-group-wheel.
gnu: Add python-sqlite-fts4.
gnu: Add python-sqlite-utils.
gnu: Add python-pluggy-next.
gnu: Add python-asgi-lifespan.
gnu: Add python-asgi-csrf.
gnu: Add datasette.

gnu/packages/databases.scm | 104 ++++++++++++++++++++++++++++++++++++
gnu/packages/python-web.scm | 50 ++++++++++++++++-
gnu/packages/python-xyz.scm | 39 +++++++++++++-
3 files changed, 191 insertions(+), 2 deletions(-)

--
2.39.2
F
F
Felix Gruber wrote on 17 Mar 2023 20:19
[PATCH v2 1/7] gnu: Add python-click-default-group-wheel.
(address . 60838@debbugs.gnu.org)(name . Felix Gruber)(address . felgru@posteo.net)
222e78a386c62560ee861bc1885fe650a4bb8330.1679080713.git.felgru@posteo.net
* gnu/packages/python-xyz.scm (python-click-default-group-wheel): New
variable.
---
gnu/packages/python-xyz.scm | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)

Toggle diff (46 lines)
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 7c8b3b3378..a6bd592837 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -108,7 +108,7 @@
;;; Copyright © 2021 Simon Streit <simon@netpanic.org>
;;; Copyright © 2021 Daniel Meißner <daniel.meissner-i4k@ruhr-uni-bochum.de>
;;; Copyright © 2021, 2022 Pradana Aumars <paumars@courrier.dev>
-;;; Copyright © 2021, 2022 Felix Gruber <felgru@posteo.net>
+;;; Copyright © 2021, 2022, 2023 Felix Gruber <felgru@posteo.net>
;;; Copyright © 2021 Sébastien Lerique <sl@eauchat.org>
;;; Copyright © 2021 Raphaël Mélotte <raphael.melotte@mind.be>
;;; Copyright © 2021 ZmnSCPxj <ZmnSCPxj@protonmail.com>
@@ -14892,6 +14892,30 @@ (define-public python-click-default-group
(home-page "https://github.com/click-contrib/click-default-group")
(license license:bsd-3)))
+(define-public python-click-default-group-wheel
+ ;; Fork of python-click-default-group used by sqlite-utils and datasette.
+ ;; See https://github.com/click-contrib/click-default-group/issues/21
+ (package
+ (name "python-click-default-group-wheel")
+ (version "1.2.2")
+ (source (origin
+ (method url-fetch)
+ (uri (pypi-uri "click-default-group-wheel" version))
+ (sha256
+ (base32
+ "0ivpdng2391v8afd5j1xdv9vbbr9iafbdh6h5shqhgn0j8ns83g9"))))
+ (build-system python-build-system)
+ (arguments
+ '(#:tests? #f)) ; no tests in pypi package
+ (propagated-inputs (list python-click))
+ (home-page "https://github.com/sublee/click-default-group/")
+ (synopsis
+ "Extends click.Group to invoke a command without explicit subcommand name")
+ (description
+ "This package provides click-default-group with an additional pure
+Python wheel package, compatible with Pyodide.")
+ (license license:bsd-3)))
+
(define-public python-structlog
(package
(name "python-structlog")
--
2.39.2
F
F
Felix Gruber wrote on 17 Mar 2023 20:19
[PATCH v2 2/7] gnu: Add python-sqlite-fts4.
(address . 60838@debbugs.gnu.org)(name . Felix Gruber)(address . felgru@posteo.net)
7917d12abffb8e6e67b631a5787bce4d3c0e4e05.1679080713.git.felgru@posteo.net
* gnu/packages/databases.scm (python-sqlite-fts4): New variable.
---
gnu/packages/databases.scm | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)

Toggle diff (31 lines)
diff --git a/gnu/packages/databases.scm b/gnu/packages/databases.scm
index c24d067bb0..580359145e 100644
--- a/gnu/packages/databases.scm
+++ b/gnu/packages/databases.scm
@@ -3555,6 +3555,24 @@ (define-public python-alembic
SQLAlchemy Database Toolkit for Python.")
(license license:expat)))
+(define-public python-sqlite-fts4
+ (package
+ (name "python-sqlite-fts4")
+ (version "1.0.3")
+ (source (origin
+ (method url-fetch)
+ (uri (pypi-uri "sqlite-fts4" version))
+ (sha256
+ (base32
+ "034kx0ac556sywy1p4qcrc36l24w3q0xwswqv2z9s3k8yvm5xc3q"))))
+ (build-system python-build-system)
+ (native-inputs (list python-pytest))
+ (home-page "https://github.com/simonw/sqlite-fts4")
+ (synopsis "Python functions for working with SQLite FTS4 search")
+ (description "Custom SQLite functions written in Python for ranking
+documents indexed using the SQLite's FTS4 full text search extension.")
+ (license license:asl2.0)))
+
(define-public python-pickleshare
(package
(name "python-pickleshare")
--
2.39.2
F
F
Felix Gruber wrote on 17 Mar 2023 20:19
[PATCH v2 3/7] gnu: Add python-sqlite-utils.
(address . 60838@debbugs.gnu.org)(name . Felix Gruber)(address . felgru@posteo.net)
9e1061808f9f7d509168063b67ff119f42c149f3.1679080713.git.felgru@posteo.net
* gnu/packages/databases.scm (python-sqlite-utils): New variable.
---
gnu/packages/databases.scm | 39 ++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)

Toggle diff (52 lines)
diff --git a/gnu/packages/databases.scm b/gnu/packages/databases.scm
index 580359145e..d9ea2bba34 100644
--- a/gnu/packages/databases.scm
+++ b/gnu/packages/databases.scm
@@ -3573,6 +3573,45 @@ (define-public python-sqlite-fts4
documents indexed using the SQLite's FTS4 full text search extension.")
(license license:asl2.0)))
+(define-public python-sqlite-utils
+ (package
+ (name "python-sqlite-utils")
+ (version "3.30")
+ (source (origin
+ (method url-fetch)
+ (uri (pypi-uri "sqlite-utils" version))
+ (sha256
+ (base32
+ "0cvfbyvkh7gjh3ws3gj2yhjhr459nsz6c5vrkxjlad7isl95q01h"))))
+ (build-system python-build-system)
+ (arguments
+ '(#:tests? #f)) ; No tests provided in pypi package.
+ (propagated-inputs (list python-click python-click-default-group-wheel
+ python-dateutil python-sqlite-fts4
+ python-tabulate))
+ (home-page "https://github.com/simonw/sqlite-utils")
+ (synopsis
+ "CLI tool and Python utility functions for manipulating SQLite databases")
+ (description
+ "This package provides a CLI tool and Python utility functions for
+manipulating SQLite databases.
+
+It's main features are:
+@itemize
+@item Pipe JSON (or CSV or TSV) directly into a new SQLite database file,
+ automatically creating a table with the appropriate schema.
+@item Run in-memory SQL queries, including joins, directly against data
+ in CSV, TSV or JSON files and view the results.
+@item Configure SQLite full-text search against your database tables and
+ run search queries against them, ordered by relevance.
+@item Run transformations against your tables to make schema changes
+ that SQLite ALTER TABLE does not directly support, such as
+ changing the type of a column.
+@item Extract columns into separate tables to better normalize your
+ existing data.
+@end itemize")
+ (license license:asl2.0)))
+
(define-public python-pickleshare
(package
(name "python-pickleshare")
--
2.39.2
F
F
Felix Gruber wrote on 17 Mar 2023 20:19
[PATCH v2 4/7] gnu: Add python-pluggy-next.
(address . 60838@debbugs.gnu.org)(name . Felix Gruber)(address . felgru@posteo.net)
51068734c3ad24fcfeb8062995487aa47e54ec86.1679080713.git.felgru@posteo.net
* gnu/packages/python-xyz.scm (python-pluggy-next): New variable.
---
gnu/packages/python-xyz.scm | 13 +++++++++++++
1 file changed, 13 insertions(+)

Toggle diff (26 lines)
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index a6bd592837..af1799591e 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -15408,6 +15408,19 @@ (define-public python-pluggy
(home-page "https://pypi.org/project/pluggy/")
(license license:expat)))
+;;; TODO: Make this the default python-pluggy in the next rebuild cycle.
+(define-public python-pluggy-next
+ (package
+ (inherit python-pluggy)
+ (version "1.0.0")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (pypi-uri "pluggy" version))
+ (sha256
+ (base32
+ "0n8iadlas2z1b4h0fc73b043c7iwfvx9rgvqm1azjmffmhxkf922"))))))
+
(define-public python-plumbum
(package
(name "python-plumbum")
--
2.39.2
F
F
Felix Gruber wrote on 17 Mar 2023 20:19
[PATCH v2 5/7] gnu: Add python-asgi-lifespan.
(address . 60838@debbugs.gnu.org)(name . Felix Gruber)(address . felgru@posteo.net)
c020eb5bb722890dacc3c27bf4b9f388434352ab.1679080713.git.felgru@posteo.net
* gnu/packages/python-web.scm (python-asgi-lifespan): New variable.
---
gnu/packages/python-web.scm | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)

Toggle diff (45 lines)
diff --git a/gnu/packages/python-web.scm b/gnu/packages/python-web.scm
index 8a73c929a1..83e7d77da8 100644
--- a/gnu/packages/python-web.scm
+++ b/gnu/packages/python-web.scm
@@ -49,7 +49,7 @@
;;; Copyright © 2021 Alice Brenon <alice.brenon@ens-lyon.fr>
;;; Copyright © 2022 John Kehayias <john.kehayias@protonmail.com>
;;; Copyright © 2022 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
-;;; Copyright © 2022 Felix Gruber <felgru@posteo.net>
+;;; Copyright © 2022, 2023 Felix Gruber <felgru@posteo.net>
;;; Copyright © 2022 Peter Polidoro <peter@polidoro.io>
;;; Copyright © 2022 Antero Mejr <antero@mailbox.org>
;;; Copyright © 2022 Luis Henrique Gomes Higino <luishenriquegh2701@gmail.com>
@@ -570,6 +570,29 @@ (define-public python-asgiref
WSGI. This package includes libraries for implementing ASGI servers.")
(license license:bsd-3)))
+(define-public python-asgi-lifespan
+ (package
+ (name "python-asgi-lifespan")
+ (version "1.0.1")
+ (source (origin
+ (method url-fetch)
+ (uri (pypi-uri "asgi-lifespan" version))
+ (sha256
+ (base32
+ "0zyvx8i43s1m2akqn5njwdh2zi6n05ji7mlvqx5pdi3k43dffcws"))))
+ (build-system python-build-system)
+ (arguments
+ '(#:tests? #f)) ; The pypi package does not contain the tests folder.
+ (native-inputs (list python-pytest python-pytest-asyncio python-pytest-cov))
+ (propagated-inputs (list python-sniffio))
+ (home-page "https://github.com/florimondmanca/asgi-lifespan")
+ (synopsis "Programmatic startup/shutdown of ASGI apps")
+ (description "Programmatically send startup/shutdown lifespan events
+into ASGI applications. When used in combination with an ASGI-capable
+HTTP client such as HTTPX, this allows mocking or testing ASGI
+applications without having to spin up an ASGI server.")
+ (license license:expat)))
+
(define-public python-css-html-js-minify
(package
(name "python-css-html-js-minify")
--
2.39.2
F
F
Felix Gruber wrote on 17 Mar 2023 20:19
[PATCH v2 6/7] gnu: Add python-asgi-csrf.
(address . 60838@debbugs.gnu.org)(name . Felix Gruber)(address . felgru@posteo.net)
1d28cdf8dfc8a8d9b9f593ef8efcdbe92c68f355.1679080713.git.felgru@posteo.net
* gnu/packages/python-web.scm (python-asgi-csrf): New variable.
---
gnu/packages/python-web.scm | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)

Toggle diff (38 lines)
diff --git a/gnu/packages/python-web.scm b/gnu/packages/python-web.scm
index 83e7d77da8..8c172d64c9 100644
--- a/gnu/packages/python-web.scm
+++ b/gnu/packages/python-web.scm
@@ -570,6 +570,31 @@ (define-public python-asgiref
WSGI. This package includes libraries for implementing ASGI servers.")
(license license:bsd-3)))
+(define-public python-asgi-csrf
+ (package
+ (name "python-asgi-csrf")
+ (version "0.9")
+ (source (origin
+ (method url-fetch)
+ (uri (pypi-uri "asgi-csrf" version))
+ (sha256
+ (base32
+ "06klgxfxzjfkyjky3rkvmf2r07r7r2my53qq7g9qy6mcmvfkp7bf"))))
+ (build-system python-build-system)
+ (propagated-inputs (list python-itsdangerous python-multipart))
+ (native-inputs (list python-asgi-lifespan
+ python-httpx
+ python-pytest
+ python-pytest-asyncio
+ python-pytest-cov
+ python-starlette))
+ (home-page "https://github.com/simonw/asgi-csrf")
+ (synopsis "ASGI middleware for protecting against CSRF attacks")
+ (description "This middleware implements the Double Submit Cookie
+pattern, where a cookie is set that is then compared to a csrftoken
+hidden form field or a x-csrftoken HTTP header.")
+ (license license:asl2.0)))
+
(define-public python-asgi-lifespan
(package
(name "python-asgi-lifespan")
--
2.39.2
F
F
Felix Gruber wrote on 17 Mar 2023 20:19
[PATCH v2 7/7] gnu: Add datasette.
(address . 60838@debbugs.gnu.org)(name . Felix Gruber)(address . felgru@posteo.net)
0b8c873370cb71654009b5ea1d876d721b4cf02b.1679080713.git.felgru@posteo.net
* gnu/packages/databases.scm (datasette): New variable.
---
gnu/packages/databases.scm | 47 ++++++++++++++++++++++++++++++++++++++
1 file changed, 47 insertions(+)

Toggle diff (64 lines)
diff --git a/gnu/packages/databases.scm b/gnu/packages/databases.scm
index d9ea2bba34..72960396fc 100644
--- a/gnu/packages/databases.scm
+++ b/gnu/packages/databases.scm
@@ -59,6 +59,7 @@
;;; Copyright © 2022 muradm <mail@muradm.net>
;;; Copyright © 2022 Thomas Albers Raviola <thomas@thomaslabs.org>
;;; Copyright © 2021, 2022 jgart <jgart@dismail.de>
+;;; Copyright © 2023 Felix Gruber <felgru@posteo.net>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -5049,3 +5050,49 @@ (define-public python-dogpile.cache
provides API hooks which integrate these cache backends with the locking
mechanism of @code{dogpile}.")
(license license:expat)))
+
+(define-public datasette
+ (package
+ (name "datasette")
+ (version "0.64.2")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (pypi-uri "datasette" version))
+ (sha256
+ (base32
+ "1z2qwj7gmyph4dnbr44p332f9ydpv7c4z5jiyai12bmgsgdnxqg9"))))
+ (build-system pyproject-build-system)
+ (arguments
+ (list
+ #:tests? #f ; pypi package contains no tests
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'loosen-requirements
+ (lambda _
+ ;; The package needlessly specifies exact versions
+ ;; of dependencies, when it works fine with others.
+ (substitute* "setup.py"
+ (("(black)==[0-9\\.]+" all package)
+ package)))))))
+ (propagated-inputs (list python-aiofiles
+ python-asgi-csrf
+ python-asgiref
+ python-click-7
+ python-click-default-group-wheel
+ python-httpx
+ python-hupper
+ python-itsdangerous
+ python-janus
+ python-jinja2
+ python-mergedeep
+ python-pint
+ python-pluggy-next
+ python-pyyaml
+ python-uvicorn))
+ (home-page "https://datasette.io/")
+ (synopsis "Multi-tool for exploring and publishing data")
+ (description "Datasette is a tool for exploring and publishing data.
+It helps people take data of any shape or size and publish that as an
+interactive, explorable website and accompanying API.")
+ (license license:asl2.0)))
--
2.39.2
L
L
Liliana Marie Prikler wrote on 18 Mar 2023 09:13
Re: [PATCH v2 0/7] Add datasette and python-sqlite-utils.
971ad04e28bc418b08d4a6c2b50725a741a07079.camel@gmail.com
Hi Felix,

Am Freitag, dem 17.03.2023 um 19:19 +0000 schrieb Felix Gruber:
Toggle quote (13 lines)
> This new version of the patchset removes the commit to update
> python-janus which has already been updated to 1.0.0 on master since
> I originally sent my patches. It also updates datasette to its latest
> upstream version 0.64.2.
>
> Felix Gruber (7):
>   gnu: Add python-click-default-group-wheel.
>   gnu: Add python-sqlite-fts4.
>   gnu: Add python-sqlite-utils.
>   gnu: Add python-pluggy-next.
>   gnu: Add python-asgi-lifespan.
>   gnu: Add python-asgi-csrf.
>   gnu: Add datasette.
Unless someone wants to do this first, I'll schedule this for
upstreaming on April 2nd. Why the long delay? I have my own series
depending on pluggy-next coming up and it'll require standard review
time.

Cheers
M
M
Maxim Cournoyer wrote on 22 Mar 2023 01:59
Re: bug#60838: [PATCH 0/8] Add datasette and python-sqlite-utils.
(name . Felix Gruber)(address . felgru@posteo.net)(address . 60838@debbugs.gnu.org)
87lejplhxd.fsf@gmail.com
Hi Felix,

Felix Gruber <felgru@posteo.net> writes:

Toggle quote (7 lines)
> This patchset adds new packages for the database exploration and
> manipulation tools datasette and sqlite-utils, as well as some missing
> dependencies of those two packages.
>
> Since datasette and sqlite-utils do not contain any tests in their pypi
> source archives [...]

This happens frequently for the PyPI source archives; I'd recommend
switching to git as automated tests are really worth to preserve the
package longer term. Could you look into enabling the test suite by
checking out the projects source from git? The pyproject-build-system
would probably make your life easy then (it knows to run pytest if it's
in the native-inputs, for example).

--
Thanks,
Maxim
M
M
Maxim Cournoyer wrote on 22 Mar 2023 02:04
(name . Felix Gruber)(address . felgru@posteo.net)(address . 60838@debbugs.gnu.org)
87h6udlhpl.fsf_-_@gmail.com
Hi,

Felix Gruber <felgru@posteo.net> writes:

Toggle quote (43 lines)
> * gnu/packages/python-xyz.scm (python-click-default-group-wheel): New
> variable.
> ---
> gnu/packages/python-xyz.scm | 26 +++++++++++++++++++++++++-
> 1 file changed, 25 insertions(+), 1 deletion(-)
>
> diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
> index c91561e787..1dbe9d611f 100644
> --- a/gnu/packages/python-xyz.scm
> +++ b/gnu/packages/python-xyz.scm
> @@ -108,7 +108,7 @@
> ;;; Copyright © 2021 Simon Streit <simon@netpanic.org>
> ;;; Copyright © 2021 Daniel Meißner <daniel.meissner-i4k@ruhr-uni-bochum.de>
> ;;; Copyright © 2021, 2022 Pradana Aumars <paumars@courrier.dev>
> -;;; Copyright © 2021, 2022 Felix Gruber <felgru@posteo.net>
> +;;; Copyright © 2021, 2022, 2023 Felix Gruber <felgru@posteo.net>
> ;;; Copyright © 2021 Sébastien Lerique <sl@eauchat.org>
> ;;; Copyright © 2021 Raphaël Mélotte <raphael.melotte@mind.be>
> ;;; Copyright © 2021 ZmnSCPxj <ZmnSCPxj@protonmail.com>
> @@ -14769,6 +14769,30 @@ (define-public python-click-default-group
> (home-page "https://github.com/click-contrib/click-default-group")
> (license license:bsd-3)))
>
> +(define-public python-click-default-group-wheel
> + ;; Fork of python-click-default-group used by sqlite-utils and datasette.
> + ;; See https://github.com/click-contrib/click-default-group/issues/21
> + (package
> + (name "python-click-default-group-wheel")
> + (version "1.2.2")
> + (source (origin
> + (method url-fetch)
> + (uri (pypi-uri "click-default-group-wheel" version))
> + (sha256
> + (base32
> + "0ivpdng2391v8afd5j1xdv9vbbr9iafbdh6h5shqhgn0j8ns83g9"))))
> + (build-system python-build-system)
> + (arguments
> + '(#:tests? #f)) ; no tests in pypi package
> + (propagated-inputs (list python-click))
> + (home-page "https://github.com/sublee/click-default-group/")
> + (synopsis
> + "Extends click.Group to invoke a command without explicit subcommand name")

I'd try to make the synopsis read more like a synthesized version of
what this package *is*; it currently reads almost as a complete
sentence. Perhaps something like: "Python extension for the
@code{click.Group} class".

Toggle quote (4 lines)
> + (description
> + "This package provides click-default-group with an additional pure
> +Python wheel package, compatible with Pyodide.")

"additional pure Python wheel package" doesn't add mean/add much in my
opinion. Based on the README.md content I'd use instead: "DefaultGroup
is a subclass of code{click.Group}, which invokes a default sub-command
instead of showing a help message when a sub-command is not passed."

--
Thanks,
Maxim
M
M
Maxim Cournoyer wrote on 22 Mar 2023 02:05
(name . Felix Gruber)(address . felgru@posteo.net)(address . 60838@debbugs.gnu.org)
87cz51lhnw.fsf_-_@gmail.com
Felix Gruber <felgru@posteo.net> writes:

Toggle quote (29 lines)
> * gnu/packages/databases.scm (python-sqlite-fts4): New variable.
> ---
> gnu/packages/databases.scm | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
> diff --git a/gnu/packages/databases.scm b/gnu/packages/databases.scm
> index 2a66efb2a0..375d34b051 100644
> --- a/gnu/packages/databases.scm
> +++ b/gnu/packages/databases.scm
> @@ -3557,6 +3557,24 @@ (define-public python-alembic
> SQLAlchemy Database Toolkit for Python.")
> (license license:expat)))
>
> +(define-public python-sqlite-fts4
> + (package
> + (name "python-sqlite-fts4")
> + (version "1.0.3")
> + (source (origin
> + (method url-fetch)
> + (uri (pypi-uri "sqlite-fts4" version))
> + (sha256
> + (base32
> + "034kx0ac556sywy1p4qcrc36l24w3q0xwswqv2z9s3k8yvm5xc3q"))))
> + (build-system python-build-system)
> + (native-inputs (list python-pytest))
> + (home-page "https://github.com/simonw/sqlite-fts4")
> + (synopsis "Python functions for working with SQLite FTS4 search")
> + (description "Custom SQLite functions written in Python for ranking

I'd start the description with "This package provides custom [...]", to
make it a complete sentence.

--
Thanks,
Maxim
M
M
Maxim Cournoyer wrote on 22 Mar 2023 02:08
(name . Felix Gruber)(address . felgru@posteo.net)(address . 60838@debbugs.gnu.org)
878rfplhiu.fsf_-_@gmail.com
Hi,

Felix Gruber <felgru@posteo.net> writes:

Toggle quote (27 lines)
> * gnu/packages/databases.scm (python-sqlite-utils): New variable.
> ---
> gnu/packages/databases.scm | 39 ++++++++++++++++++++++++++++++++++++++
> 1 file changed, 39 insertions(+)
>
> diff --git a/gnu/packages/databases.scm b/gnu/packages/databases.scm
> index 375d34b051..9831a3b761 100644
> --- a/gnu/packages/databases.scm
> +++ b/gnu/packages/databases.scm
> @@ -3575,6 +3575,45 @@ (define-public python-sqlite-fts4
> documents indexed using the SQLite's FTS4 full text search extension.")
> (license license:asl2.0)))
>
> +(define-public python-sqlite-utils
> + (package
> + (name "python-sqlite-utils")
> + (version "3.30")
> + (source (origin
> + (method url-fetch)
> + (uri (pypi-uri "sqlite-utils" version))
> + (sha256
> + (base32
> + "0cvfbyvkh7gjh3ws3gj2yhjhr459nsz6c5vrkxjlad7isl95q01h"))))
> + (build-system python-build-system)
> + (arguments
> + '(#:tests? #f)) ; No tests provided in pypi package.

Try fetching the source from git to enable the test suite.

Toggle quote (26 lines)
> + (propagated-inputs (list python-click python-click-default-group-wheel
> + python-dateutil python-sqlite-fts4
> + python-tabulate))
> + (home-page "https://github.com/simonw/sqlite-utils")
> + (synopsis
> + "CLI tool and Python utility functions for manipulating SQLite databases")
> + (description
> + "This package provides a CLI tool and Python utility functions for
> +manipulating SQLite databases.
> +
> +It's main features are:
> +@itemize
> +@item Pipe JSON (or CSV or TSV) directly into a new SQLite database file,
> + automatically creating a table with the appropriate schema.
> +@item Run in-memory SQL queries, including joins, directly against data
> + in CSV, TSV or JSON files and view the results.
> +@item Configure SQLite full-text search against your database tables and
> + run search queries against them, ordered by relevance.
> +@item Run transformations against your tables to make schema changes
> + that SQLite ALTER TABLE does not directly support, such as
> + changing the type of a column.
> +@item Extract columns into separate tables to better normalize your
> + existing data.
> +@end itemize")
> + (license license:asl2.0)))

I think the conventional way to indent @item is to use something like:

Toggle snippet (10 lines)
@item
Text on
multiple lines.
@item
More text
on multiple lines.
@item
etc.

--
Thanks,
Maxim
M
M
Maxim Cournoyer wrote on 22 Mar 2023 02:13
(name . Felix Gruber)(address . felgru@posteo.net)(address . 60838@debbugs.gnu.org)
874jqdlh9w.fsf_-_@gmail.com
Hi,

Felix Gruber <felgru@posteo.net> writes:

Toggle quote (30 lines)
> * gnu/packages/python-xyz.scm (python-pluggy-next): New variable.
> ---
> gnu/packages/python-xyz.scm | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
> index a6bd592837..af1799591e 100644
> --- a/gnu/packages/python-xyz.scm
> +++ b/gnu/packages/python-xyz.scm
> @@ -15408,6 +15408,19 @@ (define-public python-pluggy
> (home-page "https://pypi.org/project/pluggy/")
> (license license:expat)))
>
> +;;; TODO: Make this the default python-pluggy in the next rebuild cycle.
> +(define-public python-pluggy-next
> + (package
> + (inherit python-pluggy)
> + (version "1.0.0")
> + (source
> + (origin
> + (method url-fetch)
> + (uri (pypi-uri "pluggy" version))
> + (sha256
> + (base32
> + "0n8iadlas2z1b4h0fc73b043c7iwfvx9rgvqm1azjmffmhxkf922"))))))
> +
> (define-public python-plumbum
> (package
> (name "python-plumbum")

I'll install this one to master in a moment.

--
Thanks,
Maxim
M
M
Maxim Cournoyer wrote on 22 Mar 2023 02:17
(name . Felix Gruber)(address . felgru@posteo.net)(address . 60838@debbugs.gnu.org)
87zg85k2j1.fsf_-_@gmail.com
Hi,

Felix Gruber <felgru@posteo.net> writes:

Toggle quote (34 lines)
> * gnu/packages/python-web.scm (python-asgi-lifespan): New variable.
> ---
> gnu/packages/python-web.scm | 25 ++++++++++++++++++++++++-
> 1 file changed, 24 insertions(+), 1 deletion(-)
>
> diff --git a/gnu/packages/python-web.scm b/gnu/packages/python-web.scm
> index 8a73c929a1..83e7d77da8 100644
> --- a/gnu/packages/python-web.scm
> +++ b/gnu/packages/python-web.scm
> @@ -49,7 +49,7 @@
> ;;; Copyright © 2021 Alice Brenon <alice.brenon@ens-lyon.fr>
> ;;; Copyright © 2022 John Kehayias <john.kehayias@protonmail.com>
> ;;; Copyright © 2022 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
> -;;; Copyright © 2022 Felix Gruber <felgru@posteo.net>
> +;;; Copyright © 2022, 2023 Felix Gruber <felgru@posteo.net>
> ;;; Copyright © 2022 Peter Polidoro <peter@polidoro.io>
> ;;; Copyright © 2022 Antero Mejr <antero@mailbox.org>
> ;;; Copyright © 2022 Luis Henrique Gomes Higino <luishenriquegh2701@gmail.com>
> @@ -570,6 +570,29 @@ (define-public python-asgiref
> WSGI. This package includes libraries for implementing ASGI servers.")
> (license license:bsd-3)))
>
> +(define-public python-asgi-lifespan
> + (package
> + (name "python-asgi-lifespan")
> + (version "1.0.1")
> + (source (origin
> + (method url-fetch)
> + (uri (pypi-uri "asgi-lifespan" version))
> + (sha256
> + (base32
> + "0zyvx8i43s1m2akqn5njwdh2zi6n05ji7mlvqx5pdi3k43dffcws"))))
> + (build-system python-build-system)

To run pytest tests without having to override the check suite, you'll
want to use the pyproject-build-system.

Toggle quote (3 lines)
> + (arguments
> + '(#:tests? #f)) ; The pypi package does not contain the tests folder.

Please fetch from git to run the test suite. I typically leave a
comment ";for tests" to the right of the (method git-fetch) line, to
explain why we deviate from the source archives.

Toggle quote (10 lines)
> + (native-inputs (list python-pytest python-pytest-asyncio python-pytest-cov))
> + (propagated-inputs (list python-sniffio))
> + (home-page "https://github.com/florimondmanca/asgi-lifespan")
> + (synopsis "Programmatic startup/shutdown of ASGI apps")
> + (description "Programmatically send startup/shutdown lifespan events
> +into ASGI applications. When used in combination with an ASGI-capable
> +HTTP client such as HTTPX, this allows mocking or testing ASGI
> +applications without having to spin up an ASGI server.")
> + (license license:expat)))

Please define the lesser known acronyms in the description, using for
example like in "into Asynchronous Server Gateway Interface (ASGI)
applications." or the Texinfo @acronym command.

--
Thanks,
Maxim
M
M
Maxim Cournoyer wrote on 22 Mar 2023 02:19
(name . Felix Gruber)(address . felgru@posteo.net)(address . 60838@debbugs.gnu.org)
87v8itk2fp.fsf_-_@gmail.com
Hi,

Felix Gruber <felgru@posteo.net> writes:

Toggle quote (38 lines)
> * gnu/packages/python-web.scm (python-asgi-csrf): New variable.
> ---
> gnu/packages/python-web.scm | 25 +++++++++++++++++++++++++
> 1 file changed, 25 insertions(+)
>
> diff --git a/gnu/packages/python-web.scm b/gnu/packages/python-web.scm
> index 83e7d77da8..8c172d64c9 100644
> --- a/gnu/packages/python-web.scm
> +++ b/gnu/packages/python-web.scm
> @@ -570,6 +570,31 @@ (define-public python-asgiref
> WSGI. This package includes libraries for implementing ASGI servers.")
> (license license:bsd-3)))
>
> +(define-public python-asgi-csrf
> + (package
> + (name "python-asgi-csrf")
> + (version "0.9")
> + (source (origin
> + (method url-fetch)
> + (uri (pypi-uri "asgi-csrf" version))
> + (sha256
> + (base32
> + "06klgxfxzjfkyjky3rkvmf2r07r7r2my53qq7g9qy6mcmvfkp7bf"))))
> + (build-system python-build-system)
> + (propagated-inputs (list python-itsdangerous python-multipart))
> + (native-inputs (list python-asgi-lifespan
> + python-httpx
> + python-pytest
> + python-pytest-asyncio
> + python-pytest-cov
> + python-starlette))
> + (home-page "https://github.com/simonw/asgi-csrf")
> + (synopsis "ASGI middleware for protecting against CSRF attacks")
> + (description "This middleware implements the Double Submit Cookie
> +pattern, where a cookie is set that is then compared to a csrftoken
> +hidden form field or a x-csrftoken HTTP header.")
> + (license license:asl2.0)))

Please define ASGI and CSRF in full, at least in the description.
I'd also adorn the 'csrftoken' and 'x-csrftoken' words with @code.

--
Thanks,
Maxim
M
M
Maxim Cournoyer wrote on 22 Mar 2023 02:26
(name . Felix Gruber)(address . felgru@posteo.net)(address . 60838@debbugs.gnu.org)
87r0thk251.fsf_-_@gmail.com
Hello,

Felix Gruber <felgru@posteo.net> writes:

Toggle quote (38 lines)
> * gnu/packages/databases.scm (datasette): New variable.
> ---
> gnu/packages/databases.scm | 47 ++++++++++++++++++++++++++++++++++++++
> 1 file changed, 47 insertions(+)
>
> diff --git a/gnu/packages/databases.scm b/gnu/packages/databases.scm
> index d9ea2bba34..72960396fc 100644
> --- a/gnu/packages/databases.scm
> +++ b/gnu/packages/databases.scm
> @@ -59,6 +59,7 @@
> ;;; Copyright © 2022 muradm <mail@muradm.net>
> ;;; Copyright © 2022 Thomas Albers Raviola <thomas@thomaslabs.org>
> ;;; Copyright © 2021, 2022 jgart <jgart@dismail.de>
> +;;; Copyright © 2023 Felix Gruber <felgru@posteo.net>
> ;;;
> ;;; This file is part of GNU Guix.
> ;;;
> @@ -5049,3 +5050,49 @@ (define-public python-dogpile.cache
> provides API hooks which integrate these cache backends with the locking
> mechanism of @code{dogpile}.")
> (license license:expat)))
> +
> +(define-public datasette
> + (package
> + (name "datasette")
> + (version "0.64.2")
> + (source
> + (origin
> + (method url-fetch)
> + (uri (pypi-uri "datasette" version))
> + (sha256
> + (base32
> + "1z2qwj7gmyph4dnbr44p332f9ydpv7c4z5jiyai12bmgsgdnxqg9"))))
> + (build-system pyproject-build-system)
> + (arguments
> + (list
> + #:tests? #f ; pypi package contains no tests

That's a lame excuse for disabling the test suite, in my opinion (and I
know it can be tempting to use it!) :-). Please fetch from git when
there are no tests in the sdist releases (which is increasingly common,
it seems).

Toggle quote (4 lines)
> + #:phases
> + #~(modify-phases %standard-phases
> + (add-after 'unpack 'loosen-requirements

Nitpick: I call these phases 'relax-requirements.

Toggle quote (7 lines)
> + (lambda _
> + ;; The package needlessly specifies exact versions
> + ;; of dependencies, when it works fine with others.
> + (substitute* "setup.py"
> + (("(black)==[0-9\\.]+" all package)
> + package)))))))

The above only affects the 'black' package, right? Since the 'all'
binding is not used, it can be set to '_' instead.

Toggle quote (22 lines)
> + (propagated-inputs (list python-aiofiles
> + python-asgi-csrf
> + python-asgiref
> + python-click-7
> + python-click-default-group-wheel
> + python-httpx
> + python-hupper
> + python-itsdangerous
> + python-janus
> + python-jinja2
> + python-mergedeep
> + python-pint
> + python-pluggy-next
> + python-pyyaml
> + python-uvicorn))
> + (home-page "https://datasette.io/")
> + (synopsis "Multi-tool for exploring and publishing data")
> + (description "Datasette is a tool for exploring and publishing data.
> +It helps people take data of any shape or size and publish that as an
> +interactive, explorable website and accompanying API.")
> + (license license:asl2.0)))

It otherwise looks very good! Apart from enabling the tests suite where
applicable, my comments are mostly cosmetic, so a v2 and we should be
good! Thank you for the contribution!

--
Maxim
F
F
Felix Gruber wrote on 26 Mar 2023 21:43
[PATCH v3 0/9] Add datasette and python-sqlite-utils.
(name . Felix Gruber)(address . felgru@posteo.net)
cover.1679859197.git.felgru@posteo.net
Hi Maxim,

Thank you for your review.
I've updated my patchset with your suggested changes. In particular,
I now fetch from Git to obtain the tests which were missing in the pypi
packages. I had to disable a few tests in python-asgi-lifespan and in
datasette because they were failing for no apparent reason.
I also had to update the python-pluggy dependency in the
python-pytest-7.1 package, because it was preventing datasette from
finding the newer python-pluggy version. I confirmed that all packages
that (transitively) depend on python-pytest-7.1 still successfully build
after that change.

Finally, I had to add two new packages python-trustme-next and
python-cogapp since they are used by datasettes tests.

Kind regards,
Felix

Felix Gruber (9):
gnu: Add python-click-default-group-wheel.
gnu: Add python-sqlite-fts4.
gnu: Add python-sqlite-utils.
gnu: Add python-asgi-lifespan.
gnu: Add python-asgi-csrf.
gnu: Add python-trustme-next.
gnu: Add python-cogapp.
gnu: python-pytest-7.1: Depend on python-pluggy-next.
gnu: Add datasette.

gnu/packages/check.scm | 6 +-
gnu/packages/databases.scm | 158 +++++++++++++++++++++++++++++++++
gnu/packages/python-crypto.scm | 15 ++++
gnu/packages/python-web.scm | 79 ++++++++++++++++-
gnu/packages/python-xyz.scm | 48 +++++++++-
5 files changed, 303 insertions(+), 3 deletions(-)

--
2.39.2
F
F
Felix Gruber wrote on 26 Mar 2023 21:43
[PATCH v3 1/9] gnu: Add python-click-default-group-wheel.
(name . Felix Gruber)(address . felgru@posteo.net)
2a7b8740b269e302ca20194e10eeeb763094b1cc.1679859197.git.felgru@posteo.net
* gnu/packages/python-xyz.scm (python-click-default-group-wheel): New
variable.
---
gnu/packages/python-xyz.scm | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)

Toggle diff (46 lines)
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 3f0005faa2..9240fad2e6 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -108,7 +108,7 @@
;;; Copyright © 2021 Simon Streit <simon@netpanic.org>
;;; Copyright © 2021 Daniel Meißner <daniel.meissner-i4k@ruhr-uni-bochum.de>
;;; Copyright © 2021, 2022 Pradana Aumars <paumars@courrier.dev>
-;;; Copyright © 2021, 2022 Felix Gruber <felgru@posteo.net>
+;;; Copyright © 2021, 2022, 2023 Felix Gruber <felgru@posteo.net>
;;; Copyright © 2021 Sébastien Lerique <sl@eauchat.org>
;;; Copyright © 2021 Raphaël Mélotte <raphael.melotte@mind.be>
;;; Copyright © 2021 ZmnSCPxj <ZmnSCPxj@protonmail.com>
@@ -14964,6 +14964,30 @@ (define-public python-click-default-group
(home-page "https://github.com/click-contrib/click-default-group")
(license license:bsd-3)))
+(define-public python-click-default-group-wheel
+ ;; Fork of python-click-default-group used by sqlite-utils and datasette.
+ ;; See https://github.com/click-contrib/click-default-group/issues/21
+ (package
+ (name "python-click-default-group-wheel")
+ (version "1.2.2")
+ (source (origin
+ (method url-fetch)
+ (uri (pypi-uri "click-default-group-wheel" version))
+ (sha256
+ (base32
+ "0ivpdng2391v8afd5j1xdv9vbbr9iafbdh6h5shqhgn0j8ns83g9"))))
+ (build-system python-build-system)
+ (arguments
+ '(#:tests? #f)) ; no tests in pypi package
+ (propagated-inputs (list python-click))
+ (home-page "https://github.com/sublee/click-default-group/")
+ (synopsis "Python extension for the @code{click.Group} class")
+ (description
+ "DefaultGroup is a subclass of @code{click.Group} which invokes a
+default sub-command instead of showing a help message when a sub-command
+is not passed.")
+ (license license:bsd-3)))
+
(define-public python-structlog
(package
(name "python-structlog")
--
2.39.2
F
F
Felix Gruber wrote on 26 Mar 2023 21:43
[PATCH v3 2/9] gnu: Add python-sqlite-fts4.
(name . Felix Gruber)(address . felgru@posteo.net)
ad4083aadbf27316fb4e07f2aa43678950cfdbca.1679859198.git.felgru@posteo.net
* gnu/packages/databases.scm (python-sqlite-fts4): New variable.
---
gnu/packages/databases.scm | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)

Toggle diff (32 lines)
diff --git a/gnu/packages/databases.scm b/gnu/packages/databases.scm
index e51ddd5bf2..7a5f62c0f4 100644
--- a/gnu/packages/databases.scm
+++ b/gnu/packages/databases.scm
@@ -3561,6 +3561,25 @@ (define-public python-alembic
SQLAlchemy Database Toolkit for Python.")
(license license:expat)))
+(define-public python-sqlite-fts4
+ (package
+ (name "python-sqlite-fts4")
+ (version "1.0.3")
+ (source (origin
+ (method url-fetch)
+ (uri (pypi-uri "sqlite-fts4" version))
+ (sha256
+ (base32
+ "034kx0ac556sywy1p4qcrc36l24w3q0xwswqv2z9s3k8yvm5xc3q"))))
+ (build-system python-build-system)
+ (native-inputs (list python-pytest))
+ (home-page "https://github.com/simonw/sqlite-fts4")
+ (synopsis "Python functions for working with SQLite FTS4 search")
+ (description "This package provieds custom SQLite functions written
+in Python for ranking documents indexed using the SQLite's FTS4 full
+text search extension.")
+ (license license:asl2.0)))
+
(define-public python-pickleshare
(package
(name "python-pickleshare")
--
2.39.2
F
F
Felix Gruber wrote on 26 Mar 2023 21:43
[PATCH v3 3/9] gnu: Add python-sqlite-utils.
(name . Felix Gruber)(address . felgru@posteo.net)
0b2239a7997f185f4cd411d3a5e3b1a7c67fd22a.1679859198.git.felgru@posteo.net
* gnu/packages/databases.scm (python-sqlite-utils): New variable.
---
gnu/packages/databases.scm | 46 ++++++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)

Toggle diff (59 lines)
diff --git a/gnu/packages/databases.scm b/gnu/packages/databases.scm
index 7a5f62c0f4..87fa24038f 100644
--- a/gnu/packages/databases.scm
+++ b/gnu/packages/databases.scm
@@ -3580,6 +3580,52 @@ (define-public python-sqlite-fts4
text search extension.")
(license license:asl2.0)))
+(define-public python-sqlite-utils
+ (package
+ (name "python-sqlite-utils")
+ (version "3.30")
+ (source (origin
+ (method git-fetch) ; for tests
+ (uri (git-reference
+ (url "https://github.com/simonw/sqlite-utils")
+ (commit version)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "1a58syvh5jp40vi5libsxkqy99z75kj4ckxqmylbhd342ppfy1wp"))))
+ (build-system pyproject-build-system)
+ (propagated-inputs (list python-click python-click-default-group-wheel
+ python-dateutil python-sqlite-fts4
+ python-tabulate))
+ (native-inputs (list python-pytest))
+ (home-page "https://github.com/simonw/sqlite-utils")
+ (synopsis
+ "CLI tool and Python utility functions for manipulating SQLite databases")
+ (description
+ "This package provides a CLI tool and Python utility functions for
+manipulating SQLite databases.
+
+It's main features are:
+@itemize
+@item
+Pipe JSON (or CSV or TSV) directly into a new SQLite database file,
+automatically creating a table with the appropriate schema.
+@item
+Run in-memory SQL queries, including joins, directly against data in
+CSV, TSV or JSON files and view the results.
+@item
+Configure SQLite full-text search against your database tables and run
+search queries against them, ordered by relevance.
+@item
+Run transformations against your tables to make schema changes that
+SQLite ALTER TABLE does not directly support, such as changing the type
+of a column.
+@item
+Extract columns into separate tables to better normalize your existing
+data.
+@end itemize")
+ (license license:asl2.0)))
+
(define-public python-pickleshare
(package
(name "python-pickleshare")
--
2.39.2
F
F
Felix Gruber wrote on 26 Mar 2023 21:43
[PATCH v3 4/9] gnu: Add python-asgi-lifespan.
(name . Felix Gruber)(address . felgru@posteo.net)
7bdf850412e50904cfb7071b5bf4cf2f1af625a7.1679859198.git.felgru@posteo.net
* gnu/packages/python-web.scm (python-asgi-lifespan): New variable.
---
gnu/packages/python-web.scm | 52 ++++++++++++++++++++++++++++++++++++-
1 file changed, 51 insertions(+), 1 deletion(-)

Toggle diff (72 lines)
diff --git a/gnu/packages/python-web.scm b/gnu/packages/python-web.scm
index 072d160c26..8e3f778919 100644
--- a/gnu/packages/python-web.scm
+++ b/gnu/packages/python-web.scm
@@ -49,7 +49,7 @@
;;; Copyright © 2021 Alice Brenon <alice.brenon@ens-lyon.fr>
;;; Copyright © 2022 John Kehayias <john.kehayias@protonmail.com>
;;; Copyright © 2022 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
-;;; Copyright © 2022 Felix Gruber <felgru@posteo.net>
+;;; Copyright © 2022, 2023 Felix Gruber <felgru@posteo.net>
;;; Copyright © 2022 Peter Polidoro <peter@polidoro.io>
;;; Copyright © 2022 Antero Mejr <antero@mailbox.org>
;;; Copyright © 2022 Luis Henrique Gomes Higino <luishenriquegh2701@gmail.com>
@@ -570,6 +570,56 @@ (define-public python-asgiref
WSGI. This package includes libraries for implementing ASGI servers.")
(license license:bsd-3)))
+(define-public python-asgi-lifespan
+ (package
+ (name "python-asgi-lifespan")
+ (version "1.0.1")
+ (source (origin
+ (method git-fetch) ; for tests
+ (uri (git-reference
+ (url "https://github.com/florimondmanca/asgi-lifespan")
+ (commit version)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "10a5ci9ddr8wnjf3wai7xifbbplirhyrgvw4p28q0ha63cvhb2j2"))))
+ (build-system pyproject-build-system)
+ (arguments
+ (list
+ #:test-flags
+ ;; disable failing tests
+ '(list "-k"
+ (string-append
+ "not test_lifespan_manager[asyncio-None-ValueError-None]"
+ " and not test_lifespan_manager[asyncio-ValueError-None-None]"
+ " and not test_lifespan_manager[asyncio-ValueError-ValueError-None]"
+ " and not test_lifespan_manager[trio-None-ValueError-None]"
+ " and not test_lifespan_manager[trio-ValueError-None-None]"
+ " and not test_lifespan_manager[trio-ValueError-ValueError-None]"))
+ #:phases
+ '(modify-phases %standard-phases
+ (add-after 'unpack 'lower-coverage-requirement
+ ;; after disabling the failing tests, the coverage
+ ;; dropped slightly below 100%.
+ (lambda _
+ (substitute* "setup.cfg"
+ (("(--cov-fail-under=)[0-9]+" _ cov)
+ (string-append cov "90"))))))))
+ (native-inputs (list python-pytest
+ python-pytest-asyncio
+ python-pytest-cov
+ python-pytest-trio
+ python-starlette))
+ (propagated-inputs (list python-sniffio))
+ (home-page "https://github.com/florimondmanca/asgi-lifespan")
+ (synopsis "Programmatic startup/shutdown of ASGI apps")
+ (description "Programmatically send startup/shutdown lifespan events
+into Asynchronous Server Gateway Interface (ASGI) applications. When
+used in combination with an ASGI-capable HTTP client such as HTTPX, this
+allows mocking or testing ASGI applications without having to spin up an
+ASGI server.")
+ (license license:expat)))
+
(define-public python-css-html-js-minify
(package
(name "python-css-html-js-minify")
--
2.39.2
F
F
Felix Gruber wrote on 26 Mar 2023 21:43
[PATCH v3 5/9] gnu: Add python-asgi-csrf.
(name . Felix Gruber)(address . felgru@posteo.net)
89202a9f9b00356ff0f82bbb22084b8bbd11a4e5.1679859198.git.felgru@posteo.net
* gnu/packages/python-web.scm (python-asgi-csrf): New variable.
---
gnu/packages/python-web.scm | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)

Toggle diff (40 lines)
diff --git a/gnu/packages/python-web.scm b/gnu/packages/python-web.scm
index 8e3f778919..0be4078513 100644
--- a/gnu/packages/python-web.scm
+++ b/gnu/packages/python-web.scm
@@ -570,6 +570,33 @@ (define-public python-asgiref
WSGI. This package includes libraries for implementing ASGI servers.")
(license license:bsd-3)))
+(define-public python-asgi-csrf
+ (package
+ (name "python-asgi-csrf")
+ (version "0.9")
+ (source (origin
+ (method url-fetch)
+ (uri (pypi-uri "asgi-csrf" version))
+ (sha256
+ (base32
+ "06klgxfxzjfkyjky3rkvmf2r07r7r2my53qq7g9qy6mcmvfkp7bf"))))
+ (build-system python-build-system)
+ (propagated-inputs (list python-itsdangerous python-multipart))
+ (native-inputs (list python-asgi-lifespan
+ python-httpx
+ python-pytest
+ python-pytest-asyncio
+ python-pytest-cov
+ python-starlette))
+ (home-page "https://github.com/simonw/asgi-csrf")
+ (synopsis "ASGI middleware for protecting against CSRF attacks")
+ (description "This Asynchronous Server Gateway Interface (ASGI)
+middleware protects against Cross-site request forgery (CSRF) attacks.
+It implements the Double Submit Cookie pattern, where a cookie is set
+that is then compared to a @code{csrftoken} hidden form field or a
+@code{x-csrftoken} HTTP header.")
+ (license license:asl2.0)))
+
(define-public python-asgi-lifespan
(package
(name "python-asgi-lifespan")
--
2.39.2
F
F
Felix Gruber wrote on 26 Mar 2023 21:43
[PATCH v3 6/9] gnu: Add python-trustme-next.
(name . Felix Gruber)(address . felgru@posteo.net)
e20b4a5848c04549aba1a1d73e40e022f578e1f3.1679859198.git.felgru@posteo.net
* gnu/packages/python-crypto.scm (python-trustme-next): New variable.
---
gnu/packages/python-crypto.scm | 15 +++++++++++++++
1 file changed, 15 insertions(+)

Toggle diff (35 lines)
diff --git a/gnu/packages/python-crypto.scm b/gnu/packages/python-crypto.scm
index c9071c4cf6..134b59427d 100644
--- a/gnu/packages/python-crypto.scm
+++ b/gnu/packages/python-crypto.scm
@@ -27,6 +27,7 @@
;;; Copyright © 2021, 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
;;; Copyright © 2022 Antero Mejr <antero@mailbox.org>
+;;; Copyright © 2023 Felix Gruber <felgru@posteo.net>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -1536,6 +1537,20 @@ (define-public python-trustme
;; Either license applies.
(license (list license:expat license:asl2.0))))
+;;; TODO: Make this the default python-trustme in the next rebuild cycle.
+(define-public python-trustme-next
+ (package
+ (inherit python-trustme)
+ (version "0.9.0")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (pypi-uri "trustme" version))
+ (sha256
+ (base32 "0v2qzszmyazfgc1snicdr4b4qdajpjd4pbinpgrn9vfff0yv41sy"))))
+ (propagated-inputs
+ (list python-cryptography python-idna python-ipaddress))))
+
(define-public python-certipy
(package
(name "python-certipy")
--
2.39.2
F
F
Felix Gruber wrote on 26 Mar 2023 21:43
[PATCH v3 7/9] gnu: Add python-cogapp.
(name . Felix Gruber)(address . felgru@posteo.net)
2158579b7a9f6c745993ee26d7adee9a517aee61.1679859198.git.felgru@posteo.net
* gnu/packages/python-xyz.scm (python-cogapp): New variable.
---
gnu/packages/python-xyz.scm | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)

Toggle diff (35 lines)
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 9240fad2e6..391a75e341 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -31583,6 +31583,28 @@ (define-public python-geomet
versa. Extended WKB/WKT are also supported.")
(license license:asl2.0)))
+(define-public python-cogapp
+ (package
+ (name "python-cogapp")
+ (version "3.3.0")
+ (source (origin
+ (method url-fetch)
+ (uri (pypi-uri "cogapp" version))
+ (sha256
+ (base32
+ "1c0xx3p3lzrlyqhmccyq9c50f8v9pqk2992gb4nl50h2yy1m3s8v"))))
+ (build-system python-build-system)
+ (arguments
+ '(#:tests? #f))
+ (home-page "http://nedbatchelder.com/code/cog")
+ (synopsis
+ "Content generator for executing Python snippets in source files")
+ (description
+ "Cog is a file generation tool. It lets you use pieces of Python
+code as generators in your source files to generate whatever text you
+need.")
+ (license license:expat)))
+
(define-public python-bsdiff4
(package
(name "python-bsdiff4")
--
2.39.2
F
F
Felix Gruber wrote on 26 Mar 2023 21:43
[PATCH v3 8/9] gnu: python-pytest-7.1: Depend on python-pluggy-next.
(name . Felix Gruber)(address . felgru@posteo.net)
77ffe169da72ad2619e6089130ce53f36904a155.1679859198.git.felgru@posteo.net
* gnu/packages/check.scm (python-pytest-7.1)[propagated-inputs]: Replace
python-pluggy with python-pluggy-next.
---
gnu/packages/check.scm | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

Toggle diff (19 lines)
diff --git a/gnu/packages/check.scm b/gnu/packages/check.scm
index 0c8777a074..03b5828efc 100644
--- a/gnu/packages/check.scm
+++ b/gnu/packages/check.scm
@@ -1326,7 +1326,11 @@ (define-public python-pytest-7.1
#~(modify-phases #$phases
(add-before 'build 'pretend-version
(lambda _
- (setenv "SETUPTOOLS_SCM_PRETEND_VERSION" #$version)))))))))
+ (setenv "SETUPTOOLS_SCM_PRETEND_VERSION" #$version)))))))
+ (propagated-inputs
+ (modify-inputs (package-propagated-inputs python-pytest)
+ (replace "python-pluggy" python-pluggy-next)))
+ ))
(define-public python-pytest-bootstrap
(package
--
2.39.2
F
F
Felix Gruber wrote on 26 Mar 2023 21:43
[PATCH v3 9/9] gnu: Add datasette.
(name . Felix Gruber)(address . felgru@posteo.net)
312ccbf1d00faea30c2245385e557094ee68f1ad.1679859198.git.felgru@posteo.net
* gnu/packages/databases.scm (datasette): New variable.
---
gnu/packages/databases.scm | 93 ++++++++++++++++++++++++++++++++++++++
1 file changed, 93 insertions(+)

Toggle diff (110 lines)
diff --git a/gnu/packages/databases.scm b/gnu/packages/databases.scm
index 87fa24038f..86e45d8a1e 100644
--- a/gnu/packages/databases.scm
+++ b/gnu/packages/databases.scm
@@ -59,6 +59,7 @@
;;; Copyright © 2022 muradm <mail@muradm.net>
;;; Copyright © 2022 Thomas Albers Raviola <thomas@thomaslabs.org>
;;; Copyright © 2021, 2022 jgart <jgart@dismail.de>
+;;; Copyright © 2023 Felix Gruber <felgru@posteo.net>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -5084,3 +5085,95 @@ (define-public python-dogpile.cache
provides API hooks which integrate these cache backends with the locking
mechanism of @code{dogpile}.")
(license license:expat)))
+
+(define-public datasette
+ (package
+ (name "datasette")
+ (version "0.64.2")
+ (source (origin
+ (method git-fetch) ; for tests
+ (uri (git-reference
+ (url "https://github.com/simonw/datasette")
+ (commit version)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "1c8ajdaraynrjvsb8xxxnkb7zgm5fwq60qczaz00n465ki80j4h3"))))
+ (build-system pyproject-build-system)
+ (arguments
+ (list
+ #:test-flags
+ ;; disable failing tests
+ '(list
+ "--deselect"
+ "tests/test_api.py::test_database_page_for_database_with_dot_in_name"
+ "--deselect"
+ "tests/test_api.py::test_row_strange_table_name"
+ "--deselect"
+ "tests/test_api.py::test_database_with_space_in_name"
+ "--deselect"
+ "tests/test_api.py::test_tilde_encoded_database_names[fo%o]"
+ "--deselect"
+ "tests/test_api.py::test_tilde_encoded_database_names[f~/c.d]"
+ "--deselect"
+ "tests/test_cli.py::test_weird_database_names"
+ "--deselect"
+ "tests/test_html.py::test_css_classes_on_body[/fixtures/table~2Fwith~2Fslashes~2Ecsv-expected_classes5]"
+ "--deselect"
+ "tests/test_html.py::test_templates_considered[/fixtures/table~2Fwith~2Fslashes~2Ecsv-table-fixtures-tablewithslashescsv-fa7563.html, *table.html]"
+ "--deselect"
+ "tests/test_html.py::test_row_html_compound_primary_key[/fixtures/compound_primary_key/a~2Fb,~2Ec~2Dd-expected1]"
+ "--deselect"
+ "tests/test_html.py::test_edit_sql_link_on_canned_queries[/fixtures/~F0~9D~90~9C~F0~9D~90~A2~F0~9D~90~AD~F0~9D~90~A2~F0~9D~90~9E~F0~9D~90~AC-/fixtures?sql=select+id%2C+name+from+facet_cities+order+by+id+limit+1%3B]"
+ "--deselect"
+ "tests/test_html.py::test_alternate_url_json[/fixtures/table~2Fwith~2Fslashes~2Ecsv-http://localhost/fixtures/table~2Fwith~2Fslashes~2Ecsv.json]"
+ "--deselect"
+ "tests/test_table_api.py::test_table_with_slashes_in_name"
+ "--deselect"
+ "tests/test_table_api.py::test_searchable[/fixtures/searchable.json?_search=te*+AND+do*&_searchmode=raw-expected_rows3]"
+ "--deselect"
+ "tests/test_table_api.py::test_searchmode[table_metadata1-_search=te*+AND+do*-expected_rows1]"
+ "--deselect"
+ "tests/test_table_api.py::test_searchmode[table_metadata2-_search=te*+AND+do*&_searchmode=raw-expected_rows2]"
+ "--deselect"
+ "tests/test_table_api.py::test_custom_query_with_unicode_characters")
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'relax-requirements
+ (lambda _
+ ;; The package needlessly specifies exact versions
+ ;; of dependencies, when it works fine with others.
+ (substitute* "setup.py"
+ (("(black)==[0-9\\.]+" _ package)
+ package)))))))
+ (propagated-inputs (list python-aiofiles
+ python-asgi-csrf
+ python-asgiref
+ python-click
+ python-click-default-group-wheel
+ python-httpx
+ python-hupper
+ python-itsdangerous
+ python-janus
+ python-jinja2
+ python-mergedeep
+ python-pint
+ python-pluggy-next
+ python-pyyaml
+ python-uvicorn))
+ (native-inputs (list python-beautifulsoup4
+ python-black
+ python-cogapp
+ python-pytest-7.1
+ python-pytest-asyncio
+ python-pytest-runner
+ python-pytest-timeout
+ python-pytest-xdist-next
+ python-setuptools
+ python-trustme-next))
+ (home-page "https://datasette.io/")
+ (synopsis "Multi-tool for exploring and publishing data")
+ (description "Datasette is a tool for exploring and publishing data.
+It helps people take data of any shape or size and publish that as an
+interactive, explorable website and accompanying API.")
+ (license license:asl2.0)))
--
2.39.2
M
M
Maxim Cournoyer wrote on 29 Mar 2023 19:22
Re: bug#60838: [PATCH 0/8] Add datasette and python-sqlite-utils.
(name . Felix Gruber)(address . felgru@posteo.net)(address . 60838-done@debbugs.gnu.org)
87bkkb322k.fsf_-_@gmail.com
Hi Felix!

Thanks for the rework! I'm applied it locally, then looked at it more
closely; I ended up with the following changes, which I'll comment
inline below:

Toggle snippet (403 lines)
5 files changed, 105 insertions(+), 116 deletions(-)
gnu/packages/check.scm | 7 +++----
gnu/packages/databases.scm | 125 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------------------
gnu/packages/python-crypto.scm | 17 ++++++-----------
gnu/packages/python-web.scm | 56 +++++++++++++++++++++++++++++-------------------------
gnu/packages/python-xyz.scm | 16 ++++++----------

modified gnu/packages/check.scm
@@ -1322,15 +1322,14 @@ (define-public python-pytest-7.1
"0f8c31v5r2kgjixvy267n0nhc4xsy65g3n9lz1i1377z5pn5ydjg"))))
(arguments
(substitute-keyword-arguments (package-arguments python-pytest)
- ((#:phases phases #~%standard-phases)
+ ((#:phases phases #~%standard-phases)
#~(modify-phases #$phases
(add-before 'build 'pretend-version
(lambda _
(setenv "SETUPTOOLS_SCM_PRETEND_VERSION" #$version)))))))
(propagated-inputs
- (modify-inputs (package-propagated-inputs python-pytest)
- (replace "python-pluggy" python-pluggy-next)))
- ))
+ (modify-inputs (package-propagated-inputs python-pytest)
+ (replace "python-pluggy" python-pluggy-next)))))

Stylistic. Lonely parens are sad :-).

(define-public python-pytest-bootstrap
(package
modified gnu/packages/databases.scm
@@ -3586,7 +3586,7 @@ (define-public python-sqlite-utils
(name "python-sqlite-utils")
(version "3.30")
(source (origin
- (method git-fetch) ; for tests
+ (method git-fetch) ;for tests

Stylistic; I do not use a space between the ';' and the comment for
inline comments.
(uri (git-reference
(url "https://github.com/simonw/sqlite-utils")
(commit version)))
@@ -3595,7 +3595,17 @@ (define-public python-sqlite-utils
(base32
"1a58syvh5jp40vi5libsxkqy99z75kj4ckxqmylbhd342ppfy1wp"))))
(build-system pyproject-build-system)
- (propagated-inputs (list python-click python-click-default-group-wheel
+ (arguments
+ (list #:phases #~(modify-phases %standard-phases
+ (add-after 'unpack 'relax-requirements
+ (lambda _
+ (substitute* "setup.py"
+ ;; This is a variant designed to have a binary
+ ;; wheel made available on PyPI, which is not a
+ ;; concern to Guix.
+ (("click-default-group-wheel")
+ "click-default-group")))))))

I ended up not packaging the click-default-group-wheel variant and used
the our existing python-click-default-group package instead, since the
variant probably caters to Windows users installing from PyPI.

+ (propagated-inputs (list python-click python-click-default-group
python-dateutil python-sqlite-fts4
python-tabulate))
(native-inputs (list python-pytest))
@@ -3604,9 +3614,7 @@ (define-public python-sqlite-utils
"CLI tool and Python utility functions for manipulating SQLite databases")
(description
"This package provides a CLI tool and Python utility functions for
-manipulating SQLite databases.
-
-It's main features are:
+manipulating SQLite databases. It's main features are:
@itemize
@item
Pipe JSON (or CSV or TSV) directly into a new SQLite database file,
@@ -5091,7 +5099,7 @@ (define-public datasette
(name "datasette")
(version "0.64.2")
(source (origin
- (method git-fetch) ; for tests
+ (method git-fetch) ;for tests
(uri (git-reference
(url "https://github.com/simonw/datasette")
(commit version)))
@@ -5103,40 +5111,25 @@ (define-public datasette
(arguments
(list
#:test-flags
- ;; disable failing tests
- '(list
- "--deselect"
- "tests/test_api.py::test_database_page_for_database_with_dot_in_name"
- "--deselect"
- "tests/test_api.py::test_row_strange_table_name"
- "--deselect"
- "tests/test_api.py::test_database_with_space_in_name"
- "--deselect"
- "tests/test_api.py::test_tilde_encoded_database_names[fo%o]"
- "--deselect"
- "tests/test_api.py::test_tilde_encoded_database_names[f~/c.d]"
- "--deselect"
- "tests/test_cli.py::test_weird_database_names"
- "--deselect"
- "tests/test_html.py::test_css_classes_on_body[/fixtures/table~2Fwith~2Fslashes~2Ecsv-expected_classes5]"
- "--deselect"
- "tests/test_html.py::test_templates_considered[/fixtures/table~2Fwith~2Fslashes~2Ecsv-table-fixtures-tablewithslashescsv-fa7563.html, *table.html]"
- "--deselect"
- "tests/test_html.py::test_row_html_compound_primary_key[/fixtures/compound_primary_key/a~2Fb,~2Ec~2Dd-expected1]"
- "--deselect"
- "tests/test_html.py::test_edit_sql_link_on_canned_queries[/fixtures/~F0~9D~90~9C~F0~9D~90~A2~F0~9D~90~AD~F0~9D~90~A2~F0~9D~90~9E~F0~9D~90~AC-/fixtures?sql=select+id%2C+name+from+facet_cities+order+by+id+limit+1%3B]"
- "--deselect"
- "tests/test_html.py::test_alternate_url_json[/fixtures/table~2Fwith~2Fslashes~2Ecsv-http://localhost/fixtures/table~2Fwith~2Fslashes~2Ecsv.json]"
- "--deselect"
- "tests/test_table_api.py::test_table_with_slashes_in_name"
- "--deselect"
- "tests/test_table_api.py::test_searchable[/fixtures/searchable.json?_search=te*+AND+do*&_searchmode=raw-expected_rows3]"
- "--deselect"
- "tests/test_table_api.py::test_searchmode[table_metadata1-_search=te*+AND+do*-expected_rows1]"
- "--deselect"
- "tests/test_table_api.py::test_searchmode[table_metadata2-_search=te*+AND+do*&_searchmode=raw-expected_rows2]"
- "--deselect"
- "tests/test_table_api.py::test_custom_query_with_unicode_characters")
+ ;; There are multiple unexplained test failures (see:
+ ;; https://github.com/simonw/datasette/issues/2048).
+ #~(list "-k" (string-append
+ "not (test_database_page_for_database_with_dot_in_name"
+ " or test_row_strange_table_name"
+ " or test_database_with_space_in_name"
+ " or test_tilde_encoded_database_names"
+ " or test_weird_database_names"
+ " or test_css_classes_on_body"
+ " or test_templates_considered"
+ " or test_row_html_compound_primary_key"
+ " or test_edit_sql_link_on_canned_queries"
+ " or test_alternate_url_json"
+ " or test_table_with_slashes_in_name"
+ " or test_searchable"
+ " or test_custom_query_with_unicode_characters"
+ " or test_searchmode)")

I had two failures in the last suite; I reformatted for compactness nad
readability.

+ "-n" (number->string (parallel-job-count))

Since python-xdist is a native-input, we can make use of it (run tests i
parallel)

+ "-m" "not serial") ;cannot run in parallel

I found that bit in the github workflow file of the project, necessary
when running the tests in parallel.

#:phases
#~(modify-phases %standard-phases
(add-after 'unpack 'relax-requirements
@@ -5146,31 +5139,33 @@ (define-public datasette
(substitute* "setup.py"
(("(black)==[0-9\\.]+" _ package)
package)))))))
- (propagated-inputs (list python-aiofiles
- python-asgi-csrf
- python-asgiref
- python-click
- python-click-default-group-wheel
- python-httpx
- python-hupper
- python-itsdangerous
- python-janus
- python-jinja2
- python-mergedeep
- python-pint
- python-pluggy-next
- python-pyyaml
- python-uvicorn))
- (native-inputs (list python-beautifulsoup4
- python-black
- python-cogapp
- python-pytest-7.1
- python-pytest-asyncio
- python-pytest-runner
- python-pytest-timeout
- python-pytest-xdist-next
- python-setuptools
- python-trustme-next))
+ package)
+ (("click-default-group-wheel")
+ "click-default-group")))))))

Same fix as earlier.

+ (propagated-inputs
+ (list python-aiofiles
+ python-asgi-csrf
+ python-asgiref
+ python-click
+ python-click-default-group
+ python-httpx
+ python-hupper
+ python-itsdangerous
+ python-janus
+ python-jinja2
+ python-mergedeep
+ python-pint
+ python-pluggy-next
+ python-pyyaml
+ python-uvicorn))
+ (native-inputs
+ (list python-beautifulsoup4
+ python-black
+ python-cogapp
+ python-pytest-7.1
+ python-pytest-asyncio
+ python-pytest-runner
+ python-pytest-timeout
+ python-pytest-xdist-next
+ python-setuptools
+ python-trustme))

Stylistic changes.

(home-page "https://datasette.io/")
(synopsis "Multi-tool for exploring and publishing data")
(description "Datasette is a tool for exploring and publishing data.
modified gnu/packages/python-crypto.scm
@@ -1503,21 +1503,14 @@ (define-public python-secretstorage
(define-public python-trustme
(package
(name "python-trustme")
- (version "0.6.0")
+ (version "0.9.0")
(source
(origin
(method url-fetch)
(uri (pypi-uri "trustme" version))
(sha256
- (base32 "0v3vr5z6apnfmklf07m45kv5kaqvm6hxrkaqywch57bjd2siiywx"))))
- (build-system python-build-system)
- (arguments
- `(#:phases
- (modify-phases %standard-phases
- (replace 'check
- (lambda* (#:key inputs outputs #:allow-other-keys)
- (add-installed-pythonpath inputs outputs)
- (invoke "pytest" "-vv"))))))
+ (base32 "0v2qzszmyazfgc1snicdr4b4qdajpjd4pbinpgrn9vfff0yv41sy"))))
+ (build-system pyproject-build-system)
(native-inputs
(list python-more-itertools
python-pyopenssl
@@ -1526,7 +1519,9 @@ (define-public python-trustme
python-service-identity
python-zipp))
(propagated-inputs
- (list python-cryptography))
+ (list python-cryptography
+ python-idna
+ python-ipaddress))
(home-page "https://github.com/python-trio/trustme")
(synopsis "Fake a certificate authority for tests")
(description

I've chosen to bump our main python-trustme package to its latest
version instead of introducing a 'python-trustme-next' variant, since
all its dependents rebuilt OK with it. It's best to avoid variants
unless there's no other option.

modified gnu/packages/python-web.scm
@@ -575,18 +575,30 @@ (define-public python-asgi-csrf
(name "python-asgi-csrf")
(version "0.9")
(source (origin
- (method url-fetch)
- (uri (pypi-uri "asgi-csrf" version))
+ (method git-fetch) ;for tests
+ (uri (git-reference
+ (url "https://github.com/simonw/asgi-csrf")
+ (commit version)))
+ (file-name (git-file-name name version))

I switched to git because otherwise the test suite ran 0 test
(successfully, ah!).

(sha256
(base32
- "06klgxfxzjfkyjky3rkvmf2r07r7r2my53qq7g9qy6mcmvfkp7bf"))))
- (build-system python-build-system)
+ "1j134mjh0ff61rvkm3q67m463j1bhyxc9dwsdany3scnd4vsqqws"))))
+ (build-system pyproject-build-system)
+ (arguments
+ (list #:test-flags
+ ;; Provide a null config to avoid the extraneous dependency on
+ ;; python-pytest-coverage.
+ #~(list "-c" "/dev/null"

This trick was used to avoid the --cov* options added to pytest options,
to avoid requiring the coverage tool.

+ ;; Disable two failing tests (see:
+ ;; https://github.com/simonw/asgi-csrf/issues/24).
+ "-k" (string-append
+ "not (test_multipart "
+ "or test_multipart_failure_wrong_token)"))))

I encountered two test failures, so I reported them upstream and skipped
them in the package.
(propagated-inputs (list python-itsdangerous python-multipart))
(native-inputs (list python-asgi-lifespan
python-httpx
python-pytest
python-pytest-asyncio
- python-pytest-cov
python-starlette))
(home-page "https://github.com/simonw/asgi-csrf")
(synopsis "ASGI middleware for protecting against CSRF attacks")
@@ -602,7 +614,7 @@ (define-public python-asgi-lifespan
(name "python-asgi-lifespan")
(version "1.0.1")
(source (origin
- (method git-fetch) ; for tests
+ (method git-fetch) ;for tests
(uri (git-reference
(url "https://github.com/florimondmanca/asgi-lifespan")
(commit version)))
@@ -613,28 +625,20 @@ (define-public python-asgi-lifespan
(build-system pyproject-build-system)
(arguments
(list
- #:test-flags
- ;; disable failing tests
- '(list "-k"
- (string-append
- "not test_lifespan_manager[asyncio-None-ValueError-None]"
- " and not test_lifespan_manager[asyncio-ValueError-None-None]"
- " and not test_lifespan_manager[asyncio-ValueError-ValueError-None]"
- " and not test_lifespan_manager[trio-None-ValueError-None]"
- " and not test_lifespan_manager[trio-ValueError-None-None]"
- " and not test_lifespan_manager[trio-ValueError-ValueError-None]"))
- #:phases
- '(modify-phases %standard-phases
- (add-after 'unpack 'lower-coverage-requirement
- ;; after disabling the failing tests, the coverage
- ;; dropped slightly below 100%.
- (lambda _
- (substitute* "setup.cfg"
- (("(--cov-fail-under=)[0-9]+" _ cov)
- (string-append cov "90"))))))))
+ #:test-flags
+ '(list "-c" "/dev/null" ;ignore coverage-related options
+ "-k"
+ (string-append
+ ;; XXX: Some tests fail because of a 'lifespan.shutdown.failed'
+ ;; extra event, perhaps because our version of trio is older.

I left a comment explaining a reason why we may be seeing these
failures. Our environment differs from upstream so I haven't reported
them there. We'd need to update a bunch of asyncio things but these are
rather tied to the Pytest version, I think.

+ "not (test_lifespan_manager[asyncio-None-ValueError-None]"
+ " or test_lifespan_manager[asyncio-ValueError-None-None]"
+ " or test_lifespan_manager[asyncio-ValueError-ValueError-None]"
+ " or test_lifespan_manager[trio-None-ValueError-None]"
+ " or test_lifespan_manager[trio-ValueError-None-None]"
+ " or test_lifespan_manager[trio-ValueError-ValueError-None])"))))
(native-inputs (list python-pytest
python-pytest-asyncio
- python-pytest-cov
python-pytest-trio
python-starlette))
(propagated-inputs (list python-sniffio))
modified gnu/packages/python-xyz.scm
@@ -31569,16 +31569,12 @@ (define-public python-cogapp
(sha256
(base32
"1c0xx3p3lzrlyqhmccyq9c50f8v9pqk2992gb4nl50h2yy1m3s8v"))))
- (build-system python-build-system)
- (arguments
- '(#:tests? #f))
- (home-page "http://nedbatchelder.com/code/cog")
- (synopsis
- "Content generator for executing Python snippets in source files")
- (description
- "Cog is a file generation tool. It lets you use pieces of Python
-code as generators in your source files to generate whatever text you
-need.")
+ (build-system pyproject-build-system)
+ (native-inputs (list python-pytest))
+ (home-page "https://nedbatchelder.com/code/cog")
+ (synopsis "Content generation tool that leverages Python")
+ (description "Cog is a file generation tool. It allows using pieces of
+Python code as generators in your source files to generate arbitrary text.")
(license license:expat)))

Here I've switched the build system to pyproject-build-system and added
python-pytest; the package had tests. I've also used HTTPS for the home
page URL and reworded synopsis a bit.

With this, the changes were installed. I hope my review comments were
insightful for your future contributions!

Thank you!

--
Maxim
Closed
F
F
Felix Gruber wrote on 29 Mar 2023 21:38
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)(address . 60838-done@debbugs.gnu.org)
9f8bb49d-deb0-d7b4-f59e-0f1bea96c693@posteo.net
Hi Maxim,

On 3/29/23 19:22, Maxim Cournoyer wrote:
Toggle quote (3 lines)
> With this, the changes were installed. I hope my review comments were
> insightful for your future contributions!

Many thanks for your detailed review comments. I've definitely learned a
few things here that will be useful for my future patches!

Kind regards,
Felix
Closed
?