practicalli

https://practicalli.github.io/ http://yt.vu/+practicalli (youtube)
euccastro 2020-06-27T02:44:25.133400Z

I get the following exception trying to use this: https://github.com/practicalli/clojure-deps-edn/blob/de7c8f78b18835fe4fdf845e5167cb12c078dbcc/deps.edn#L323

2. Unhandled clojure.lang.Compiler$CompilerException
   Error compiling clojure/tools/deps/alpha/util/maven.clj at (146:7)
   #:clojure.error{:phase :compile-syntax-check,
                   :line 146,
                   :column 7,
                   :source "clojure/tools/deps/alpha/util/maven.clj"}
[...]
1. Caused by java.lang.ClassNotFoundException
   clojure.tools.deps.alpha.util.S3TransporterFactory

practicalli-john 2020-06-27T11:57:14.142100Z

There is now a release version, try using this as an alias instead

:hot-load-deps
  {:extra-deps {org.clojure/tools.deps.alpha {:mvn/version "0.8.695"}}}

practicalli-john 2020-06-27T12:33:07.144700Z

I’ve pushed a commit to the GitHub repository with the updated alias. Let me know if this helps. If not, can you show which library you are trying to not load. Thank you.

euccastro 2020-06-27T20:01:56.145Z

thanks! it may be my Java version (11) then. I got the exception when trying to require clojure.tools.deps.alpha.repl, even before I got to try to load a library. unfortunately tools.deps.alpha v0.8.695 doesn't even contain that namespace, and the master branch doesn't contain any occurrence of the add-lib symbol, so that's probably not in any release yet

practicalli-john 2020-06-27T20:16:07.145200Z

Nope, it was me... I missed some extra config to make it wor

practicalli-john 2020-06-27T20:17:05.145400Z

I've just pushed an update to the practicalli/clojure-deps-edn GitHub repository with the fix. This works when I tested it in the REPL. I used rebel readline, but should work in any REPL

practicalli-john 2020-06-27T20:29:58.145600Z

I've published a quick guide to the very unofficial hot loading http://practicalli.github.io/clojure/alternative-tools/clojure-tools/hot-load-dependencies.html . I would be interested to hear how you get on and what libraries you are hot-loading, especially what works and what doesn't work. thanks.

euccastro 2020-06-27T20:31:23.145800Z

works perfectly now, thank you very much!

euccastro 2020-06-27T20:31:42.146Z

(tested in the plain clj REPL)

euccastro 2020-06-27T20:37:01.146200Z

also tested in cider+nREPL

practicalli-john 2020-06-27T21:14:13.146500Z

Be aware that this is totally unsupported approach and it may break unexpectedly in the very near future. I will be documenting some other approaches to manage the REPL experience in a more typical way.

👍 1
euccastro 2020-06-29T03:20:50.147Z

for one thing, when loading this alias clojure.tools.namespace.repl/refresh (as invoked by e.g. integrant.repl/reset stops working:

:cause "Unable to resolve symbol: skip-wiki in this context"
 :via
 [{:type clojure.lang.Compiler$CompilerException
   :message "Syntax error compiling at (clojure/tools/deps/alpha/script/generate_manifest2.clj:9:1)."
   :data #:clojure.error{:phase :compile-syntax-check, :line 9, :column 1, :source "clojure/tools/deps/alpha/script/generate_manifest2.clj"}
   :at [clojure.lang.Compiler analyze "Compiler.java" 6808]}
  {:type java.lang.RuntimeException
   :message "Unable to resolve symbol: skip-wiki in this context"
   :at [clojure.lang.Util runtimeException "Util.java" 221]}]

euccastro 2020-06-29T03:21:51.147200Z

I'll try using clojure.tools.namespace.repl/disable-reload! in some namespaces

euccastro 2020-06-29T04:02:47.147400Z

this worked (tailored to my own needs, since I was having problems with figwheel-main too; for the sake of dep hotloading I guess just filtering out .gitlibs/* would work)

(apply clojure.tools.namespace.repl/set-refresh-dirs
       (for [root (clojure.java.classpath/classpath-directories)
             :when (and (or (str/starts-with? root "dev/")
                            (str/starts-with? root "src/"))
                        (not (str/includes? root "/cljs/"))
                        (not (str/ends-with? root "/cljs")))
             f (file-seq root)
             :when (.isDirectory f)]
         f))

practicalli-john 2020-06-29T10:22:55.147700Z

I would not use add-lib if using a component system like integrant, as integrant (or mount) would be used to manage reloading of the repl. Integrant will be around for a while and supported, add-lib is not.

euccastro 2020-07-01T12:44:17.148500Z

I don't understand. they serve different purposes. integrant can't hotload dependencies. anyway, the real collision was with clojure.tools.namespace.repl/refresh , which as I said was causing problems elsewhere because it was trying to (re)load too many files. restricting the refresh directories to my own source code was a good idea anyway

practicalli-john 2020-06-27T06:24:49.139100Z

I will take a look after today’s broadcast. It may be the version of Java used, Java 8 should work, Java 11 hopefully works. Other versions of Java may not. This library is not finalised yet, hence the alpha in the name.

practicalli-john 2020-06-27T09:13:15.141800Z

The plan for next week is to look at continuous integration of Clojure apps on Circle CI, especially how to do Clojure deps.edn projects. Using Leiningen apps to CircleCI seems pretty straight forward https://circleci.com/docs/2.0/language-clojure/ I'll document how to do deps.edn projects during the week and cover it next broadcast. There are some example Circle CI configurations for clojure cli projects in this current issue, along with ideas of content to create https://github.com/practicalli/clojure-practicalli-content/issues/183