Hi! Continuing a discussion here about Polylith that started in the #architecture channel…
I’ve just added :poly
as an alias in my dot-clojure file (once I’ve pushed it to GH, it’ll be in the README as well for folks to see).
The docs say you can run clj -M:poly info
but that says:
The command can only be executed from the workspace root, or by also passing in :: or ws-dir:DIR.
I was sort of expecting help on “what to do next?” but it sounds like info
is not for that?Next I tried:
$ clojure -M:poly
Unknown command ''. Type 'poly help' for help.
So maybe for both of those situations, offer help instead of the error?Help does indeed provide a good amount of information, but I want to confirm I have the right version: I added :poly
as a :git/url
with the latest SHA from master (and I saw it being git clone
’d) but the help shows the last released version:
$ clojure -M:poly help
Poly 0.1.0-alpha9 (2020-12-23) - <https://github.com/polyfy/polylith>
...
Is that just because the version/date string hasn’t been changed yet?…let me check.
Yes, 0.1.0-alpha9 is the latest released version.
I created a new workspace per the install guide:
$ clojure -M:poly create w name:polyex top-ns:seancorfield.hello
It would be nice if it printed out a confirmation of what it did.Right, but running :poly
based on the latest SHA from master and being told it’s 0.1.0-alpha9 from December made me think it’s not running the latest version from GH — what am I missing?
We have went with the “Unix style”, that are quite silent when you create things (like a directory) and only print out things if something goes wrong or if you are expected to do something. We could be more clear about that in the documentation though.
Also, after cd polyex
I tried to run this in the brand new workspace:
$ clojure -M:poly info
Error building classpath. Prefix sha not supported, use full sha for polyfy/polylith
😞The generated deps.edn
file has:
:sha "INSERT_LATEST_SHA_HERE"
which causes that error.Yes, the documentation says that you should update the string “INSERT_LATEST_SHA_HERE”…
I did that in my dot-clojure file.
In the ./deps.edn file at the root?
My ~/.clojure/deps.edn
file.
As in what’s in https://github.com/seancorfield/dot-clojure 🙂
(I haven’t pushed the change that contains :poly
yet because I wanted to kick the tires first)
I’m just saying that it’s a very poor experience to have added :poly
as an alias to your user deps.edn
file, generate a new workspace, and then have :poly
stop working!
But the dot-clojure project’s deps.edn
file is not a valid workspace file (it doesn’t have the :polylith
keyword) or does it?
Your installation instructions say to add :poly
as an alias to “your deps.edn
” — and since folks won’t yet have created a Polylith workspace, they’ll add it to the user deps.edn
file which is where people expect to add tooling they want to use globally.
So that’s where I added it, and updated the :sha
value, so I could run the tool to create a workspace.
(after struggling to find how to get the help displayed!)
Then I went into this brand new workspace that I had created with the (global) :poly
alias and tried to run clojure -M:poly info
— because, again, that’s what your installation instructions implied I would be able to do.
And it did not work because the generated project hides the global alias that users would have added above, to get the Polylith tool working in the first place.
So… moving on…
I edited the project deps.edn
file to comment out the local :poly
alias so I could continue to use my global alias.
This is valid input. We should move the section “Use the Polylith Tool as a dependency” further down the documentation, when the workspace is actually created. Good feedback.
Are you using Mac?
Yes, but that’s not relevant. I don’t want to install the command-line tool when I can just use it as an alias from my user deps.edn
file and have it available on all my machines.
Okay, I understand.
Anyway, I then tried to run the poly info
command again and…
$ clojure -M:poly info
WARNING: Specified path /Users/sean/.gitlibs/libs/polylith/clj-poly/ec38a83db7597e6f6f33dfbc1e4da665807ab091/components/change/src is external to project /Users/sean/.gitlibs/libs/polylith/clj-poly/ec38a83db7597e6f6f33dfbc1e4da665807ab091/projects/poly
WARNING: Specified path /Users/sean/.gitlibs/libs/polylith/clj-poly/ec38a83db7597e6f6f33dfbc1e4da665807ab091/components/command/src is external to project /Users/sean/.gitlibs/libs/polylith/clj-poly/ec38a83db7597e6f6f33dfbc1e4da665807ab091/projects/poly
WARNING: Specified path /Users/sean/.gitlibs/libs/polylith/clj-poly/ec38a83db7597e6f6f33dfbc1e4da665807ab091/components/common/src is external to project /Users/sean/.gitlibs/libs/polylith/clj-poly/ec38a83db7597e6f6f33dfbc1e4da665807ab091/projects/poly
WARNING: Specified path /Users/sean/.gitlibs/libs/polylith/clj-poly/ec38a83db7597e6f6f33dfbc1e4da665807ab091/components/creator/src is external to project /Users/sean/.gitlibs/libs/polylith/clj-poly/ec38a83db7597e6f6f33dfbc1e4da665807ab091/projects/poly
WARNING: Specified path /Users/sean/.gitlibs/libs/polylith/clj-poly/ec38a83db7597e6f6f33dfbc1e4da665807ab091/components/creator/resources is external to project /Users/sean/.gitlibs/libs/polylith/clj-poly/ec38a83db7597e6f6f33dfbc1e4da665807ab091/projects/poly
WARNING: Specified path /Users/sean/.gitlibs/libs/polylith/clj-poly/ec38a83db7597e6f6f33dfbc1e4da665807ab091/components/deps/src is external to project /Users/sean/.gitlibs/libs/polylith/clj-poly/ec38a83db7597e6f6f33dfbc1e4da665807ab091/projects/poly
WARNING: Specified path /Users/sean/.gitlibs/libs/polylith/clj-poly/ec38a83db7597e6f6f33dfbc1e4da665807ab091/components/file/src is external to project /Users/sean/.gitlibs/libs/polylith/clj-poly/ec38a83db7597e6f6f33dfbc1e4da665807ab091/projects/poly
WARNING: Specified path /Users/sean/.gitlibs/libs/polylith/clj-poly/ec38a83db7597e6f6f33dfbc1e4da665807ab091/components/git/src is external to project /Users/sean/.gitlibs/libs/polylith/clj-poly/ec38a83db7597e6f6f33dfbc1e4da665807ab091/projects/poly
WARNING: Specified path /Users/sean/.gitlibs/libs/polylith/clj-poly/ec38a83db7597e6f6f33dfbc1e4da665807ab091/components/help/src is external to project /Users/sean/.gitlibs/libs/polylith/clj-poly/ec38a83db7597e6f6f33dfbc1e4da665807ab091/projects/poly
WARNING: Specified path /Users/sean/.gitlibs/libs/polylith/clj-poly/ec38a83db7597e6f6f33dfbc1e4da665807ab091/components/lib/src is external to project /Users/sean/.gitlibs/libs/polylith/clj-poly/ec38a83db7597e6f6f33dfbc1e4da665807ab091/projects/poly
WARNING: Specified path /Users/sean/.gitlibs/libs/polylith/clj-poly/ec38a83db7597e6f6f33dfbc1e4da665807ab091/components/path-finder/src is external to project /Users/sean/.gitlibs/libs/polylith/clj-poly/ec38a83db7597e6f6f33dfbc1e4da665807ab091/projects/poly
WARNING: Specified path /Users/sean/.gitlibs/libs/polylith/clj-poly/ec38a83db7597e6f6f33dfbc1e4da665807ab091/components/shell/src is external to project /Users/sean/.gitlibs/libs/polylith/clj-poly/ec38a83db7597e6f6f33dfbc1e4da665807ab091/projects/poly
WARNING: Specified path /Users/sean/.gitlibs/libs/polylith/clj-poly/ec38a83db7597e6f6f33dfbc1e4da665807ab091/components/test-helper/src is external to project /Users/sean/.gitlibs/libs/polylith/clj-poly/ec38a83db7597e6f6f33dfbc1e4da665807ab091/projects/poly
WARNING: Specified path /Users/sean/.gitlibs/libs/polylith/clj-poly/ec38a83db7597e6f6f33dfbc1e4da665807ab091/components/text-table/src is external to project /Users/sean/.gitlibs/libs/polylith/clj-poly/ec38a83db7597e6f6f33dfbc1e4da665807ab091/projects/poly
WARNING: Specified path /Users/sean/.gitlibs/libs/polylith/clj-poly/ec38a83db7597e6f6f33dfbc1e4da665807ab091/components/test-runner/src is external to project /Users/sean/.gitlibs/libs/polylith/clj-poly/ec38a83db7597e6f6f33dfbc1e4da665807ab091/projects/poly
WARNING: Specified path /Users/sean/.gitlibs/libs/polylith/clj-poly/ec38a83db7597e6f6f33dfbc1e4da665807ab091/components/user-config/src is external to project /Users/sean/.gitlibs/libs/polylith/clj-poly/ec38a83db7597e6f6f33dfbc1e4da665807ab091/projects/poly
WARNING: Specified path /Users/sean/.gitlibs/libs/polylith/clj-poly/ec38a83db7597e6f6f33dfbc1e4da665807ab091/components/user-input/src is external to project /Users/sean/.gitlibs/libs/polylith/clj-poly/ec38a83db7597e6f6f33dfbc1e4da665807ab091/projects/poly
WARNING: Specified path /Users/sean/.gitlibs/libs/polylith/clj-poly/ec38a83db7597e6f6f33dfbc1e4da665807ab091/components/util/src is external to project /Users/sean/.gitlibs/libs/polylith/clj-poly/ec38a83db7597e6f6f33dfbc1e4da665807ab091/projects/poly
WARNING: Specified path /Users/sean/.gitlibs/libs/polylith/clj-poly/ec38a83db7597e6f6f33dfbc1e4da665807ab091/components/validator/src is external to project /Users/sean/.gitlibs/libs/polylith/clj-poly/ec38a83db7597e6f6f33dfbc1e4da665807ab091/projects/poly
WARNING: Specified path /Users/sean/.gitlibs/libs/polylith/clj-poly/ec38a83db7597e6f6f33dfbc1e4da665807ab091/components/version/src is external to project /Users/sean/.gitlibs/libs/polylith/clj-poly/ec38a83db7597e6f6f33dfbc1e4da665807ab091/projects/poly
WARNING: Specified path /Users/sean/.gitlibs/libs/polylith/clj-poly/ec38a83db7597e6f6f33dfbc1e4da665807ab091/components/workspace/src is external to project /Users/sean/.gitlibs/libs/polylith/clj-poly/ec38a83db7597e6f6f33dfbc1e4da665807ab091/projects/poly
WARNING: Specified path /Users/sean/.gitlibs/libs/polylith/clj-poly/ec38a83db7597e6f6f33dfbc1e4da665807ab091/components/workspace-clj/src is external to project /Users/sean/.gitlibs/libs/polylith/clj-poly/ec38a83db7597e6f6f33dfbc1e4da665807ab091/projects/poly
WARNING: Specified path /Users/sean/.gitlibs/libs/polylith/clj-poly/ec38a83db7597e6f6f33dfbc1e4da665807ab091/components/ws-explorer/src is external to project /Users/sean/.gitlibs/libs/polylith/clj-poly/ec38a83db7597e6f6f33dfbc1e4da665807ab091/projects/poly
WARNING: Specified path /Users/sean/.gitlibs/libs/polylith/clj-poly/ec38a83db7597e6f6f33dfbc1e4da665807ab091/bases/poly-cli/src is external to project /Users/sean/.gitlibs/libs/polylith/clj-poly/ec38a83db7597e6f6f33dfbc1e4da665807ab091/projects/poly
stable since: 38686f2
projects: 1 interfaces: 0
bases: 0 components: 0
project alias source
--------------------------
development dev x--
interface brick dev
---------------- ---
I know this is an issue you’re working on — but many other folks trying Polylith for the first time will not know that.
Yes, good point. You could try the issue-66
branch that I’m working on. It’s not ready for production, but you should get rid of all these warnings at least.
Thanks, good to know. Will try that in a minute.
2d89676724e98d4c1b858c28c452cf2a64fc1b1c
Here’s my next complaint(!)… So I fired up VS Code to edit this new project and .cpcache
and .lsp
folders appeared: common tooling folders like that should probably be in the default .gitignore
file you generate.
With that new SHA:
$ clojure -M:poly info
Checking out: <https://github.com/polyfy/polylith.git> at 2d89676724e98d4c1b858c28c452cf2a64fc1b1c
stable since: 38686f2
projects: 1 interfaces: 0
bases: 0 components: 0
project alias source
--------------------------
development dev x--
interface brick dev
---------------- ---
Excellent!But you will have to create the workspace again, because it will not have the :polylith
keyword in ./deps.edn
but instead store them in ./workspace.edn
.
OK, good to know. On it…
Yup, that went more smoothly:
(! 1031)-> clojure -M:poly create w name:polyex top-ns:seancorfield.hello
Fri Mar 26 14:01:15
(sean)-(jobs:0)-(~/clojure)
(! 1032)-> cd polyex/
Fri Mar 26 14:01:22
(sean)-(jobs:0)-(~/clojure/polyex)
(! 1033)-> clojure -M:poly info
Error building classpath. Prefix sha not supported, use full sha for polyfy/polylith
Fri Mar 26 14:01:29
(sean)-(jobs:0)-(~/clojure/polyex)
(! 1034)-> clojure -M:poly info
stable since: ff4060c
projects: 1 interfaces: 0
bases: 0 components: 0
project alias source
--------------------------
development dev x--
interface brick dev
---------------- ---
(I forgot to #_#_:poly
in the generated deps.edn
again but it ran once I did that)Good to see the Polylith stuff removed from deps.edn
. Alex has said tools should not add top-level keys there (but it would be OK to add it under an alias, since aliases could just be data).
(but poly
would need to read the project basis to be able to lookup the alias value)
We decided to put all workspace configuration in workspace.edn
at the root. Feels quite clean to me.
Yup, nice and clean. I would have complained about it being in deps.edn
🙂
The documentation is also updated in the issue-66 branch, so it should be useful.
Each component and base have their own deps.edn
file also and that worked out quite well also.
Yeah, each subproject in our monorepo has deps.edn
.
Did you read my blog post about how we did that in the end?
Yes, I read your blog post. I’m not sure I remember all the detalils though!
The components and bases are defined as :local/root
dependencies in each project’s deps.edn
file. The exception is the root ./deps.edn
file which uses :extra-paths
(for the :dev
and :test
aliases). The reason is that we couldn’t use the :loca-root
approach because the test
directories didn’t work out in the IDE.
Would you like me to summarize all of this conversation in an email and send it to you, so that Slack’s 10,000 message limit doesn’t cause it to be lost?
(although it’ll all be in both the ClojureVerse log website and on Zulip chat as well via the logging bots)
Yes, that would be nice.
Cool. Do you want to DM me an email address to send it to?
Sure, you can use info[at]polyfy[dot]com.
I’ll continue to work through the docs to build my first poly app and add any feedback from that as well…
Sounds cool!
I don’t want to keep you up later — I appreciate you hanging around to discuss/help.
No problem, this is my hobby 😉
I will be awake for at least one more hour, so no problem.
And one more (maybe obvious) thing, use the documentation for issue-66
.