piptools._compat package¶
Submodules¶
- piptools._compat._tomllib_compat module
- piptools._compat.path_compat module
- piptools._compat.pip_compat module
- piptools._compat.tempfile_compat module
Module contents¶
- class piptools._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
extrasparameter but satisfies the needs of pip-tools.
- classmethod _from_pkg_resources(dist: Distribution) Distribution¶
- classmethod from_pip_distribution(dist: BaseDistribution) Distribution¶
- piptools._compat.canonicalize_name(name: str, *, validate: bool = False) NormalizedName¶
This function takes a valid Python package or extra name, and returns the normalized form of it.
The return type is typed as
NormalizedName. This allows type checkers to help require that a string has passed through this function before use.If validate is true, then the function will check if name is a valid distribution name before normalizing.
- Parameters:
- Raises:
InvalidName – If validate is true and the name is not an acceptable distribution name.
>>> from packaging.utils import canonicalize_name >>> canonicalize_name("Django") 'django' >>> canonicalize_name("oslo.concurrency") 'oslo-concurrency' >>> canonicalize_name("requests") 'requests'