indygreg / PyOxidizer

A modern Python application packaging and distribution tool
Mozilla Public License 2.0
5.51k stars 239 forks source link

Packaging monorepo's sources #735

Open koltyakov opened 9 months ago

koltyakov commented 9 months ago

I'm struggling configuring PyOxidizer for a monorepo scenario.

My project has the following structure:

The intention is to bundle executable for the proj1's CLI. CLI code imports some submodules, e.g. proj1.lib.module1.

exe.read_package_root doesn't seem to be a lot help. E.g.:

exe.add_python_resources(exe.read_package_root(
  path = ".",
  packages = ["cli"],
))

exe.add_python_resources(exe.read_package_root(
  path = "./lib",
  packages = ["module1"],
))

will end up copying cli and module1 packages to the top level, where from proj1.lib.module1 imports won't be resolved.

The only workaround worked was copying needed modules to a temp folder:

exe.add_python_resources(exe.read_package_root(
  path = "./dist",
  packages = ["proj1"],
))

Which seems too dirty and needs an extra configuration layer before running pyoxidizer build.

Would appreciate an example if it's feasible to package sources for such case.