Replies: 2 comments 1 reply
-
Looking at the stack overflow question in further detail, it doesn't handle well, the case where you pull in another non-external python library with a different package. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Right now there is no good way to do this and I am not sure if this is something that rules_python should implement. This could be better done as a separate ruleset that wraps the complexity in a reusable way. What you are asking probably needs to be implemented as a build rule and it needs to inspect the PyInfo providers to get the output structure right. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm posting this as a discussion in case there is a good solution I missed, but it's also kind of a feature request if there isn't a good solution.
I want to create a zip file for a python package for AWS lambda. For this to work as expected, it would need to have a layout that looks something like:
or even
That shouldn't be too hard to get right?
Nope.
It is surprisingly difficult to get a zip file in this format.
If I use py_binary and use the "python_zip_file" output group (which by the way is not documented anywhere), then my sources are under the full path from the bazel root. And the dependencies are under paths that are prefixed with the name of the pip_parse rule. And there is a separate launcher python script that is unneeded.
If I create a wheel (and again, I couldn't find any documentation outside of the actual source code), I still have the full path to the package in the output. But at least the dependencies are somewhat more logical. Although they are in a site_pacakges directory, which means they won't load correctly when the lambda executes.
I tried using
pkg_zip
, but in order for that to work, I need to explicitly list every transitive dependency, with appropriate strip_prefix rules, which isn't very practical.The most realistic solution right now is something like https://stackoverflow.com/a/72049294/2543666
But that is pretty complicated, and involves
Is there really not a better way to do this?
Beta Was this translation helpful? Give feedback.
All reactions