Cyclic load dependency in babashka
When using grasp with babashka, requiring the grasp.api namespace fails with the message Cyclic load dependency: grasp.api->[ grasp.impl ]->[ grasp.impl ] [at grasp/impl.clj]
I'm not sure why grasp.impl requires itself. I get other errors when I remove it, which I'll open other issues for when I investigate further.
Minimal reproduction
$ echo '{:deps {io.github.borkdude/grasp {:mvn/version "0.0.3"} org.babashka/spec.alpha {:git/url "https://github.com/babashka/spec.alpha" :git/sha "8df0712896f596680da7a32ae44bb000b7e45e68"}}}' > bb.edn
$ bb
Babashka v0.9.161 REPL.
Use :repl/quit or :repl/exit to quit the REPL.
Clojure rocks, Bash reaches.
user=> (require '[grasp.api :as g])
Cyclic load dependency: grasp.api->[ grasp.impl ]->[ grasp.impl ] [at grasp/impl.clj]
user=>
grasp currently doesn't work in bb, but you can use the grasp binary. PR welcome to remove the self-require. I've noticed that Clojure is accepting of this, perhaps SCI should also accept this.
I hit this issue as well, when attempting to load grasp into a REPL started using rules_clojure. Tools.namespace does not accept circular references
{:clojure.main/message
"Execution error (ExceptionInfo) at clojure.tools.namespace.dependency.MapDependencyGraph/depend (dependency.cljc:89).\nCircular dependency between grasp.impl and grasp.impl\n",
:clojure.main/triage
{:clojure.error/class clojure.lang.ExceptionInfo,
:clojure.error/line 89,
:clojure.error/cause
"Circular dependency between grasp.impl and grasp.impl",
:clojure.error/symbol
clojure.tools.namespace.dependency.MapDependencyGraph/depend,
:clojure.error/source "dependency.cljc",
:clojure.error/phase :execution},
:clojure.main/trace
{:via
[{:type clojure.lang.ExceptionInfo,
:message "Circular dependency between grasp.impl and grasp.impl",
:data
{:reason :clojure.tools.namespace.dependency/circular-dependency,
:node grasp.impl,
:dependency grasp.impl},
:at
[clojure.tools.namespace.dependency.MapDependencyGraph
depend
"dependency.cljc"
89]}],
:trace
[[clojure.tools.namespace.dependency.MapDependencyGraph
depend
"dependency.cljc"
89]
[rules_clojure.jar$topo_sort$fn__3672$fn__3673 invoke "jar.clj" 68]
[clojure.core.protocols$iter_reduce invokeStatic "protocols.clj" 49]
[clojure.core.protocols$fn__8230 invokeStatic "protocols.clj" 75]
[clojure.core.protocols$fn__8230 invoke "protocols.clj" 75]
[clojure.core.protocols$fn__8178$G__8173__8191
invoke
"protocols.clj"
13]
[clojure.core$reduce invokeStatic "core.clj" 6886]
[clojure.core$reduce invoke "core.clj" 6868]
[rules_clojure.jar$topo_sort$fn__3672 invoke "jar.clj" 67]
[clojure.core.protocols$fn__8249 invokeStatic "protocols.clj" 168]
[clojure.core.protocols$fn__8249 invoke "protocols.clj" 124]
[clojure.core.protocols$fn__8204$G__8199__8213
invoke
"protocols.clj"
19]
[clojure.core.protocols$seq_reduce invokeStatic "protocols.clj" 31]
[clojure.core.protocols$fn__8236 invokeStatic "protocols.clj" 75]
[clojure.core.protocols$fn__8236 invoke "protocols.clj" 75]
[clojure.core.protocols$fn__8178$G__8173__8191
invoke
"protocols.clj"
13]
[clojure.core$reduce invokeStatic "core.clj" 6886]
[clojure.core$reduce invoke "core.clj" 6868]
[rules_clojure.jar$topo_sort invokeStatic "jar.clj" 64]
[rules_clojure.jar$topo_sort invoke "jar.clj" 57]
[rules_clojure.jar$get_compilation_script
invokeStatic
"jar.clj"
193]
[rules_clojure.jar$get_compilation_script invoke "jar.clj" 185]
[rules_clojure.jar$get_compilation_script_json
invokeStatic
"jar.clj"
264]
[rules_clojure.jar$get_compilation_script_json invoke "jar.clj" 259]
[rules_clojure.worker$process_request invokeStatic "worker.clj" 52]
[rules_clojure.worker$process_request invoke "worker.clj" 48]
[rules_clojure.worker$process_ephemeral
invokeStatic
"worker.clj"
69]