<#21252 method to align install_requires of python...
# github-notifications
c
#21252 method to align install_requires of python_distribution with locked depdencies Issue created by cburroughs Is your feature request related to a problem? Please describe. Normally when one uses a
python_distribution
the intent is to create a "normal" python distribution with requirements that can be used as a library elsewhere. We have cases were we uses various managed runtimes where Docker/Pex is high friction, but we can
pip install
a wheel. When we do so we want to get a consistent result for all the normal reasons one would want a lockfile. We create a
python_distribution
target that includes "most" library-ish Python sources. Then with a plugin we add all of the locked transitive dependencies of said
python_sources
to the
python_distribution
as
install_requires
. This mostly works, but because these are combined (see below) with the "normal" unlocked requirements the
METADATA
ends up looking like:
Copy code
Requires-Dist: boto3-stubs[essential]
Requires-Dist: boto3-stubs ==1.33.13
This seems to work, but I'm not sure it is valid exactly and pip spends a lot of time trying to make sense of the duplicative but not conflicting requirements. I'd like a way to either: • tell
python_distribution
to use only locked requirements directly • a "really really know what I'm doing" flag so that
install_requires
past along are used as is. Snippet from `package_dists.py`:
Copy code
# NB: We are careful to not overwrite these values, but we also don't expect them to have been
    # set. The user must have gone out of their way to use a `SetupKwargs` plugin, and to have
    # specified `SetupKwargs(_allow_banned_keys=True)`.
    setup_kwargs.update(
        {
            "packages": (*sources.packages, *(setup_kwargs.get("packages", []))),
            "namespace_packages": (
                *sources.namespace_packages,
                *setup_kwargs.get("namespace_packages", []),
            ),
            "package_data": {**dict(sources.package_data), **setup_kwargs.get("package_data", {})},
            "install_requires": (*requirements, *setup_kwargs.get("install_requires", [])),
        }
    )
pantsbuild/pants