[PATCH 0/4] gnu: Add flask-combo-jsonapi

  • Done
  • quality assurance status badge
Details
2 participants
  • david larsson
  • Tobias Geerinckx-Rice
Owner
unassigned
Submitted by
david larsson
Severity
normal
D
D
david larsson wrote on 27 Oct 2021 12:52
(address . guix-patches@gnu.org)
fe4deb71adbd4c7deefe5ca942acca90@selfhosted.xyz
Hi!
This patch series is to add python-flask-combo-jsonapi and necessary
dependencies.

Best regards,
David
D
D
david larsson wrote on 27 Oct 2021 12:56
Re: [bug#51432] [PATCH 1/4] gnu: Add sqlalchemy-1.3
(address . 51432@debbugs.gnu.org)
98ab18241bb0ad6493ee361c723890a3@selfhosted.xyz
On 2021-10-27 12:52, david larsson wrote:
Toggle quote (7 lines)
> Hi!
> This patch series is to add python-flask-combo-jsonapi and necessary
> dependencies.
>
> Best regards,
> David

Adds sqlalchemy-1.3 because flask-combo-jsonapi requires less than
version 1.4.
From 5f49c1f0cb150199d485eb886e329bd05dc7383d Mon Sep 17 00:00:00 2001
From: David Larsson <david.larsson@selfhosted.xyz>
Date: Tue, 26 Oct 2021 19:39:37 +0200
Subject: [PATCH 1/4] gnu: Add sqlalchemy-1.3.

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

Toggle diff (45 lines)
diff --git a/gnu/packages/databases.scm b/gnu/packages/databases.scm
index 0da6c2d1be..ef3b407ae4 100644
--- a/gnu/packages/databases.scm
+++ b/gnu/packages/databases.scm
@@ -3006,6 +3006,38 @@ designed for efficient and high-performing database access, adapted into a
simple and Pythonic domain language.")
(license license:x11)))
+(define-public python-sqlalchemy-1.3
+ (package
+ (name "python-sqlalchemy")
+ (version "1.3.20")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (pypi-uri "SQLAlchemy" version))
+ (sha256
+ (base32 "18b9am7bsqc4nj3d2h5r93i002apczxfvpfpcqbd6f0385zmrwnj"))))
+ (build-system python-build-system)
+ (native-inputs
+ `(("python-cython" ,python-cython) ; for C extensions
+ ("python-pytest" ,python-pytest)
+ ("python-mock" ,python-mock))) ; for tests
+ ;; (propagated-inputs
+ ;; `(("python-greenlet" ,python-greenlet)))
+ (arguments
+ `(#:phases
+ (modify-phases %standard-phases
+ (replace 'check
+ (lambda _ (invoke "py.test"))))))
+ (home-page "https://www.sqlalchemy.org")
+ (synopsis "Database abstraction library")
+ (description
+ "SQLAlchemy is the Python SQL toolkit and Object Relational Mapper that
+gives application developers the full power and flexibility of SQL. It
+provides a full suite of well known enterprise-level persistence patterns,
+designed for efficient and high-performing database access, adapted into a
+simple and Pythonic domain language.")
+ (license license:x11)))
+
(define-public python2-sqlalchemy
(package-with-python2 python-sqlalchemy))
--
2.31.0
D
D
david larsson wrote on 27 Oct 2021 12:59
Re: [bug#51432] [PATCH 2/4] gnu: Add marshmallow 3.2
(address . 51432@debbugs.gnu.org)
2cd5b21bb5273bf4f76414276c52ef13@selfhosted.xyz
On 2021-10-27 12:52, david larsson wrote:
Toggle quote (7 lines)
> Hi!
> This patch series is to add python-flask-combo-jsonapi and necessary
> dependencies.
>
> Best regards,
> David

flask-combo-jsonapi needs a marshmallow that is at version 3.2.
From 1467067415f940c410c95b7426a4d996173811cd Mon Sep 17 00:00:00 2001
From: David Larsson <david.larsson@selfhosted.xyz>
Date: Tue, 26 Oct 2021 19:44:35 +0200
Subject: [PATCH 2/4] gnu: Add marshmallow-3.2.

* gnu/packages/python-xyz.scm (python-marshmallow-3.2): New variable.
---
gnu/packages/python-xyz.scm | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)

Toggle diff (38 lines)
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index a7b1e0efe2..9ca075e941 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -19165,6 +19165,31 @@ Python datatypes.")
complex datatypes to and from native Python datatypes.")
(license license:expat)))
+(define-public python-marshmallow-3.2
+ (package
+ (name "python-marshmallow")
+ (version "3.2.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (pypi-uri "marshmallow" version))
+ (sha256
+ (base32
+ "1w18klwj0z9bqxj252qpj1hz8l46nl27sbc89rkajc7mln73wbws"))))
+ (build-system python-build-system)
+ (propagated-inputs
+ `(("python-dateutil" ,python-dateutil)
+ ("python-simplejson" ,python-simplejson)))
+ (native-inputs
+ `(("python-pytest" ,python-pytest)
+ ("python-pytz" ,python-pytz)))
+ (home-page "https://github.com/marshmallow-code/marshmallow")
+ (synopsis "Convert complex datatypes to and from native
+Python datatypes")
+ (description "@code{marshmallow} provides a library for converting
+complex datatypes to and from native Python datatypes.")
+ (license license:expat))) ; MIT license
+
(define-public python-apispec
(package
(name "python-apispec")
--
2.31.0
D
D
david larsson wrote on 27 Oct 2021 13:01
Re: [bug#51432] [PATCH 3/4] gnu: Add marshmallow-jsonapi
(address . 51432@debbugs.gnu.org)(name . Guix-patches)(address . guix-patches-bounces+david.larsson=selfhosted.xyz@gnu.org)
77232ac1914f40ac2d037ef20153d913@selfhosted.xyz
On 2021-10-27 12:52, david larsson wrote:
Toggle quote (7 lines)
> Hi!
> This patch series is to add python-flask-combo-jsonapi and necessary
> dependencies.
>
> Best regards,
> David

Adds the dependency on marshmallow-jsonapi.
From bce66e910d26e1d9bc6b5156817fa56c57e9f0fa Mon Sep 17 00:00:00 2001
From: David Larsson <david.larsson@selfhosted.xyz>
Date: Tue, 26 Oct 2021 19:51:50 +0200
Subject: [PATCH 3/4] gnu: Add marshmallow-jsonapi.

* gnu/packages/python-xyz.scm (python-marshmallow-jsonapi): New variable.
---
gnu/packages/python-xyz.scm | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)

Toggle diff (44 lines)
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 9ca075e941..ea7ba72a6e 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -19190,6 +19190,37 @@ Python datatypes")
complex datatypes to and from native Python datatypes.")
(license license:expat))) ; MIT license
+(define-public python-marshmallow-jsonapi
+ (package
+ (name "python-marshmallow-jsonapi")
+ (version "0.24.0")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (pypi-uri "marshmallow-jsonapi" version))
+ (sha256
+ (base32
+ "1d9pxcgmln4gls99vwj1h24qv0lz7fb2jqmqrsiv1pid1snc125x"))))
+ (build-system python-build-system)
+ (propagated-inputs
+ `(("python-marshmallow" ,python-marshmallow-3.2)))
+ (native-inputs
+ `(("python-faker" ,python-faker)
+ ("python-flake8" ,python-flake8)
+ ("python-flake8-bugbear" ,python-flake8-bugbear)
+ ("python-flask" ,python-flask)
+ ("python-mock" ,python-mock)
+ ("python-pre-commit" ,python-pre-commit)
+ ("python-pytest" ,python-pytest)
+ ("python-tox" ,python-tox)))
+ (home-page
+ "https://github.com/marshmallow-code/marshmallow-jsonapi")
+ (synopsis
+ "JSON API 1.0 (https://jsonapi.org) formatting with marshmallow")
+ (description
+ "JSON API 1.0 (https://jsonapi.org) formatting with marshmallow")
+ (license license:expat))) ; MIT license
+
(define-public python-apispec
(package
(name "python-apispec")
--
2.31.0
D
D
david larsson wrote on 27 Oct 2021 13:02
Re: [bug#51432] [PATCH 4/4] gnu: Add flask-combo-jsonapi
(address . 51432@debbugs.gnu.org)(name . Guix-patches)(address . guix-patches-bounces+david.larsson=selfhosted.xyz@gnu.org)
9fbd923745c213a3e86cb9701aa8af9e@selfhosted.xyz
On 2021-10-27 12:52, david larsson wrote:
Toggle quote (7 lines)
> Hi!
> This patch series is to add python-flask-combo-jsonapi and necessary
> dependencies.
>
> Best regards,
> David

Finally, adds the package flask-combo-jsonapi.
From 6fbec5bdd04c5661b805cf958f36478cfc7883f8 Mon Sep 17 00:00:00 2001
From: David Larsson <david.larsson@selfhosted.xyz>
Date: Wed, 27 Oct 2021 09:04:40 +0200
Subject: [PATCH 4/4] gnu: Add flask-combo-jsonapi.

* gnu/packages/python-web.scm (python-flask-combo-jsonapi): New variable.
---
gnu/packages/python-web.scm | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)

Toggle diff (44 lines)
diff --git a/gnu/packages/python-web.scm b/gnu/packages/python-web.scm
index a38ed5c268..0d173aa09d 100644
--- a/gnu/packages/python-web.scm
+++ b/gnu/packages/python-web.scm
@@ -6249,3 +6249,37 @@ communicate with Microsoft Azure Storage services.")
comments, or tags from HTML snippets, extract base url from HTML snippets,
translate entities on HTML strings, among other things.")
(license license:bsd-3)))
+
+(define-public python-flask-combo-jsonapi
+ (package
+ (name "python-flask-combo-jsonapi")
+ (version "1.1.0")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (string-append
+ "https://github.com/AdCombo/flask-combo-jsonapi/archive/"
+ version ".tar.gz"))
+ (sha256
+ (base32
+ "1sygp9rx7zb1dbjxhb11mpas0c0px4md7mvi9pwbh1s1rr1glm3m"))))
+ (build-system python-build-system)
+ (propagated-inputs
+ `(("python-flask" ,python-flask)
+ ("python-marshmallow" ,python-marshmallow-3.2)
+ ("python-marshmallow-jsonapi" ,python-marshmallow-jsonapi)
+ ("python-simplejson" ,python-simplejson)
+ ("python-sqlalchemy" ,python-sqlalchemy-1.3)
+ ("python-apispec" ,python-apispec)
+ ("python-simplejson" ,python-simplejson)
+ ("python-six" ,python-six)))
+ (native-inputs `(("python-coverage" ,python-coverage)
+ ("python-coveralls" ,python-coveralls)
+ ("python-pytest" ,python-pytest)
+ ("python-pytest-runner" ,python-pytest-runner)))
+ (home-page "https://github.com/AdCombo/flask-combo-jsonapi")
+ (synopsis
+ "Flask extension to create REST web api according to JSON:API 1.0 specification with Flask, Marshmallow and data provider of your choice (SQLAlchemy, MongoDB, ...)")
+ (description
+ "Flask extension to create REST web api according to JSON:API 1.0 specification with Flask, Marshmallow and data provider of your choice (SQLAlchemy, MongoDB, ...)")
+ (license license:expat)))
--
2.31.0
D
D
david larsson wrote on 27 Oct 2021 20:44
(address . 51432@debbugs.gnu.org)
a5afd7ee3981d2b8c4af3cfc909a4083@selfhosted.xyz
On 2021-10-27 13:02, david larsson wrote:
Toggle quote (10 lines)
> On 2021-10-27 12:52, david larsson wrote:
>> Hi!
>> This patch series is to add python-flask-combo-jsonapi and necessary
>> dependencies.
>>
>> Best regards,
>> David
>
> Finally, adds the package flask-combo-jsonapi.

Version 2 of this patch, fixing the synopsis according to coding
standards max 80 chars.
From 4397008d2bdc559a072bbb98c99ba8d6d6cf4b87 Mon Sep 17 00:00:00 2001
From: David Larsson <david.larsson@selfhosted.xyz>
Date: Wed, 27 Oct 2021 09:04:40 +0200
Subject: [PATCH 4/4] gnu: Add flask-combo-jsonapi.

* gnu/packages/python-web.scm (python-flask-combo-jsonapi): New variable.
---
gnu/packages/python-web.scm | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)

Toggle diff (46 lines)
diff --git a/gnu/packages/python-web.scm b/gnu/packages/python-web.scm
index a38ed5c268..55561f7b47 100644
--- a/gnu/packages/python-web.scm
+++ b/gnu/packages/python-web.scm
@@ -6249,3 +6249,39 @@ communicate with Microsoft Azure Storage services.")
comments, or tags from HTML snippets, extract base url from HTML snippets,
translate entities on HTML strings, among other things.")
(license license:bsd-3)))
+
+(define-public python-flask-combo-jsonapi
+ (package
+ (name "python-flask-combo-jsonapi")
+ (version "1.1.0")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (string-append
+ "https://github.com/AdCombo/flask-combo-jsonapi/archive/"
+ version ".tar.gz"))
+ (sha256
+ (base32
+ "1sygp9rx7zb1dbjxhb11mpas0c0px4md7mvi9pwbh1s1rr1glm3m"))))
+ (build-system python-build-system)
+ (propagated-inputs
+ `(("python-flask" ,python-flask)
+ ("python-marshmallow" ,python-marshmallow-3.2)
+ ("python-marshmallow-jsonapi" ,python-marshmallow-jsonapi)
+ ("python-simplejson" ,python-simplejson)
+ ("python-sqlalchemy" ,python-sqlalchemy-1.3)
+ ("python-apispec" ,python-apispec)
+ ("python-simplejson" ,python-simplejson)
+ ("python-six" ,python-six)))
+ (native-inputs `(("python-coverage" ,python-coverage)
+ ("python-coveralls" ,python-coveralls)
+ ("python-pytest" ,python-pytest)
+ ("python-pytest-runner" ,python-pytest-runner)))
+ (home-page "https://github.com/AdCombo/flask-combo-jsonapi")
+ (synopsis
+ "Flask extension to quickly create a REST web api using JSON:API 1.0 spec")
+ (description
+ "Flask extension to create REST web api according to JSON:API 1.0
+specification with Flask, Marshmallow and data provider of your
+choice (SQLAlchemy, MongoDB, ...)")
+ (license license:expat)))
--
2.31.0
T
T
Tobias Geerinckx-Rice wrote on 3 Nov 2021 14:34
Re: [bug#51432] [PATCH 3/4] gnu: Add marshmallow-jsonapi
(name . david larsson)(address . david.larsson@selfhosted.xyz)
87zgql5dz0.fsf@nckx
David,

Toggle quote (2 lines)
> + (base32
> + "1d9pxcgmln4gls99vwj1h24qv0lz7fb2jqmqrsiv1pid1snc125x"))))
[…]
Toggle quote (6 lines)
> + (home-page
> + "https://github.com/marshmallow-code/marshmallow-jsonapi")
> + (synopsis
> + "JSON API 1.0 (https://jsonapi.org) formatting with
> marshmallow")

Nitpick: none of these need to be on separate lines (after
removing the URL from the description).

Guix synopses and descriptions support (a comfortable subset of)
Texinfo. You can include hyperlinks in Texinfo with

@uref{https://your.url/here,optional description}

For subjective reasons I decided to keep only the URL in the
description.

Toggle quote (4 lines)
> + (description
> + "JSON API 1.0 (https://jsonapi.org) formatting with
> marshmallow")

Descriptions should consist of full sentences. A single line is
way too short. Upstream has a fine description that fits our
standards, so I adapted it:

+ (description
+ "The marshmallow-jsonapi package provides a simple way to
produce
+@uref{https://jsonapi.org, JSON:API}-compliant data in any Python
Web framework.
+It includes optional utilities to integrate with Flask.")

Toggle quote (2 lines)
> + (license license:expat))) ; MIT license

No need for this comment.

Thanks!

T G-R
-----BEGIN PGP SIGNATURE-----

iIMEARYKACsWIQT12iAyS4c9C3o4dnINsP+IT1VteQUCYYLLAw0cbWVAdG9iaWFz
LmdyAAoJEA2w/4hPVW15pyMA/3nKBj6wrgWAtycXh+FkgfoxOeDhF8Dysj0xcV8I
XrMEAQDfVRXdSCRhgKRFcLzV72gYulopPz17iBVTjC6dT21QBQ==
=htWF
-----END PGP SIGNATURE-----

T
T
Tobias Geerinckx-Rice wrote on 3 Nov 2021 15:30
Re: [bug#51432] [PATCH 2/4] gnu: Add marshmallow 3.2
(name . david larsson)(address . david.larsson@selfhosted.xyz)(address . 51432@debbugs.gnu.org)
874k8t6sjl.fsf@nckx
David,

Let's inherit the current python-marshmallow to avoid all this
duplication:

+(define-public python-marshmallow-3.2
+ (package
+ (inherit python-marshmallow)
+ (version "3.2.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (pypi-uri "marshmallow" version))
+ (sha256
+ (base32
"1w18klwj0z9bqxj252qpj1hz8l46nl27sbc89rkajc7mln73wbws"))))))

If you're thinking, ‘wait a minute, what happens to my precious
3.2 package if someone updates 3.9 in a weird way?’, well, you're
right. There are trade-offs to both.

Kind regards,

T G-R
-----BEGIN PGP SIGNATURE-----

iIMEARYKACsWIQT12iAyS4c9C3o4dnINsP+IT1VteQUCYYLK/g0cbWVAdG9iaWFz
LmdyAAoJEA2w/4hPVW15AtUBAL/l6a4QXcHVnifKEDgibc4GRop091zmhh1geP+X
Vqm2AQCl6ojud2Ty1328p55Oc63cWNTcu5Kwrcdrk8K73TTUAQ==
=UM+1
-----END PGP SIGNATURE-----

T
T
Tobias Geerinckx-Rice wrote on 3 Nov 2021 14:27
Re: [bug#51432] [PATCH 1/4] gnu: Add sqlalchemy-1.3
(name . david larsson)(address . david.larsson@selfhosted.xyz)(address . 51432-done@debbugs.gnu.org)
878ry56sk0.fsf@nckx
David,

Thanks! I've pushed this series as
52a7fba8fc78763967c15781ea9b9176d3b4cc26 et al.

Toggle quote (2 lines)
> Subject: [PATCH 1/4] gnu: Add sqlalchemy-1.3.

Use the full package name here. This applies to all patches in
this series AFAICT.

Toggle quote (3 lines)
> + ;; (propagated-inputs
> + ;; `(("python-greenlet" ,python-greenlet)))

Why is this commented out? Please add a comment in such cases (if
you've verified that all dependents still work without it, or that
it was added after 1.3.20).

Great news! This whole package can instead be written as:

(define-public python-sqlalchemy-1.3
(package
(inherit python-sqlalchemy)
(version "1.3.20")
(source
(origin
(method url-fetch)
(uri (pypi-uri "SQLAlchemy" version))
(sha256
(base32 "18b9am7bsqc4nj3d2h5r93i002apczxfvpfpcqbd6f0385zmrwnj"))))
(propagated-inputs '())))

Kind regards,

T G-R
-----BEGIN PGP SIGNATURE-----

iIMEARYKACsWIQT12iAyS4c9C3o4dnINsP+IT1VteQUCYYLK7w0cbWVAdG9iaWFz
LmdyAAoJEA2w/4hPVW157AABAIZ6ReVGiGnyZoJO7g+VViy2gQUC28TkknLBx26h
Z8mUAP9rL5GS6AN3zcs1lXIG8QMwCurZHiGzf8pUmuhypTinBA==
=G2AU
-----END PGP SIGNATURE-----

Closed
T
T
Tobias Geerinckx-Rice wrote on 3 Nov 2021 14:46
Re: [bug#51432] [PATCH 4/4] gnu: Add flask-combo-jsonapi
(name . david larsson)(address . david.larsson@selfhosted.xyz)
87v9195dxk.fsf@nckx
David,

Toggle quote (3 lines)
> Version 2 of this patch, fixing the synopsis according to coding
> standards max 80 chars.

Thanks! Be sure to run ‘guix lint’ on each package as well.

Toggle quote (5 lines)
> + (method url-fetch)
> + (uri (string-append
> + "https://github.com/AdCombo/flask-combo-jsonapi/archive/"
> + version ".tar.gz"))

GitHub /archive/ have proven unstable in the past: they can be
regenerated at GitHub's discretion and no longer match our hash.

I replaced url-fetch with git-fetch.

Toggle quote (2 lines)
> + (native-inputs `(("python-coverage" ,python-coverage)

This alignment is at least inconsistent with propagated-inputs
above. Furthermore I simply dislike it, so I changed it :-)

Toggle quote (3 lines)
> + (native-inputs
> + `(("python-coverage" ,python-coverage)

I shortened the description a smidge and rewrote the following
sentence fragment:

Toggle quote (6 lines)
> + (description
> + "Flask extension to create REST web api according to
> JSON:API 1.0
> +specification with Flask, Marshmallow and data provider of your
> +choice (SQLAlchemy, MongoDB, ...)")

as:

+ (description
+ "Flask-COMBO-JSONAPI is a Python Flask extension for
building REST Web APIs
+compliant with the @uref{https://jsonapi.org, JSON:API 1.0}
specification.
+
+It tries to combine the power of Flask-Restless with the
flexibility of
+Flask-RESTful to quickly build APIs that fit the complexity of
existing
+real-life projects with legacy data and diverse storage
providers.")

I deliberately removed the reference to MongoDB because it's not
of any particular significance and non-free. I also removed
several more gratuitous references in Guix proper.

Kind regards,

T G-R
-----BEGIN PGP SIGNATURE-----

iIMEARYKACsWIQT12iAyS4c9C3o4dnINsP+IT1VteQUCYYLLNw0cbWVAdG9iaWFz
LmdyAAoJEA2w/4hPVW15TIUBAJexwZm6mUImgMnWVAjgOkYFRHDYGJ9VUuMGDqQ5
EQnFAP44q09n30c72P7SQ/+mfRPO6vcI5vxtag42juxWLnpxBg==
=iYWO
-----END PGP SIGNATURE-----

?
Your comment

This issue is archived.

To comment on this conversation send an email to 51432@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 51432
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch