Subject: [bug#60838] [PATCH v3 9/9] gnu: Add datasette.

From: Felix Gruber <[email-masked]>
Date: Sun, 26 Mar 2023 19:43:35 +0000

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

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 <[email-masked]>
 ;;; Copyright © 2022 Thomas Albers Raviola <[email-masked]>
 ;;; Copyright © 2021, 2022 jgart <[email-masked]>
+;;; Copyright © 2023 Felix Gruber <[email-masked]>
 ;;;
 ;;; 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