This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-08-23
Channels
- # announcements (6)
- # beginners (54)
- # calva (9)
- # cider (2)
- # clj-kondo (26)
- # cljsrn (2)
- # clojure (49)
- # clojure-brasil (1)
- # clojure-dev (3)
- # clojure-europe (11)
- # clojure-italy (28)
- # clojure-nl (5)
- # clojure-serbia (1)
- # clojure-spec (4)
- # clojure-uk (182)
- # clojuredesign-podcast (2)
- # clojurescript (59)
- # clojurex (9)
- # cursive (26)
- # data-science (11)
- # datomic (40)
- # duct (1)
- # emacs (3)
- # events (4)
- # figwheel-main (2)
- # fulcro (7)
- # instaparse (1)
- # kaocha (2)
- # leiningen (25)
- # off-topic (3)
- # re-frame (36)
- # reagent (15)
- # shadow-cljs (87)
- # spacemacs (12)
- # sql (20)
- # tools-deps (8)
- # vim (1)
- # yada (40)
looking at the code I recall it being super fun to work on, so you know, maybe do it anyway
Hi all…just a quick note that I’m pleased to announce that we’ve open-sourced our tool “protojure”, which is native support for protobuf/grpc for Clojure: https://protojure.github.io/
by default, it will only generate the protobuf definitions, but you can also optionally add grpc-server or grpc-client generators by specifying an argument, e.g. “--clojure_out=grpc-client:path/to/output”
There is some preliminary documentation available on the GH page. We will be enhancing this moving forward.
How difficult would it be to do it without generating source files using this code? I've always thought that an interpreter would be more useful in clojure as clojure is very source-oriented. For example this would be incompatible with certain styles of deps.edn local/git dependency
well, its not impossible, but it would be a fairly major change from the way its currently designed. For one, it depends on the protoc compiler to parse all the .proto files and generate the AST, which protojure consumes to generate its output
that said, I have a similar project in Hyperledger which does its own proto parsing via Instaparse
but thats not how Protojure works today: Protojure works like pretty much 99% of the rest of the protobuf/grpc language support works: as a plugin to protoc that generates native code
The closest thing I have seen to what you describe is using protobufjs via cljs interop
if you are curious, this is another project I have: https://github.com/hyperledger/fabric-chaintool
> Ah. Having protoc do the ast parsing explains why I don’t see this get often. Yeah, the ecosystem is definitely structured this way
I do think it would be quite possible to leverage the helper routines I have in protojure/lib for a runtime implementation
its primarily a matter of doing the parsing and then interning the symbols dynamically
in any case, I understand your usecase and it interests me as well…however, competing priorities didn’t allow any time to be spent on it
Like sql => like hugsql => like hugwhere, yes, you do! https://github.com/xiao-ne-zha/hugwhere
can one consolidate the two let
steps into one?
(let [the-map (->> x
rest
(group-by reader-conditional?))
[normal-forms reader-conditionals] (map (partial get the-map)
[false true])
...
...I guess I'm asking for a values-at
function, but want to have a handy pattern doesn't require me to introduce that dependency whenever needed.
i.e. do the thing inline within the ->>hello! another question about spec and stest/instrument
. the function documentation states that there are some parameters that can be used to override specs or mock stuff (:spec, :stub, :gen, :replace). i am not sure how to use these options in my case.
i have a function with two parameters, the second more like a dependency: (defn create-todo [task repo] ...)
and the spec definition is:
(spec/fdef create-todo
:args (spec/cat :task :todo/task
:repo :repo/repo)
:ret :model/todo
:fn (fn [{:keys [args ret]}]
(and (= (:task args) (:todo/task ret))
(not (:todo/completed? ret)))))
repo/repo
is basically (partial satisfies? Repository)
and Repository
is a protocol. in this case i suppose i should mock the second parameter, e.g. to pass an implementation that holds stuff in memory.
how could i do that when using stest/instrument
?
I'm not sure any of the stest/instrument options directly help you do that
really you probably want to use a replacement generator for :repo/repo that just always returns your mock impl
is there a way to dynamically namespace functions?
ehh nvm I'm just being lazy
hahaaaaaaa... thx ... needed that today
:thumbsup:
Does anyone know where I could find directions on how to deploy a library (based on deps.edn) to a maven repo (an internal one, not clojars)? Is pomegranate the way to go? Do I need to write the pom file manually?
I have not used these tools, so if you are looking for a recommendation based upon successful use, I would wait for another answer, but mevyn listed on this page might do what you hope: https://github.com/clojure/tools.deps.alpha/wiki/Tools
clj -Spom
will generate a minimal pom.xml
with dependencies but you'll want to expand it quite a bit (then clj -Spom
is safe to use again since it will update the dependencies in an existing pom.xml
file).
FWIW, we use depstar
to build JAR (and uberjar) files from source and the generated/expanded pom.xml
file. And then we use mvn deploy
to actually push the JAR file to a repo.
The author of mevyn recently said that if depstar had included the pom-reading/manifest-generating logic from day one, they wouldn't have written mevyn 🙂
^^^ That is the answer you wanted to wait for 🙂