piptools._internal._pip_api.package_finder module

PackageFinder interfaces for pip-tools.

Because the PackageFinder class itself has evolved over pip’s lifetime, these helpers provide compatible interfaces which wrap methods and attributes.

piptools._internal._pip_api.package_finder.finder_allows_all_prereleases(finder: PackageFinder) bool

Check if a package finder will get prereleases for all requirements.

On older pip versions, this is not specific to the requirement, but on newer ones it is. However, --pre is translated internally to ":all:" on those versions.

piptools._internal._pip_api.package_finder.finder_allows_prereleases_of_req(finder: PackageFinder, ireq: InstallRequirement) bool

Check if a package finder will get prereleases for a given requirement.

On older pip versions, this is not specific to the requirement, but on newer ones it is.

piptools._internal._pip_api.package_finder.get_pip_request_failed_exception_types() tuple[type[Exception], ...]

Get the error types which indicate a connection failure, as might be experienced by a client trying to reach an index server’s JSON API when that API is not available.

These are only the errors that indicate some kind of failure to connect. Errors about SSL configuration, etc, should not be included here, so that they raise all the way to the user.

This functionality is provided as a cached function rather than a constant to defer the work of attribute lookups until it is actually needed. This increases the resilience of some pip-tools usages to changes in pip, for when pip-tools is used with new and untested versions.