fresh-cat-90827
10/08/2024, 8:49 AMoverrides
? ๐งตfresh-cat-90827
10/08/2024, 8:49 AMhelloworld/translator/translator.py:lib
due to from helloworld.translator.translator import LanguageTranslator
)
2. The manually set dependencies (the JSON file is being read, so dependencies=[":translations"],
had to be set)
3. Anything from the overrides
field, if set. Currently there is none.
$ pants dependencies helloworld/greet/greeting.py
//:reqs#setuptools
//:reqs#types-setuptools
helloworld/greet:translations
helloworld/translator/translator.py:lib
Now, if I want just one file out of many that may be owned by a build target to depend on something extra (e.g. all files depend on a JSON file and just one file depends on a YAML file), one would intuitively want to do:
python_sources(
name="lib",
dependencies=[":translations"],
overrides={"greeting.py": {"dependencies": ["helloworld/main.py:lib"]}}
)
In this example picking main.py
to keep it simple. The main.py
does appear, however, the helloworld/greet:translations
is gone because the overrides
completely replaced the value of the dependencies
field of that target.
$ pants dependencies helloworld/greet/greeting.py
//:reqs#setuptools
//:reqs#types-setuptools
helloworld/main.py:lib
helloworld/translator/translator.py:lib
While we don't have an extends
field that would let to extend the dependencies (of course this would be applicable only to some fields -- it doesn't make sense to extend the timeout for instance), I don't think we have a way to make sure that only some of the files under a target generator get some extra dependencies without duplicating "common" dependencies that all files share?fresh-cat-90827
10/08/2024, 8:49 AMdependencies
and once in `overrides`:
python_sources(
name="lib",
dependencies=[":translations"],
overrides={"greeting.py": {"dependencies": [":translations", "helloworld/main.py:lib"]}}
)
fresh-cat-90827
10/08/2024, 8:50 AMcommon_deps = [":translations"]
python_sources(
name="lib",
dependencies=common_deps,
overrides={"greeting.py": {"dependencies": common_deps + ["helloworld/main.py:lib"]}}
)
which is not terrible, but not great eitherbroad-processor-92400
10/08/2024, 7:32 PM