# pixi

`cooldown` gates pixi workspaces through `--tool pixi`.

## What it reads

A pixi workspace is its manifest with its `pixi.lock`.

## Registry

Publish times come from anaconda.org for conda packages and from PyPI for PyPI packages: each
dependency is resolved against its own source.

A package's age depends on its kind:

- **A conda package:** the upload of the newest build the lock holds, unknown when one of them
  records none.
- **A PyPI package:** the newest upload of its version's files.

The workspace's `exclude-newer` and `pypi-exclude-newer` are read as native cooldown windows, a
span in pixi's units such as `1month`. One `cooldown` cannot read is ignored with a warning.

## How it is driven

`cooldown` runs `pixi`, or the program `COOLDOWN_PIXI` names.

`upgrade` and `fix` run one `pixi lock` per batch in a scratch copy, and publish only `pixi.lock`.
The copy holds:

- the manifest
- the lock
- `.pixi/config.toml`
- the files directly in each relative `find-links` directory

The copy's manifest changes in three ways:

- it pins each conda target with one top-level `[constraints]` entry;
- it narrows a PyPI target's top-level requirement (`[pypi-dependencies]`, or `[project]`
  dependencies in a `pyproject.toml`) to it;
- it sets `exclude-newer` to `cooldown`'s cutoff.

Each young build the lock already holds of a package no target moves is exempted by its archive.

The new lock must pass three checks before it is published:

- it binds every target where the old one bound it, at exactly the target;
- every build it newly selects was uploaded by its own cutoff: the window that admitted a target,
  or the one `cooldown`'s policy gives the package;
- pixi finds the lock current for your own manifest, its `exclude-newer` included.

`--build` runs `pixi install --locked --all`.

## Edge cases

`upgrade` and `fix` never edit the manifest, so they hold:

- a target the lock binds at more than one version;
- a target whose top-level constraint has alternatives or comes from the workspace;
- a PyPI package only a feature or target declares, or one from another index;
- a batch whose lock binds a source package or local path;
- a batch with two young builds of one package that pixi cannot both exempt;
- a batch whose `find-links` directory is absolute, missing, or a link or holds one.

A range the manifest declares is pixi's to judge.

`check` cannot prove a `pixi.lock` current, so it reports the lock `lock_unknown`.
