Lock loader

There are two from_loader implementations. Refactor priority is on support for multiple implementations, rather than for performance.

LoaderPinDatum is the latest implementation. Differs from LoaderPin by reading each requirements file once.

Table 10 Coverage performance comparison

loader

context

duration(sec)

LoaderPin

343 passed, 6 skipped

82.86

LoaderPinDatum

343 passed

6 skipped”

53.19

(82.86 - 53.19) / 82.86 = 0.35807 --> ~35.80% speed up

Reducing I/O (file reads), has a significant and high performance impact.

Both implementations hold the result in memory.

functools.singledispatch was not used. This pattern is for multiple implementations based on the first arg, not the return type

wreck.lock_loader.__all__: tuple[str, str, str] = ("LoaderImplementation", "LoaderPinDatum", "from_loader_filepins")

Module exports

class wreck.lock_loader.LoaderImplementation

from_loader implementation base type

class wreck.lock_loader.LoaderPinDatum

Another implementation.

Reads each file once, process all pins once

Keep in mind, LoaderImplementation exists only for compatibility with existing codebase

Usage

ret: set[wreck.lock_datum.DATUM] = LoaderPinDatum()(loader, venv_path)
wreck.lock_loader.from_loader_filepins(loader, venv_path, suffix_last='.in')

Load the FilePins

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

  • venv_path (Any) – Relative path to venv base folder. Acts as a key

  • suffix (str) – Default .unlock. End suffix of compiled requirements file. Either .unlock or .lock

Returns:

All FilePins

Return type:

list[wreck.lock_filepins.FilePins]

Raises: