When Pants packages a `python_distribution` `A` th...
# general
n
When Pants packages a
python_distribution
A
that depends on a first-party
python_distribution
B
(based on the sources resolve algorithm), it uses the pinned version of
B
(as expressed in its
python_artifact
in its
BUILD
file) for the
install_requires
entry of
B
in
A
's
setup.py
. How can this behavior be overridden so looser semantic versions of
B
are used instead and people don't get upset about overly restrictive distributions in their envs? :)
Oh wow, was right in front of me: https://www.pantsbuild.org/docs/python-distributions#mapping-source-files-to-distributions Just curious why this was chosen to be the default behavior?
Hmm, on second thought, not sure if the available options will work: 1.
strict
is not great as it requires users to unnecessarily upgrade other packages whenever a new version of
A
is released (edit: thinking about this more, I suppose this isn't that bad after all); 2.
compatible
in the context of a monorepo is effectively
strict
because the latest
A
must still be compatible with the latest
B
(that is,
A's
dependency on
B
is still lower-bounded by the latest version in
B
's
python_artifact
); 3.
any
is more problematic than
strict
. I guess this is sort of a hard problem in a monorepo. Probably the only way to do this completely right is to override and manually maintain? Does Pants provide a mechanism for that?