Skip to content

_check_for_stale_packages

Check for stale packages.

Attributes⚓︎

CALCIPY_CACHE module-attribute ⚓︎

CALCIPY_CACHE = Path('.calcipy_packaging.lock')

Path to the packaging lock file.

Functions⚓︎

check_for_stale_packages ⚓︎

check_for_stale_packages(*, stale_months, path_lock=LOCK, path_cache=CALCIPY_CACHE)

Read the cached packaging information.

PARAMETER DESCRIPTION
stale_months

cutoff in months for when a package might be stale enough to be a risk

TYPE: int

Source code in calcipy/check_for_stale_packages/_check_for_stale_packages.py
@beartype
def check_for_stale_packages(*, stale_months: int, path_lock: Path = LOCK, path_cache: Path = CALCIPY_CACHE) -> bool:
    """Read the cached packaging information.

    Args:
        stale_months: cutoff in months for when a package might be stale enough to be a risk

    """
    packages = _read_packages(path_lock)
    cached_packages = _read_cache(path_cache)
    if cached_packages and can_skip.can_skip(prerequisites=[path_lock], targets=[path_cache]):
        packages = [*cached_packages.values()]
    else:
        packages = _collect_release_dates(packages, cached_packages)
        _write_cache(packages, path_cache)
    return _packages_are_stale(packages, stale_months=stale_months)