piptools.repositories package#
Submodules#
- piptools.repositories.base module
BaseRepository
BaseRepository.DEFAULT_INDEX_URL
BaseRepository._abc_impl
BaseRepository.allow_all_wheels()
BaseRepository.clear_caches()
BaseRepository.command
BaseRepository.find_best_match()
BaseRepository.finder
BaseRepository.get_dependencies()
BaseRepository.get_hashes()
BaseRepository.options
BaseRepository.session
- piptools.repositories.local module
LocalRequirementsRepository
LocalRequirementsRepository._abc_impl
LocalRequirementsRepository.allow_all_wheels()
LocalRequirementsRepository.clear_caches()
LocalRequirementsRepository.command
LocalRequirementsRepository.find_best_match()
LocalRequirementsRepository.finder
LocalRequirementsRepository.get_dependencies()
LocalRequirementsRepository.get_hashes()
LocalRequirementsRepository.options
LocalRequirementsRepository.session
ireq_satisfied_by_existing_pin()
- piptools.repositories.pypi module
FileStream
PyPIRepository
PyPIRepository.HASHABLE_PACKAGE_TYPES
PyPIRepository._abc_impl
PyPIRepository._available_candidates_cache
PyPIRepository._command
PyPIRepository._dependencies_cache
PyPIRepository._get_download_path()
PyPIRepository._get_file_hash()
PyPIRepository._get_hashes_from_pypi()
PyPIRepository._get_matching_candidates()
PyPIRepository._get_project()
PyPIRepository._get_req_hashes()
PyPIRepository._options
PyPIRepository.allow_all_wheels()
PyPIRepository.clear_caches()
PyPIRepository.command
PyPIRepository.find_all_candidates()
PyPIRepository.find_best_match()
PyPIRepository.finder
PyPIRepository.get_dependencies()
PyPIRepository.get_hashes()
PyPIRepository.options
PyPIRepository.resolve_reqs()
PyPIRepository.session
candidate_version()
open_local_or_remote_file()
Module contents#
- class piptools.repositories.LocalRequirementsRepository(existing_pins: Mapping[str, InstallationCandidate], proxied_repository: PyPIRepository, reuse_hashes: bool = True)#
Bases:
BaseRepository
The LocalRequirementsRepository proxied the _real_ repository by first checking if a requirement can be satisfied by existing pins (i.e. the result of a previous compile step).
In effect, if a requirement can be satisfied with a version pinned in the requirements file, we prefer that version over the best match found in PyPI. This keeps updates to the requirements.txt down to a minimum.
- _abc_impl = <_abc._abc_data object>#
- allow_all_wheels() Iterator[None] #
Monkey patches pip.Wheel to allow wheels from all platforms and Python versions.
- property command: InstallCommand#
Return an install command instance.
- find_best_match(ireq: InstallRequirement, prereleases: bool | None = None) InstallationCandidate #
Returns a pinned InstallRequirement object that indicates the best match for the given InstallRequirement according to the external repository.
- property finder: PackageFinder#
Returns a package finder to interact with simple repository API (PEP 503)
- get_dependencies(ireq: InstallRequirement) set[InstallRequirement] #
Given a pinned, URL, or editable InstallRequirement, returns a set of dependencies (also InstallRequirements, but not necessarily pinned). They indicate the secondary dependencies for the given requirement.
- get_hashes(ireq: InstallRequirement) set[str] #
Given a pinned InstallRequirement, returns a set of hashes that represent all of the files for a given requirement. It is not acceptable for an editable or unpinned requirement to be passed to this function.
- property session: PipSession#
Returns a session to make requests
- class piptools.repositories.PyPIRepository(pip_args: list[str], cache_dir: str)#
Bases:
BaseRepository
- HASHABLE_PACKAGE_TYPES = {'bdist_wheel', 'sdist'}#
The PyPIRepository will use the provided Finder instance to lookup packages. Typically, it looks up packages on PyPI (the default implicit config), but any other PyPI mirror can be used if index_urls is changed/configured on the Finder.
- _abc_impl = <_abc._abc_data object>#
- _get_download_path(ireq: InstallRequirement) str #
Determine the download dir location in a way which avoids name collisions.
- _get_hashes_from_pypi(ireq: InstallRequirement) dict[str, str] #
Builds a mapping from the release URLs to their hashes as reported by the PyPI JSON API for a given InstallRequirement.
- _get_matching_candidates(ireq: InstallRequirement) set[InstallationCandidate] #
Returns all candidates that satisfy the given InstallRequirement.
- _get_project(ireq: InstallRequirement) Any #
Return a dict of a project info from PyPI JSON API for a given InstallRequirement. Return None on HTTP/JSON error or if a package is not found on PyPI server.
API reference: https://warehouse.readthedocs.io/api-reference/json/
- _get_req_hashes(ireq: InstallRequirement) set[str] #
Collects the hashes for all candidates satisfying the given InstallRequirement. Computes the hashes for the candidates that don’t have one reported by their index.
- allow_all_wheels() Iterator[None] #
Monkey patches pip.Wheel to allow wheels from all platforms and Python versions.
This also saves the candidate cache and set a new one, or else the results from the previous non-patched calls will interfere.
- property command: InstallCommand#
Return an install command instance.
- find_best_match(ireq: InstallRequirement, prereleases: bool | None = None) InstallRequirement #
Returns a pinned InstallRequirement object that indicates the best match for the given InstallRequirement according to the external repository.
- property finder: PackageFinder#
Returns a package finder to interact with simple repository API (PEP 503)
- get_dependencies(ireq: InstallRequirement) set[InstallRequirement] #
Given a pinned, URL, or editable InstallRequirement, returns a set of dependencies (also InstallRequirements, but not necessarily pinned). They indicate the secondary dependencies for the given requirement.
- get_hashes(ireq: InstallRequirement) set[str] #
Given an InstallRequirement, return a set of hashes that represent all of the files for a given requirement. Unhashable requirements return an empty set. Unpinned requirements raise a TypeError.
- resolve_reqs(download_dir: str | None, ireq: InstallRequirement, wheel_cache: WheelCache) set[InstallationCandidate] #
- property session: PipSession#
Returns a session to make requests