Lock filepins

When reading an .in file, in one shot, parse all pins.

PinDatum do not ignore qualifiers.

wreck.lock_filepins.__all__: tuple[str, str] = ("FilePins", "get_path_cwd")

Module exports

class wreck.lock_filepins.FilePins(file_abspath: Path)

Has the duel purpose to: store the pins and store the processed data.

Processed into: constraints (-c), requirements (-r), and pkgs_from_resolved (transitive packages)

Variables:

file_abspath.in file absolute Path

Vartype:

pathlib.Path

_pins: list[wreck.lock_datum.PinDatum]

Container of PinDatum

_iter: collections.abc.Iterator[wreck.lock_datum.PinDatum]

Iterator of PinDatum

Raises:
by_pin_or_qualifier()

Yield if either a Pin or has qualifiers

Returns:

collections.abc.Generator[wreck.lock_datum.PinDatum, None, None]

by_pkg(pkg_name)

Get PinDatum by package name. Can have differing qualifiers

Parameters:

pkg_name (Any) – Package name

Returns:

For one package, list of PinDatum. Differs by qualifiers

Return type:

list[wreck.lock_datum.PinDatum]

constraints: set[str]
property depth

Number of unresolved constraints. One this number gets down to zero, the FilePins is moved from files set –> zeroes set

Returns:

unresolved constraints count

Return type:

int

file_abspath: Path
packages_save_to_parent(fpins, requirements)

During the resolution loop, as the resolved constraints|requirements are moved into zeroes, their packages are saved into parent

Parameters:
pkgs_from_resolved: set[str]
relpath(loader)

Get the absolute path. The relative path is relative to the package folder.

Parameters:

path_package_base (pathlib.Path) – package base folder

Returns:

absolute path

Return type:

pathlib.Path

Raises:
requirements: set[str]
resolve(constraint, plural='constraints', singular='constraint')

Constraint or requirement to discard

Parameters:
  • constraint (str) – As provided by pip_requirements_parser.RequirementsFile, is a relative path, not absolute. Relative to the .in file, not cwd (package base folder)

  • plural (str) – attribute name. There are two set, constraints and requirements

  • singular (str) – Just used in error messages. Singular form of the word

Raises:
  • AssertionError – object attribute does not exist. Should be either constraints or requirements

wreck.lock_filepins.get_path_cwd(loader)

package base folder. During testing this will be tmp_path, not the source package folder. Patch would be helpful here

Parameters:

loader (wreck.pep518_venvs.VenvMapLoader) – Contains some paths and loaded not parsed venv reqs

Returns:

package base folder

Return type:

pathlib.Path

Raises: