cool-easter-32542
06/05/2023, 3:01 AMfrom ..file1 import *. It does understand from ..file1 import func, though.
This reproducer constructs a directory structure like:
.
├── pants.toml
└── src
└── a
├── BUILD
├── file1.py
└── file2.py
where file2.py has from .file1 import *. It runs pants peek src/a/file2.py with both the python parser (which shows a dependency on src/a/file1.py) and with the Rust parser (which doesn't). Unlike #19173, there's no inference warnings either.
cd $(mktemp -d)
cat > pants.toml <<EOF
[GLOBAL]
pants_version = "2.17.0rc0"
backend_packages = ["pants.backend.python"]
[python]
interpreter_constraints = [">=3.8"]
[python-infer]
use_rust_parser = false
EOF
# set up the file structure:
mkdir -p src/a
touch src/a/file1.py
echo "from .file1 import *" > src/a/file2.py
echo "python_sources()" > src/a/BUILD
tree .
# OK: with Python parser `"dependencies": ["src/a/file1.py"]`
pants peek src/a/file2.py
# flip to the rust parser
sed -i '' 's/use_rust_parser = false/use_rust_parser = true/' pants.toml
# BUG: with Rust parser `"dependencies": []`
pants peek src/a/file2.py
Pants version
2.17.0rc0
OS
macOS
Additional info
#19173
pantsbuild/pantscool-easter-32542
06/06/2023, 1:19 AMcool-easter-32542
06/06/2023, 1:19 AM