You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I couldn't import a module from pip package that ships python modules with .pyi and .pyc files.
For example, I have a example_package that ships with the following file structure
Should be successful. But the py_library generated specifically excludes "**/*.pyc" from data. If I manually remove the "**/*.pyc" exclusion, the import statement works.
py_library(
name = "pkg",
srcs = glob(
["site-packages/**/*.py"],
exclude=[],
# Empty sources are allowed to support wheels that don't have any
# pure-Python code, e.g. pymssql, which is written in Cython.
allow_empty = True,
),
data = [] + glob(
["site-packages/**/*"],
exclude=["**/* *", "**/*.py", "**/*.pyc", "**/*.pyc.*", "**/*.dist-info/RECORD"],
),
# This makes this directory a top-level in the python import
# search path for anything that depends on this.
imports = ["site-packages"],
deps = [],
tags = ["pypi_name=example_package", "pypi_version=3.21.0"],
visibility = ["//visibility:public"],
)
🐞 bug report
Affected Rule
https://github.com/bazelbuild/rules_python/blob/main/docs/pypi-dependencies.md
Specifically
py_library
withname = "pkg"
generated byIs this a regression?
I don't know.
Description
I couldn't import a module from pip package that ships python modules with .pyi and .pyc files.
For example, I have a example_package that ships with the following file structure
According to https://peps.python.org/pep-3147/#flow-chart,
Should be successful. But the
py_library
generated specifically excludes"**/*.pyc"
fromdata
. If I manually remove the"**/*.pyc"
exclusion, the import statement works.How
🔬 Minimal Reproduction
import foo from example_package
should work but errors out with module not found error.🔥 Exception or Error
🌍 Your Environment
Operating System:
Output of
bazel version
:Rules_python version:
Anything else relevant?
The text was updated successfully, but these errors were encountered: