diff mbox series

[bug#53765,13/17] gnu: Add clojure-com-cognitect-aws-api.

Message ID 87ee4j32av.fsf@reilysiegel.com
State New
Headers show
Series Remove limitations on clojure-tools | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

Reily Siegel Feb. 4, 2022, 12:26 a.m. UTC
* gnu/packages/clojure.scm (clojure-com-cognitect-aws-api): New variable.
---
 gnu/packages/clojure.scm | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

Comments

M Feb. 6, 2022, 10:37 a.m. UTC | #1
Reily Siegel schreef op do 03-02-2022 om 19:26 [-0500]:
> +    (synopsis "aws-api is a Clojure library which provides programmatic access
> +to AWS services from your Clojure program")

It seems irrelevant that it's mine or yours or someone else's, I would
replace 'your Clojure program' with 'Clojure'.

Also, introduce the acronym AWS before using it.

Greetings,
Maxime.
M Feb. 6, 2022, 10:39 a.m. UTC | #2
Reily Siegel schreef op do 03-02-2022 om 19:26 [-0500]:
> @code{aws-api} is an idiomatic, data-oriented Clojure
> +library for invoking AWS APIs.

From ‘Synopses and Descriptions’:

Please avoid marketing phrases such as “world-leading”,
“industrial-strength”, and “next-generation”, and avoid superlatives
like “the most advanced”—they are not helpful to users looking for a
package and may even sound suspicious.  Instead, try to be factual,
mentioning use cases and features.

I'm referring to 'idiomatic' and 'data-oriented' which is rather vague
and subjective.

Greetings,
Maxime.
M Feb. 6, 2022, 10:45 a.m. UTC | #3
Reily Siegel schreef op do 03-02-2022 om 19:26 [-0500]:
> +    (description "@code{aws-api} is an idiomatic, data-oriented Clojure
> +library for invoking AWS APIs.
> 
What's an ‘AWS API’?  How do I now if I have one?  Some context is
required here.

>   While the library offers some helper and
> +documentation functions you'll use at development time, the only functions you
> +ever need at runtime are @code{client}, which creates a client for a given
> +service and @code{invoke}, which invokes an operation on the
> +service.
> 

How can this description now I will never need these helper functions?
If they are unneeded, why are they included at all?

>  @code{invoke} takes a map and returns a map, and works the same way
> +for every operation on every service.")

Anyway, descriptions aren't the place to describe the API, that's for
the documentation of clojure-com-cognitect-aws-api.  Instead, keep in
mind:

‘[...], try to be factual, mentioning use cases and features.’

‘Keep in mind that the synopsis must be meaningful for a very wide
audience.  For example, “Manipulate alignments in the SAM format” might
make sense for a seasoned bioinformatics researcher, but might be
fairly unhelpful or even misleading to a non-specialized audience.  It
is a good idea to come up with a synopsis that gives an idea of the
application domain of the package.  In this example, this might give
something like “Manipulate nucleotide sequence alignments”, which
hopefully gives the user a better idea of whether this is what they are
looking for.’

Greetings,
Maxime.
Reily Siegel Feb. 7, 2022, 6:09 p.m. UTC | #4
Maxime Devos <maximedevos@telenet.be> writes:

> Reily Siegel schreef op do 03-02-2022 om 19:26 [-0500]:
>> @code{aws-api} is an idiomatic, data-oriented Clojure
>> +library for invoking AWS APIs.

> I'm referring to 'idiomatic' and 'data-oriented' which is rather vague
> and subjective.
Data-oriented has a rather specific meaning in the Clojure community,
that is that the API is declarative and operates on plain Clojure data
structures, as opposed to using Macros or a class-based system. I will
update the descriptions and synopses that were mentioned in other
replies, and submit a new version of the patch.
M Feb. 7, 2022, 7:19 p.m. UTC | #5
Reily Siegel schreef op ma 07-02-2022 om 13:09 [-0500]:
> Data-oriented has a rather specific meaning in the Clojure community,
> that is that the API is declarative and operates on plain Clojure data
> structures, as opposed to using Macros or a class-based system.

OK, though I don't see how it can be declarative -- it's a library
for ‘invoking AWS APIs’, which seems rather imperative, at least
procedural.

Greetings,
Maxime.
Reily Siegel Feb. 7, 2022, 7:31 p.m. UTC | #6
Maxime Devos <maximedevos@telenet.be> writes:

> OK, though I don't see how it can be declarative -- it's a library
> for ‘invoking AWS APIs’, which seems rather imperative, at least
> procedural.
Let me compare this library and the official Java AWS SDK.

#+BEGIN_SRC java
// Create a GetItemRequest instance
GetItemRequest request = GetItemRequest.builder()
                       .key(keyToGet)
                       .tableName(tableName)
                       .build();

// Invoke the DynamoDbAsyncClient object's getItem
java.util.Collection<AttributeValue> returnedItem = client.getItem(request)
                                                  .join()
                                                  .item()
                                                  .values();
#+END_SRC

#+BEGIN_SRC clojure
(aws/invoke s3 {:op :GetObject :request {:Bucket bucket-name :Key "hello.txt"}})
#+END_SRC

The Java API programatically creates a Request object, when is then
modified by several methods to set the options, before being invoked.
The Clojure API, on the other hand, specifies the operation
declaratively using plain Clojure data structures (in this case,
keywords, strings, and maps), before calling invoke on that
specification. The declarative part is in how the API is interacted
with, not necessarily what happens in the library internals or over the
wire.

Examples from the respective documentations of each project.
diff mbox series

Patch

diff --git a/gnu/packages/clojure.scm b/gnu/packages/clojure.scm
index 58adb8d080..b99ec139da 100644
--- a/gnu/packages/clojure.scm
+++ b/gnu/packages/clojure.scm
@@ -260,6 +260,46 @@  (define-public clojure-algo-monads
     (home-page "https://github.com/clojure/algo.monads")
     (license license:epl1.0)))
 
+(define-public clojure-com-cognitect-aws-api
+  (package
+    (name "clojure-com-cognitect-aws-api")
+    (version "0.8.539")
+    (home-page "https://github.com/cognitect-labs/aws-api")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url home-page)
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1pi1578hgfy9w25gyidz5dwl85q51rjm3kfffmlxsysl7vx3gv03"))))
+    (build-system clojure-build-system)
+    (native-inputs (list clojure-http-kit
+                         java-commons-io
+                         clojure-com-cognitect-aws-endpoints
+                         clojure-com-cognitect-aws-s3
+                         clojure-test-check))
+    (propagated-inputs (list clojure-core-async
+                             clojure-tools-logging
+                             clojure-data-json
+                             clojure-data-xml
+                             clojure-com-cognitect-http-client))
+    (arguments
+     '(#:source-dirs '("src" "resources")
+       #:test-dirs '("test/src" "test/resources")
+       #:doc-dirs '("doc")))
+    (synopsis "aws-api is a Clojure library which provides programmatic access
+to AWS services from your Clojure program")
+    (description "@code{aws-api} is an idiomatic, data-oriented Clojure
+library for invoking AWS APIs.  While the library offers some helper and
+documentation functions you'll use at development time, the only functions you
+ever need at runtime are @code{client}, which creates a client for a given
+service and @code{invoke}, which invokes an operation on the
+service. @code{invoke} takes a map and returns a map, and works the same way
+for every operation on every service.")
+    (license license:asl2.0)))
+
 (define-public clojure-com-cognitect-http-client
   (package
     (name "clojure-com-cognitect-aws-api")