hallowed-artist-8187
02/05/2024, 3:50 AMpkg1
|_BUILD <contains poetry_requirements>
|_pyproject.toml <specifies dependency on requests>
|_pgk1
|_BUILD <contains empty python requirements>
|_source.py <import requests>
pkg2
|_BUILD <contains poetry_requirements>
|_pyproject.toml <specifies dependency on pkg1>
|_pgk2
|_BUILD <contains empty python requirements>
|_source.py <uses pkg1.source>
Here, running tests for pkg2 fails because requests is missing.
From the docs, the solution seems to be to add these dependencies to BUILD files rather than relying purely on tailor. The only snag is I have way too many BUILD files to do this manually? Am I missing an easy solution?broad-processor-92400
02/05/2024, 4:04 AMimport requests , so it sounds like that's not working as expected. Some questions:
• Can you share your pants.toml configuration?
• Are there any warnings from pants when you run things?
• What does pants dependencies --transitive show for the various files?hallowed-artist-8187
02/05/2024, 4:10 AM[WARN] Pants cannot infer owners for the following imports in the target llama-index-core/llama_index/core/download/dataset.py:
* requests (line: 8)
* tqdm (line: 9)
[WARN] Pants cannot infer owners for the following imports in the target llama-index-core/llama_index/core/llama_dataset/base.py:
* openai.RateLimitError (line: 9)
* pandas.DataFrame (line: 10)
* tqdm (line: 8)
My pants.toml is
[GLOBAL]
pants_version = "2.19.0"
backend_packages = [
"pants.backend.python",
"pants.backend.experimental.python.lint.ruff",
"pants.backend.python.typecheck.mypy",
"pants.backend.python.lint.black",
]
[python]
interpreter_constraints = ['>=3.8.1']
[source]
marker_filenames = ["pyproject.toml"]hallowed-artist-8187
02/05/2024, 4:11 AMbroad-processor-92400
02/05/2024, 4:16 AMpython_requirement , python_requirements or poetry_requirements targets. I'm not in a position to help in detail, but often having duplicate dependencies within a single "resolve" is the problemhallowed-artist-8187
02/05/2024, 4:18 AMhallowed-artist-8187
02/05/2024, 4:46 AMBUILD files to remove ambiguity.
There's no "unsafe" option for it to just pick the first one in the list right? Might have to write a script to do this for me hahabroad-processor-92400
02/05/2024, 5:41 AMbroad-processor-92400
02/05/2024, 5:43 AMpyproject.toml that contains external dependencies), and then there's no ambiguity. You could potentially do this with a new pyproject.toml that has all the deps that's imported with a python_requirements target, and then delete any other targets (potentially using https://www.pantsbuild.org/2.18/reference/subsystems/python#tailor_requirements_targets to ensure that they're not re-added by tailor).