indygreg / indygreg/PyOxidizer

Packaging monorepo's sources

Open
#735 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Rust
Stars
6.2k
Forks
256
PR merge metrics
No merged PRs in 30d

Description

I'm struggling configuring PyOxidizer for a monorepo scenario.

My project has the following structure:

- proj1
- cli
- lib
- module1
- module2
- ...
- ui
- pyoxidizer.bzl
- ... [lot of things]
- proj2
- ...

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.:

```starlark
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:

- dist
- proj1
- cli
- lib
- module1

```starlark
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.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the monorepo layout in pyoxidizer.bzl and examining the behavior of exe.read_package_root with the shown paths and packages. Determine whether a supported configuration can preserve proj1.lib.module1 imports without the temporary dist directory; done would be a working example or a clearly documented limitation.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.