Repository navigation
Releases
Releases · bearing-research/cellgraph
cellgraph 0.4.0
Immutable
release. Only release title and notes can be modified.
-
docs/api.md says what the pre-release audit found missing or wrong (#23):
- Under
from __future__ import annotationsan annotation reads nothing, and a
binding underif,tryor a loop counts as made. - Every
upstreamandunresolvedaddress in full, and whatexecution_key
raises: aValueErrorfor a call it cannot answer, aTypeErrorfor a value
that is not canonical JSON. - The
Dagmethodswired_variables,read_producer,sweep_groups_readand
upstream_reachable; theEffectunion, and that a hook returning anything
else is aTypeError; whatanalyzeandnormalizeeach get. Vocabulary.replaceraisesKeyErrorfor a key the vocabulary does not have,
aswithoutdoes, where a misspelt key changed nothing.
- Under
-
analyzestays up on odd text, and keys it apart (#22):- Lines break only at
\n,\r\nand\r, as in Python. A form feed,
\u2028and the othersstr.splitlinesalso breaks at stay inside the line,
so# note\x0cx = 1(one comment) and# note\nx = 1no longer share a
definition key, nor two strings that differ by one of them. Another language
may break there (JavaScript at\u2028), so a directive-block line with one
inside it is body, and ends the block.set_directiveandremove_directive
keep a lone\rline ending. - A lone surrogate, as a truncated emoji in a notebook file leaves, is a
syntax_errorin Python and is keyed in any language, whereanalyze
raisedUnicodeEncodeError:canonical_jsonescapes it as\udXXX, as
JavaScript'sJSON.stringifydoes. - A variant member too deep to parse is
python_too_deep, whereanalyze
raisedMemoryError. strip_lines, and Python's fallback for source it cannot parse, keep the
first line's indentation, as documented, so" x = 1"(an error) and
"x = 1"no longer share a key.
- Lines break only at
-
The Python analyzer finds more of what a cell reads and binds (#21):
- A class-body annotation or type alias finds the class's own names first. On
Python 3.14class M:withclass Innerandinner: InnerreadInner
upstream, and on any Python so didtype A = Tfor a class-levelT. So
does one in a type parameter scope (type A[U] = T), and a name the class
deleted is read from the module. - A comprehension's
ifruns before its element, so a walrus there binds
first:[y for x in a if (y := x)]no longer readsyupstream, and
[y := f(x) for x in a if y]does. global npand thenimport numpy as npin a function definesnp, and a
global xthe function only deletes defines nothing, whatever a scope
withoutglobal xbinds.- An unconditional
delin a class body unbinds the name there, as at module
level, so a later read in the body is the module's.
- A class-body annotation or type alias finds the class's own names first. On
-
Execution keys count what each upstream makes, and every output component is
tagged (#20):- An output a cell does not read is keyed as its upstream makes it, a sweep
member's as its variant's, not by whichever cell defines that name last. A
cell after a reader changed the reader's key, and a fan-out instance read
another variant's outputs (any it published beyond its defines, or as one cell
ref, too). One it seeds from or runs@afterstill counts. - A sweep component is
sweep:<group>.<var>,["sweep", group, var, members],
so two sweeps that both makeyno longer share one. - A fan-out cell's output with no instances is an
output:, where it was an
empty fan-out list that never changed. - A no-cache upstream is read only for the variables the cell takes from it, so
one the cell reads from another producer no longer leaves the key
Unavailable. - An output's component is a tagged list:
["provenance", hash],
["nocache", hash, digest],["content", digest]or["run", id].
Provenance("run:r1")andRun("r1")shared a component, and a content digest
with a:in it (sha256:...) madeexecution_keyraise. is_canonicalrefuses an int of more than 640 digits, whichjsonmay not
write, so such a key field is<key>_unencodablewhereanalyzeraised. The
bound is fixed, sosys.set_int_max_str_digitsdoes not change a key.- Every output an upstream publishes still counts, read or not: a read the
analyzer cannot see stays covered. docs/api.md says so, and what it costs.
- An output a cell does not read is keyed as its upstream makes it, a sweep
-
CI runs on Linux, macOS and Windows, and a release is also a GitHub release
(#19):- The suite runs on each of Python 3.12, 3.13 and 3.14 on all three, in CI and
on the tagged commit before a release. - A release installs the built wheel and sdist on all three and runs them
before it publishes anything. - After PyPI, the release workflow makes the GitHub release: the version's
CHANGELOG section as its notes, the wheel and sdist as its assets, and a build
provenance attestation for each (gh attestation verify). The release is a
draft until its assets are attached, so it works with immutable releases. - No checkout keeps its token in
.git/config. - docs/api.md says how deep a cell can nest before it is
python_too_deep
depends on the Python: before 3.14, Windows parses about 3000 levels, Linux
and macOS past 8000. The tests stay under it.
- The suite runs on each of Python 3.12, 3.13 and 3.14 on all three, in CI and
-
Hosts build input components the way cellgraph does (#18):
input_component(kind, name, resolved)is the componentexecution_keyputs
inparts["inputs"]. A host keying aHostKeyedcell, or comparing saved
parts, builds its inputs with it.- The
wired:,variant:andeach:upstream components are canonical JSON
lists, assweep:andinstances:are. An item's key and digest were joined
by=, soItem("a=b", "c")andItem("a", "b=c")shared a component. - docs/api.md gives every upstream component's format, and says that an
inactive variant keepsplannablebut is refused byplanand
execution_key.
-
The API is what
cellgraphexports, and the docs say so (#17):Validator,CellEffectsandregistered_analyzersare exported.Analysis.execution_keyandAnalysis.variant_readhave their real
signatures and return types, not**kwargsandAny.HostKeyed.partsis always a dict, never None.- docs/api.md lists every code cellgraph emits with its severity and its
args, and documentsDag.each_cells,VariantGroupResolution,
SweepProducerandAnalysis.vocabulary,analyzersandgroups. - A release runs CI's own jobs on the tagged commit (ci.yml is reusable), so
the suite runs on Python 3.12, 3.13 and 3.14 and the pre-commit checks rerun.
A manual re-publish must be run from the tag, so both workflows are the tag's.
ty is pinned, and it checks the tests too, at commit time as in CI. - Grammars are equal by class, marker and directive pattern, so two packages'
equalGrammar("--")compose with|, where distinct objects were refused.
-
analyzesurvives large and odd notebooks (#16):- Cycle detection no longer recurses, so a chain of thousands of cells analyzes;
1000 raisedRecursionError. Blocked cells are found in one pass over the
strongly connected components, where a cycle's length made it cubic. - Each cycle is reported on its own cells; every cycle cell had the first one.
- Repeated cell ids are a
ValueError; one cell's analysis replaced the other's. planandexecution_keyrefuse an inactive switch member with the new
InactiveVariantError, aNotPlannableError: what it reads depends on the
selection, so a host selects it and analyzes again. Its plan left its upstream
out, and its key covered none of it.- A cell with a member or fan-out conflict joins no group, where the last effect
won and so composition order decided. A variant member never fans out. - Cells sharing a variant name get one
variant_collisioneach, on the line of
the annotation that made them members. A repeat is inactive, where it shadowed
the active member. - An unreadable annotation's default code is
<key>_unreadablefor its own key,
not analso_readskey. An encoder'sAnnotationErroris<key>_unencodable,
where it escapedanalyze. Ascalarconverter or an encoder that raises
ValueError,TypeErrororLookupError(an encoder, also in a group) is
unreadable or unencodable; a converter's ownAnnotationErrorkeeps its code
and line; any other exception is a bug in it, and propagates. A validator's
diagnostics carry the cell's id. bind_conflict,bind_read_conflict,each_reads_source, the variant
diagnostics and theafter_*,each_*andper_variant_*ones are on the
line of the annotation whose effect caused them, a host's included.
- Cycle detection no longer recurses, so a chain of thousands of cells analyzes;
-
The Python analyzer finds edges it missed, and drops ones it invented (#15):
- On Python 3.14, a cell with a top-level
await,async fororasync with
lost every name its functions and classes read, and theirglobalwrites. async forbinds its target;_ = exprreadsexpr;global n; n += 1
readsn;df[col] = 1readscol;del df["c"]anddel obj.amutate.- A mutation or a
delreads the name even when the cell rebinds it later. - A class body runs when the class is defined: a name it reads before binding it
is a module read, and so is one its comprehensions, lambdas or nested classes
read. A name it binds bydef,classorimportis its own when mutated,
as one at module level is the cell's. - A lambda's walrus binds nothing at module level.
x: intalone binds nothing,except E as eleaveseunbound, also to a
lambda or def in the handler, and rebinding or mutatingethere defines
nothing. A top-levelx = 1; del xdefines nox.- A cell whose symbol table Python refuses is the warning
python_bodies_unread,
where its function bodies...
- On Python 3.14, a cell with a top-level