jellycell.format.static_deps

Static AST extraction of implicit cell dependencies.

Spec §2.5 says to AST-walk jc.deps("a", "b") calls statically so the arguments enter the cache key before the cell runs. This module does that, plus two additional signals:

  • jc.load("artifacts/foo.json") with a literal path: the artifact’s producer cell becomes an implicit dep (when the cache index knows about it).

  • jc.deps(...) with non-string or non-constant arguments: silently skipped — we only resolve call-site constants.

Runtime dep registration (ctx.declared_deps) complements this for dynamic cases but can’t affect the current cell’s cache key.

Module Contents

Functions

extract_static_deps

Extract named deps declared via jc.deps(...) in cell source.

extract_loaded_paths

Extract literal paths from jc.load("...") calls.

API

jellycell.format.static_deps.extract_static_deps(source: str) list[str]

Extract named deps declared via jc.deps(...) in cell source.

Returns an ordered, deduplicated list of dep names. Non-constant args (e.g., jc.deps(some_var)) are skipped.

jellycell.format.static_deps.extract_loaded_paths(source: str) list[str]

Extract literal paths from jc.load("...") calls.

Callers should resolve each path to a producer cell via the cache index.