Skip to content

[Bug]: py_layers.bzl's interpreter layer also fetches dependencies  #311

Description

@harshalparekh6

What happened?

While adopting rules_oci for python using the macro py_oci_image, I noticed non-interpreter files in the interpreter layer. Some of the site-packages have compiled modules for cpython-*, which pass the regex for interpreter (screenshot attached).

.../bazel-bin/services/services_image.interpreter_tar_manifest.spec:

services/service_name/service.runfiles/pip_parse_name_sqlalchemy/site-packages/sqlalchemy/cimmutabledict.cpython-39-x86_64-linux-gnu.so uid=0 gid=0 time=1672560000 mode=0755 type=file content=external/pip_parse_name_sqlalchemy/site-packages/sqlalchemy/cimmutabledict.cpython-39-x86_64-linux-gnu.so

image

Should be a simple fix:

cmd = "grep '{}' $< | grep -v '{}' >$@".format(PY_INTERPRETER_REGEX, SITE_PACKAGES_REGEX),

Happy to open a PR!

Version

Development (host) and target OS/architectures:

Output of bazel --version:

Version of the Aspect rules, or other relevant rules from your
WORKSPACE or MODULE.bazel file:

Language(s) and/or frameworks involved:

How to reproduce

No response

Any other information?

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions