jellycell.run.env_hash

Environment hashing with lockfile detection.

Spec §2.3 says the cache key incorporates an env_hash. v0.1 hashed only the PEP-723 dependencies list, which silently shared caches between environments that resolved to different concrete versions.

This module picks the best available signal:

  1. If uv.lock exists at the project root: hash its bytes. Users who care about reproducibility commit a lockfile and get version-level invalidation.

  2. Else if poetry.lock exists: hash its bytes.

  3. Else fall back to hashing sorted PEP-723 dependency specifiers — best effort, matches v0.1 behavior for projects without lockfiles.

The precedence is deliberate: a lockfile is a stronger signal than the dependency list, and the first wins.

Module Contents

Functions

compute_env_hash

Compute an environment hash for this notebook under project.

API

jellycell.run.env_hash.compute_env_hash(project: jellycell.paths.Project, notebook: jellycell.format.cells.Notebook) str

Compute an environment hash for this notebook under project.

Checks lockfiles first; falls back to the PEP-723 dependencies list.