Does rules_poetry understand target platforms / cross-compilation?
njlr opened this issue · comments
I was wondering how rules_poetry
might handle this scenario:
- Host machine is macOS
- A
py_binary
called//:app
with dependencies fromrules_poetry
- And a Docker image called
//:app_image
constructed usingcontainer_image
(fromrules_docker
) that is based on Linux AMD64 that contains thepy_binary
Now, when doing bazel run //:app
, Poetry should install for the host machine (in this case macOS)
But when doing bazel build //:app_image
, Poetry should install for Linux AMD64, since this is the base of the Docker image
Is there a way to configure rules_poetry
for this?
Perhaps with two calls in the WORKSPACE
?
poetry(
name = "poetry_host",
lockfile = "//:poetry.lock",
pyproject = "//:pyproject.toml",
)
poetry(
name = "poetry_linux_amd64",
lockfile = "//:poetry.lock",
pyproject = "//:pyproject.toml",
target = [ "linux_x64" ],
)
Is this possible or even required?
I haven't check into this. If there are binary wheels available for the target platform it should be possible to make this work with transitions, though other language rules have been running into issues with rules_docker's transitions support. it would be a great feature though.