lmstudio-ai / venvstacks

Virtual environment stacks for Python
https://lmstudio-ai.github.io/venvstacks/
MIT License
1 stars 0 forks source link

Allow more control over the locking timestamp used #10

Open ncoghlan opened 1 month ago

ncoghlan commented 1 month ago

Lock timestamps are recorded via a dedicated metadata file stored alongside each requirements file generated with uv pip compile. This timestamp is then used in the generated artifact metadata (and to set the upper limit on file timestamps in the generated archives).

In combination with the --exclude-newer feature in uv pip compile, this approach to recording the lock timestamps means it is possible to specify a lock time that is earlier than the current time when that particular environment is locked.

API and CLI options to select between the following two modes should be provided:

  1. Specific time lock: a single timestamp is used for every environment lock (defaulting to the current time when the locking process starts)
  2. Platform sync lock: for each environment, every platform is locked to the highest timestamp recording across the platform-specific lock metadata files for that environment

The existing "record the actual locking time" behaviour does NOT need to be retained (since it's a strictly worse alternative to the behaviour where every lock timestamp is set to the current time immediately before the locking process starts).

ncoghlan commented 1 month ago

The current workaround for the lack of this feature is setting UV_EXCLUDE_NEWER in the calling environment. The downside of that approach is it means the locked_at metadata for each environment isn't correct (as the real locked_at time will be earlier than the nominal locked_at time, and the real locked_at time isn't recorded anywhere in the metadata for built archives or exported environments).