high-magician-46188
10/05/2022, 3:11 PM16:51:26.87 [WARN] Pants cannot infer owners for the following imports in the target proj_1/test/foo.py:
* numpy (line: 2)
Also with click
and other packages.
These packages are all in the req file.
What does it mean to own them in that case?high-magician-46188
10/05/2022, 3:11 PMhappy-kitchen-89482
10/05/2022, 3:14 PMhappy-kitchen-89482
10/05/2022, 3:14 PMhappy-kitchen-89482
10/05/2022, 3:14 PMhigh-magician-46188
10/05/2022, 3:15 PMhigh-magician-46188
10/05/2022, 3:15 PMgrep python_requirements -r .
returns no results.high-magician-46188
10/05/2022, 3:17 PMpants tailor ::
saved me a lot of work, it also got me to be dependent on it and to not understand the system.
As far as I can tell, the BUILD
files are temp files that are not really required due to 2 reasons:
1. They are auto-generated by the pants tailor ::
command.
2. There are hundreds of them, it is not rational to maintain so many config files.high-magician-46188
10/05/2022, 3:28 PMBUILD
file.
Also, after running pants tailor ::
and cat **/BUILD
I get something along the lines of:
...
python_sources()
python_sources()
python_sources()
...
python_sources()
python_test_utils(
name="test_utils",
)
python_tests(
name="tests",
)
python_tests(
name="tests",
)
...
python_tests(
name="tests",
)
python_tests(
name="tests",
)
python_tests(
name="tests",
)
python_tests(
name="tests",
)
python_sources()
python_sources()
python_sources()
python_sources()
python_sources()
python_sources()
python_sources()
python_sources()
python_sources()
python_sources()
python_sources()
python_sources()
python_sources()
python_sources()
python_sources()
python_sources()
...
witty-crayon-22786
10/05/2022, 4:05 PMpython_tests
for example: https://www.pantsbuild.org/docs/reference-python_testswitty-crayon-22786
10/05/2022, 4:06 PMextra_env_vars
, timeout
, tags
, resolve
, etc are frequently setwitty-crayon-22786
10/05/2022, 4:06 PMdependencies
witty-crayon-22786
10/05/2022, 4:08 PMnumpy
is declared in a requirements.txt
, and that file doesn’t have an owning target, then it won’t be loaded: you’ll need to include it in what gets tailoredhappy-kitchen-89482
10/05/2022, 4:23 PMhappy-kitchen-89482
10/05/2022, 4:24 PMhappy-kitchen-89482
10/05/2022, 4:24 PMhappy-kitchen-89482
10/05/2022, 4:27 PMpython_sources()
) the metadata is empty. And I get that this is annoying. The reason tailor creates those is that in the past they were necessary. And we still find them to be useful in practice, because they are an obvious place to add metadata when you need to. But - you could replace them with a smaller number of higher-level python_sources()
with recursive globs over their subdirs, if you wanted to. Tailor is smart enough to not try to regenerate for files that are already owned by some higher-up target.happy-kitchen-89482
10/05/2022, 4:29 PMhappy-kitchen-89482
10/05/2022, 4:32 PMhigh-magician-46188
10/05/2022, 5:49 PMhigh-magician-46188
10/22/2022, 8:20 AMpants tailor ::
2. Re-reading all of the docs under “Getting Started”, “Python”, “Writing Plugins” and a bit more.
3. Implement my own script to produce a global requirements.txt
for Pants.
4. Implement my own script to produce BUILD
files for Pants.
I now have a much better understanding (and progress).
My takeaway here for me is that the docs are helpful (in contrast to the usual stuff), so if you have a special use-case (like that fact that we have our own custom build-system that is not well supported by tailor
), you should probably just trudge through it.