How to manage and publish multiple libraries that might depend on each other #256
-
I've had some great time using polylith with poetry, but as the monorepo grows larger, some libraries we wrote as components for the applications in one monorepo are needed in other repo as well. So I need to publish these libraries as pypi packages, but I couldn't figure out a reasonable way to achieve this. I've read the documentation on building libraries, but I'm still kind of confused. Let's say the structure of the repo is something like this:
lib2 depends on lib1, and in the pyproject.toml of app1: [tool.poetry]
packages = [
{from = "../../bases", include = "apps/app1"},
{from = "../../components", include = "libs/lib1"},
{from = "../../components", include = "libs/lib2"},
] What should I do if I want to publish lib1 and lib2 as 2 pypi packages, and avoiding shipping the code of lib1 in the wheel package built for lib2? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
Hi @inoc603! If you are going to publish libraries from your Polylith repo, you might want to look into the code-generation features of the If I understand your question about An alternative approach: In this case, maybe the libraries |
Beta Was this translation helpful? Give feedback.
Hi @inoc603!
If you are going to publish libraries from your Polylith repo, you might want to look into the code-generation features of the
build-project
command (i.e.--with-top-namespace
). This is useful if a user app will install more than one library originated from the monorepo. This, because they share the same top namespace and since Python installs libraries in a shared & flat structure it might cause unwanted problems (such as when uninstalling or updating one of those packages).If I understand your question about
lib1
andlib2
: if the second library depends on the first one I think it makes sense to include it. Otherwise the second library would be broken, right?An alternative…