polylith 2025-05-29

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

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?

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

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.

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?

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

interesting

Yes, that's an alternative solution

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

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

love it, thanks!

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

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