requirementslib package¶
-
class
requirementslib.
Lockfile
(path: pathlib.Path = NOTHING, requirements: list = NOTHING, dev_requirements: list = NOTHING, projectfile: requirementslib.models.project.ProjectFile = NOTHING, lockfile: plette.lockfiles.Lockfile = NOTHING, newlines: str = 'n')[source]¶ Bases:
object
-
as_requirements
(include_hashes=False, dev=False)[source]¶ Returns a list of requirements in pip-style format
-
default
¶
-
dev_requirements
¶
-
dev_requirements_list
¶
-
develop
¶
-
extended_keys
¶
-
classmethod
from_data
(path, data, meta_from_project=True)[source]¶ Create a new lockfile instance from a dictionary.
Parameters:
-
get_requirements
(dev=True, only=False)[source]¶ Produces a generator which generates requirements from the desired section.
Parameters: dev (bool) – Indicates whether to use dev requirements, defaults to False Returns: Requirements from the relevant the relevant pipfile Return type: Requirement
-
classmethod
load
(path, create=True)[source]¶ Create a new lockfile instance.
Parameters: - project_path (str or
pathlib.Path
) – Path to project root or lockfile - lockfile_name (str) – Name of the lockfile in the project root directory
- pipfile_path (
pathlib.Path
) – Path to the project pipfile
Returns: A new lockfile representing the supplied project paths
Return type: - project_path (str or
-
classmethod
load_projectfile
(path, create=True, data=None)[source]¶ Given a path, load or create the necessary lockfile.
Parameters: Raises: - OSError – Thrown if the project root directory doesn’t exist
- FileNotFoundError – Thrown if the lockfile doesn’t exist and
create=False
Returns: A project file instance for the supplied project
Return type:
-
lockfile
¶
-
newlines
¶
-
path
¶
-
projectfile
¶
-
classmethod
read_projectfile
(path)[source]¶ Read the specified project file and provide an interface for writing/updating.
Parameters: path (str) – Path to the target file. Returns: A project file with the model and location for interaction Return type: ProjectFile
-
requirements
¶
-
requirements_list
¶
-
section_keys
¶
-
-
class
requirementslib.
Pipfile
(path: pathlib.Path = NOTHING, projectfile: requirementslib.models.project.ProjectFile = NOTHING, pipfile: requirementslib.models.pipfile.PipfileLoader = NOTHING, pyproject: tomlkit.toml_document.TOMLDocument = NOTHING, build_system: dict = NOTHING, requirements: list = NOTHING, dev_requirements: list = NOTHING)[source]¶ Bases:
object
-
allow_prereleases
¶
-
build_backend
¶
-
build_requires
¶
-
build_system
¶
-
dev_packages
¶
-
dev_requirements
¶
-
extended_keys
¶
-
classmethod
load
(path, create=False)[source]¶ Given a path, load or create the necessary pipfile.
Parameters: - path (Text) – Path to the project root or pipfile
- create (bool) – Whether to create the pipfile if not found, defaults to True
Raises: - OSError – Thrown if the project root directory doesn’t exist
- FileNotFoundError – Thrown if the pipfile doesn’t exist and
create=False
Returns: A pipfile instance pointing at the supplied project
:rtype:: class:~requirementslib.models.pipfile.Pipfile
-
classmethod
load_projectfile
(path, create=False)[source]¶ Given a path, load or create the necessary pipfile.
Parameters: - path (Text) – Path to the project root or pipfile
- create (bool) – Whether to create the pipfile if not found, defaults to True
Raises: - OSError – Thrown if the project root directory doesn’t exist
- FileNotFoundError – Thrown if the pipfile doesn’t exist and
create=False
Returns: A project file instance for the supplied project
Return type:
-
packages
¶
-
path
¶
-
pipfile
¶
-
projectfile
¶
-
classmethod
read_projectfile
(path)[source]¶ Read the specified project file and provide an interface for writing/updating.
Parameters: path (Text) – Path to the target file. Returns: A project file with the model and location for interaction Return type: ProjectFile
-
requirements
¶
-
requires_python
¶
-
root
¶
-
-
class
requirementslib.
Requirement
(name=NOTHING, vcs=None, req=None, markers=None, specifiers=NOTHING, index=None, editable=None, hashes=NOTHING, extras=NOTHING, abstract_dep=None, line_instance=None, ireq=None)[source]¶ Bases:
object
-
as_line
(sources=None, include_hashes=True, include_extras=True, include_markers=True, as_list=False)[source]¶ Format this requirement as a line in requirements.txt.
If
sources
provided, it should be an sequence of mappings, containing all possible sources to be used for this requirement.If
sources
is omitted or falsy, no index information will be included in the requirement line.
-
build_backend
¶
-
commit_hash
¶
-
constraint_line
¶
-
extras_as_pip
¶
-
find_all_matches
(sources=None, finder=None)[source]¶ Find all matching candidates for the current requirement.
Consults a finder to find all matching candidates.
Parameters: - sources – Pipfile-formatted sources, defaults to None
- sources – list[dict], optional
- finder (PackageFinder) – A PackageFinder instance from pip’s repository implementation
Returns: A list of Installation Candidates
Return type: list[
InstallationCandidate
]
-
get_abstract_dependencies
(sources=None)[source]¶ Retrieve the abstract dependencies of this requirement.
Returns the abstract dependencies of the current requirement in order to resolve.
Parameters: - sources – A list of sources (pipfile format), defaults to None
- sources – list, optional
Returns: A list of abstract (unpinned) dependencies
Return type: list[
AbstractDependency
]
-
get_dependencies
(sources=None)[source]¶ Retrieve the dependencies of the current requirement.
Retrieves dependencies of the current requirement. This only works on pinned requirements.
Parameters: - sources – Pipfile-formatted sources, defaults to None
- sources – list[dict], optional
Returns: A set of requirement strings of the dependencies of this requirement.
Return type:
-
hashes_as_pip
¶
-
ireq
¶
-
is_direct_url
¶
-
is_file_or_url
¶
-
is_named
¶
-
is_vcs
¶
-
is_wheel
¶
-
line_instance
¶
-
markers_as_pip
¶
-
name
¶
-
normalized_name
¶
-
pipfile_entry
¶
-
requirement
¶
-
specifiers
¶
-
uses_pep517
¶
-
Submodules¶
- requirementslib.models package
- Submodules
- requirementslib.models.cache module
- requirementslib.models.dependencies module
- requirementslib.models.lockfile module
- requirementslib.models.markers module
- requirementslib.models.metadata module
- requirementslib.models.metadata module
- requirementslib.models.pipfile module
- requirementslib.models.project module
- requirementslib.models.requirements module
- requirementslib.models.resolvers module
- requirementslib.models.setup_info module
- requirementslib.models.utils module
- requirementslib.models.url module
- requirementslib.models.vcs module
- Submodules
- requirementslib.utils module