requirementslib.models.pipfile module

class requirementslib.models.pipfile.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
get(k)[source]
get_deps(dev=False, only=True)[source]
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:

ProjectFile

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
write()[source]
class requirementslib.models.pipfile.PipfileLoader(data)[source]

Bases: plette.pipfiles.Pipfile

classmethod ensure_package_sections(data)[source]

Ensure that all pipfile package sections are present in the given toml document

:param TOMLDocument data: The toml document to
ensure package sections are present on
Returns:The updated toml document, ensuring packages and dev-packages sections are present
Return type:TOMLDocument
classmethod load(f, encoding=None)[source]
classmethod populate_source(source)[source]

Derive missing values of source from the existing fields.

classmethod validate(data)[source]
requirementslib.models.pipfile.reorder_source_keys(data)[source]