narrow-activity-17405
10/07/2021, 10:42 AMnarrow-activity-17405
10/07/2021, 1:56 PMimport B # noqa
to source files with import A
and let the dependency inference do its job, but that is also a kind of workaround. A centralized solution would be much better 🙂enough-analyst-54434
10/07/2021, 2:09 PMpython_requirement_library
target for this: https://www.pantsbuild.org/docs/reference-python_requirement_library
Like:
python_requirement_library(
name="a-fixed",
requirements=["a", "b"]
)
enough-analyst-54434
10/07/2021, 2:13 PMb
other code depends on and you want to keep that consistent, then use:
python_requirement_library(
name="a-fixed",
requirements=["a"],
dependencies=[":b"],
)
hundreds-father-404
10/07/2021, 3:57 PMrequirements.txt
? If so, I'm thinking we should improve the python_requirements
macro to let you make this type of association directly. Something like this:
python_requirements(
overrides={"Django": {"dependencies": [":setuptools"]}}
)
narrow-activity-17405
10/08/2021, 7:37 AMrequirements.txt
file and I'm relying on dependency inference. Only in a few exceptional cases, I have dependency specified in a BUILD
file. The approach suggested by @enough-analyst-54434 seems good, but if I understand it correctly, it would be necessary to specify dependency on "a-fixed" everywhere. The (possible) approach suggested by @hundreds-father-404 would let me continue relying on inference, right?narrow-activity-17405
10/08/2021, 7:41 AMhundreds-father-404
10/08/2021, 7:51 AMrequirements.txt
and only had the BUILD file version. Otherwise you'd have two targets describing the same 3rdparty dep, so dependency inference would be ambiguous
Pants doesn't care whether you define the requirement in requirements.txt
vs a BUILD file vs Poetry. But, I imagine that might be annoying to have to remove it from requirements.txt
Hence my feature idea for overrides
, so you can change the metadata without this awkward dance. It's not yet implemented, but I really want to get to it soon