Fork me on GitHub
#polylith
<
2021-03-26
>
seancorfield20:03:52

Hi! Continuing a discussion here about Polylith that started in the #architecture channel…

seancorfield20:03:37

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).

seancorfield20:03:44

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?

seancorfield20:03:55

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?

seancorfield20:03:41

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) - 
...
Is that just because the version/date string hasn’t been changed yet?

tengstrand20:03:31

…let me check.

tengstrand20:03:52

Yes, 0.1.0-alpha9 is the latest released version.

seancorfield20:03:08

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.

seancorfield20:03:14

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?

tengstrand20:03:37

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.

seancorfield20:03:53

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
😞

seancorfield20:03:50

The generated deps.edn file has:

:sha       "INSERT_LATEST_SHA_HERE"
which causes that error.

tengstrand20:03:44

Yes, the documentation says that you should update the string “INSERT_LATEST_SHA_HERE”…

seancorfield20:03:02

I did that in my dot-clojure file.

tengstrand20:03:38

In the ./deps.edn file at the root?

seancorfield20:03:53

My ~/.clojure/deps.edn file.

seancorfield20:03:31

(I haven’t pushed the change that contains :poly yet because I wanted to kick the tires first)

seancorfield20:03:12

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!

tengstrand20:03:00

But the dot-clojure project’s deps.edn file is not a valid workspace file (it doesn’t have the :polylithkeyword) or does it?

seancorfield20:03:01

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.

seancorfield20:03:27

So that’s where I added it, and updated the :sha value, so I could run the tool to create a workspace.

seancorfield20:03:41

(after struggling to find how to get the help displayed!)

seancorfield20:03:27

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.

seancorfield20:03:06

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.

seancorfield20:03:14

So… moving on…

seancorfield20:03:47

I edited the project deps.edn file to comment out the local :poly alias so I could continue to use my global alias.

tengstrand20:03:49

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.

tengstrand20:03:00

Are you using Mac?

seancorfield20:03:40

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.

tengstrand20:03:58

Okay, I understand.

seancorfield20:03:23

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
  ----------------   ---

seancorfield20:03:52

I know this is an issue you’re working on — but many other folks trying Polylith for the first time will not know that.

tengstrand20:03:12

Yes, good point. You could try the issue-66branch that I’m working on. It’s not ready for production, but you should get rid of all these warnings at least.

seancorfield20:03:32

Thanks, good to know. Will try that in a minute.

tengstrand20:03:07

2d89676724e98d4c1b858c28c452cf2a64fc1b1c

seancorfield20:03:26

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.

seancorfield21:03:30

With that new SHA:

$ clojure -M:poly info
Checking out:  at 2d89676724e98d4c1b858c28c452cf2a64fc1b1c
  stable since: 38686f2

  projects: 1   interfaces: 0
  bases:    0   components: 0

  project      alias  source
  --------------------------
  development  dev     x--  

  interface  brick   dev
  ----------------   ---
Excellent!

tengstrand21:03:33

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.

seancorfield21:03:49

OK, good to know. On it…

seancorfield21:03:07

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)

seancorfield21:03:01

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).

seancorfield21:03:41

(but poly would need to read the project basis to be able to lookup the alias value)

tengstrand21:03:27

We decided to put all workspace configuration in workspace.edn at the root. Feels quite clean to me.

seancorfield21:03:23

Yup, nice and clean. I would have complained about it being in deps.edn 🙂

tengstrand21:03:26

The documentation is also updated in the issue-66 branch, so it should be useful.

tengstrand21:03:06

Each component and base have their own deps.ednfile also and that worked out quite well also.

seancorfield21:03:22

Yeah, each subproject in our monorepo has deps.edn.

seancorfield21:03:34

Did you read my blog post about how we did that in the end?

tengstrand21:03:28

Yes, I read your blog post. I’m not sure I remember all the detalils though!

tengstrand21:03:40

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 testdirectories didn’t work out in the IDE.

seancorfield21:03:11

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?

seancorfield21:03:37

(although it’ll all be in both the ClojureVerse log website and on Zulip chat as well via the logging bots)

tengstrand21:03:40

Yes, that would be nice.

seancorfield21:03:03

Cool. Do you want to DM me an email address to send it to?

tengstrand21:03:59

Sure, you can use info[at]polyfy[dot]com.

3
seancorfield21:03:34

I’ll continue to work through the docs to build my first poly app and add any feedback from that as well…

tengstrand21:03:44

Sounds cool!

seancorfield21:03:06

I don’t want to keep you up later — I appreciate you hanging around to discuss/help.

tengstrand21:03:26

No problem, this is my hobby 😉

tengstrand21:03:07

I will be awake for at least one more hour, so no problem.

🦉 3
tengstrand21:03:40

And one more (maybe obvious) thing, use the documentation for issue-66 .

3