piptools._compat.pip_compat module

class piptools._compat.pip_compat.Distribution(key: 'str', version: 'str', requires: 'Iterable[Requirement]', direct_url: 'DirectUrl | None')

Bases: object

classmethod _from_importlib(dist: _ImportLibDist) Distribution

Mimic pkg_resources.Distribution.requires for the case of no extras.

This doesn’t fulfill that API’s extras parameter but satisfies the needs of pip-tools.

classmethod _from_pkg_resources(dist: Distribution) Distribution
direct_url: DirectUrl | None
classmethod from_pip_distribution(dist: BaseDistribution) Distribution
key: str
requires: Iterable[Requirement]
version: str

Bases: Link

Wrapper for pip’s Link class.

_hashes
_parsed_url
_path
_url: str
comes_from
egg_fragment
property file_path: str
metadata_file_data
requires_python
upload_time
yanked_reason
piptools._compat.pip_compat._is_remote_pip_uri(value: str) bool

Test a string to see if it is a URI treated as a remote file in pip. Specifically this means that it’s a ‘file’, ‘http’, or ‘https’ URI.

The test is performed by trying a URL parse and reading the scheme.

piptools._compat.pip_compat._normalize_comes_from_location(original_comes_from: str, /) str

Convert a comes_from path to a posix-style path.

This is the rewrite rule when -r or -c appears in comes_from data and the input path was absolute, meaning we should not relativize the locations.

The -r or -c qualifier is retained, and the path is converted to posix style.

piptools._compat.pip_compat._relativize_comes_from_location(original_comes_from: str, /) str

Convert a comes_from path to a relative posix path.

This is the rewrite rule used when -r or -c appears in comes_from data with an absolute path.

The -r or -c qualifier is retained, the path is relativized with respect to the CWD, and the path is converted to posix style.

piptools._compat.pip_compat._rewrite_comes_from_to_hardcoded_stdin_value(_: str, /) str

Produce the hardcoded comes_from value for stdin.

piptools._compat.pip_compat.create_wheel_cache(cache_dir: str, format_control: str | None = None) WheelCache
piptools._compat.pip_compat.get_dev_pkgs() set[str]
piptools._compat.pip_compat.parse_requirements(filename: str, session: PipSession, finder: PackageFinder | None = None, options: Values | None = None, constraint: bool = False, isolated: bool = False, comes_from_stdin: bool = False) Iterator[InstallRequirement]