This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-02-21
Channels
- # announcements (7)
- # babashka (16)
- # beginners (174)
- # biff (7)
- # calva (20)
- # cider (3)
- # clerk (6)
- # cljsrn (4)
- # clojure (98)
- # clojure-europe (57)
- # clojure-italy (3)
- # clojure-nl (1)
- # clojure-portugal (1)
- # clojure-spec (15)
- # clojure-uk (7)
- # code-reviews (3)
- # cursive (23)
- # data-science (1)
- # datomic (26)
- # dev-tooling (2)
- # emacs (5)
- # figwheel-main (4)
- # fulcro (3)
- # honeysql (20)
- # hyperfiddle (20)
- # malli (8)
- # membrane (31)
- # nextjournal (5)
- # pathom (1)
- # polylith (20)
- # re-frame (14)
- # reitit (8)
- # releases (2)
- # shadow-cljs (50)
- # specter (2)
- # sql (22)
- # xtdb (5)
We've been having a discussion in my org recently about dependencies in components. The discussion relates to how to manage dependencies when a component relies on another component. Most examples I've seen (and my previous experience in a different org) have listed the dependencies for components in the project deps.edn so a component A that depends on another component B would not reference it's dependency in the deps.edn in the component A. However, one of the engineers wants to manage the dependency of B on A in the component A deps.edn as that way anyone using component A doesn't need to scan the code of A to find the dependency on B. What is the current best practice and why?
Let’s see if I understand things correctly. Let’s rename things a bit first so that we have interface A and B, and the components Ac and Bc (the components that implement A and B). If Ac depends on the library a1, and Bc depends on library b1. Do you want Ac to depend on a1 and b1 (even though it has no dependencies itself on b1)?
Ac uses the interface B, and if we let another component Bc2 implement B, there are no guarantees that it will also specify b1. In this case I would let Ac depend on a1 and Bc depend on b1. If you use the :local/root
syntax, the project will pick up both a1 and b1 for you (if Ac and Bc are used).
The recommended way is to only specify the libraries the component itself uses, not other libraries only used by other components, and the reason is that they are not known, because components only know about interfaces.
And as a follow-up on this: poly deps
shows the the component dependencies -- we find that very helpful (although we'd like an option to flip the axes to make certain analyses easier).
Maybe as an option at the workspace level + maybe also as a parameter @U04V70XH6.
We would pretty much only use it x/y flipped so a workspace option would work for us (but a parameter would probably be better in general).
I opened an issue for that, right?
Please do that!
Polylith:
21 bases 440 files 76485 total loc,
138 components 685 files 59109 total loc,
21 projects 11 files 453 total loc,
total 1136 files 136047 total loc.
We're about to add three more components today!That’s cool! Nice to follow all the progress.
Sorry I've been busy and not responded to this but I think I wasn't clear on the question.
If we have interface A and B, and the components Ac and Bc (the components that implement A and B). If Ac depends on the COMPONENT interface B. Should it's dependency be specified in component Ac?
I.e. customer component calls a database component to get a connection or run a query
Let's say you have a component customer
. It gets its name from the directory workspace-name/components/customer
. Its interface can have almost any name, as long as it doesn't collide with a base name. If you don't give an interface name it will get the same name as the component name by default, in this case customer
and it will (often) live in the directory workspace-name/components/customer/src/topns/customer
(if the top namespace is set to topns
). If we for example let the database
component have db
as interface, then its interface would live in workspace-name/components/database/src/topns/db
. When the customer
component uses the db
interface then it doesn't know which concrete component it depends on, because this is decided by the projects. This is why each component only defines the libraries it uses itself. We could for example create a component dynamodb
with the interface db
that has another set of libraries, and use that instead of database
in one or several projects, and the customer
component wouldn't see any difference, because it only depends on the db
interface.
OK so that answers my question, why dependencies between components are defined in the project and not the components. Thx.
Hi guys! Since today, I have trouble with my CI (github) to download dependencies from maven. Do you have the same issue?
It seems like maven was having issues: https://status.maven.org/. Nothing related to Polylith since it failed fetching clojure/data.codec from maven repository.