Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does rules_poetry understand target platforms / cross-compilation? #16

Open
njlr opened this issue Nov 3, 2022 · 1 comment
Open

Does rules_poetry understand target platforms / cross-compilation? #16

njlr opened this issue Nov 3, 2022 · 1 comment

Comments

@njlr
Copy link
Collaborator

njlr commented Nov 3, 2022

I was wondering how rules_poetry might handle this scenario:

  1. Host machine is macOS
  2. A py_binary called //:app with dependencies from rules_poetry
  3. And a Docker image called //:app_image constructed using container_image (from rules_docker) that is based on Linux AMD64 that contains the py_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?

@NathanHowell
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants