polylith

Joe R. Smith 2025-05-29T12:25:30.359399Z

is there any way to have multiple namespace segments constitute a component name? e.g., <base.ns.segments>.my.comp.interface ?

seancorfield 2025-05-29T14:01:47.265169Z

Not at present, no. Can you explain why you would want this, rather than <base.ns.segments>.my-comp.interface and components/my-comp/src/base/ns/segments/my_comp/interface.clj?

Joe R. Smith 2025-05-29T15:35:34.096049Z

I have a group of components that are names like: <base>.stats.core <base>.stats.datagen <base>.stats.linalg etc and I like having them under a corresponding stats directory. Also, if published as separate artifacts in the future I want them to share a groupid of <base>.stats

Joe R. Smith 2025-05-29T15:36:58.685379Z

further refinement/decomposition of components might make sense, too, e.g.: <base>.stats.datagen.mrw Since components have a single interface I like to be fairly granular.

seancorfield 2025-05-29T16:13:51.621619Z

Well, you can write the implementation however you want in terms of ns structure. Only the interface ns is "fixed", but you can have <base.ns.segments>.stats.interface.core, <base.ns.segments>.stats.interface.datagen, <base.ns.segments>.stats.interface.linalg, etc. Does that give you enough granularity?

seancorfield 2025-05-29T16:14:23.410619Z

I.e., the interface can be specified as multiple separate "APIs", all within one component.

Joe R. Smith 2025-05-29T16:14:39.263499Z

interesting

Joe R. Smith 2025-05-29T16:15:01.383519Z

Yes, that's an alternative solution

Joe R. Smith 2025-05-29T16:15:55.853509Z

so, I can require those separate interface namespaces in other components and polylith won't yell at me?

seancorfield 2025-05-29T16:17:33.687539Z

Correct. An example from work:

> tree components/elastic-search/src/
components/elastic-search/src/
└── ws
    └── elastic_search
        ├── common.clj
        ├── impl.clj
        ├── interface
        │   ├── common.clj
        │   └── results.clj
        ├── interface.clj
        └── results.clj

3 directories, 6 files
So we have ws.elastic-search.interface for general stuff but also ws.elastic-search.interface.common and ws.elastic-search.interface.results

Joe R. Smith 2025-05-29T16:17:50.382799Z

love it, thanks!

seancorfield 2025-05-29T16:18:14.364849Z

And then in another component:

(ns ws.search.impl
  "Top-level search functionality. Knows about sources, filters, and
  how to build results."
  (:require [ws.elastic-search.interface.results :as results]
            [ws.search.filters :as filters]
            [ws.search.sources :as sources]))

👍 1
seancorfield 2025-05-29T16:20:08.756459Z

(`ws.search` also has a multi-part interface)