Skip to content

Releases

cellgraph 0.4.0

Choose a tag to compare

@github-actions github-actions released this 07 Nov 03:30
Immutable release. Only release title and notes can be modified.
3b13295
  • docs/api.md says what the pre-release audit found missing or wrong (#23):

    • Under from __future__ import annotations an annotation reads nothing, and a
      binding under if, try or a loop counts as made.
    • Every upstream and unresolved address in full, and what execution_key
      raises: a ValueError for a call it cannot answer, a TypeError for a value
      that is not canonical JSON.
    • The Dag methods wired_variables, read_producer, sweep_groups_read and
      upstream_reachable; the Effect union, and that a hook returning anything
      else is a TypeError; what analyze and normalize each get.
    • Vocabulary.replace raises KeyError for a key the vocabulary does not have,
      as without does, where a misspelt key changed nothing.
  • analyze stays up on odd text, and keys it apart (#22):

    • Lines break only at \n, \r\n and \r, as in Python. A form feed,
      \u2028 and the others str.splitlines also breaks at stay inside the line,
      so # note\x0cx = 1 (one comment) and # note\nx = 1 no 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_directive and remove_directive
      keep a lone \r line ending.
    • A lone surrogate, as a truncated emoji in a notebook file leaves, is a
      syntax_error in Python and is keyed in any language, where analyze
      raised UnicodeEncodeError: canonical_json escapes it as \udXXX, as
      JavaScript's JSON.stringify does.
    • A variant member too deep to parse is python_too_deep, where analyze
      raised MemoryError.
    • 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.
  • 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.14 class M: with class Inner and inner: Inner read Inner
      upstream, and on any Python so did type A = T for a class-level T. 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 if runs before its element, so a walrus there binds
      first: [y for x in a if (y := x)] no longer reads y upstream, and
      [y := f(x) for x in a if y] does.
    • global np and then import numpy as np in a function defines np, and a
      global x the function only deletes defines nothing, whatever a scope
      without global x binds.
    • An unconditional del in a class body unbinds the name there, as at module
      level, so a later read in the body is the module's.
  • 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 @after still counts.
    • A sweep component is sweep:<group>.<var>, ["sweep", group, var, members],
      so two sweeps that both make y no 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") and Run("r1") shared a component, and a content digest
      with a : in it (sha256:...) made execution_key raise.
    • is_canonical refuses an int of more than 640 digits, which json may not
      write, so such a key field is <key>_unencodable where analyze raised. The
      bound is fixed, so sys.set_int_max_str_digits does 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.
  • 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.
  • Hosts build input components the way cellgraph does (#18):

    • input_component(kind, name, resolved) is the component execution_key puts
      in parts["inputs"]. A host keying a HostKeyed cell, or comparing saved
      parts, builds its inputs with it.
    • The wired:, variant: and each: upstream components are canonical JSON
      lists, as sweep: and instances: are. An item's key and digest were joined
      by =, so Item("a=b", "c") and Item("a", "b=c") shared a component.
    • docs/api.md gives every upstream component's format, and says that an
      inactive variant keeps plannable but is refused by plan and
      execution_key.
  • The API is what cellgraph exports, and the docs say so (#17):

    • Validator, CellEffects and registered_analyzers are exported.
    • Analysis.execution_key and Analysis.variant_read have their real
      signatures and return types, not **kwargs and Any.
    • HostKeyed.parts is always a dict, never None.
    • docs/api.md lists every code cellgraph emits with its severity and its
      args, and documents Dag.each_cells, VariantGroupResolution,
      SweepProducer and Analysis.vocabulary, analyzers and groups.
    • 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'
      equal Grammar("--") compose with |, where distinct objects were refused.
  • analyze survives large and odd notebooks (#16):

    • Cycle detection no longer recurses, so a chain of thousands of cells analyzes;
      1000 raised RecursionError. 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.
    • plan and execution_key refuse an inactive switch member with the new
      InactiveVariantError, a NotPlannableError: 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_collision each, 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>_unreadable for its own key,
      not an also_reads key. An encoder's AnnotationError is <key>_unencodable,
      where it escaped analyze. A scalar converter or an encoder that raises
      ValueError, TypeError or LookupError (an encoder, also in a group) is
      unreadable or unencodable; a converter's own AnnotationError keeps 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 the after_*, each_* and per_variant_* ones are on the
      line of the annotation whose effect caused them, a host's included.
  • 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 for or async with
      lost every name its functions and classes read, and their global writes.
    • async for binds its target; _ = expr reads expr; global n; n += 1
      reads n; df[col] = 1 reads col; del df["c"] and del obj.a mutate.
    • A mutation or a del reads 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 by def, class or import is its own when mutated,
      as one at module level is the cell's.
    • A lambda's walrus binds nothing at module level.
    • x: int alone binds nothing, except E as e leaves e unbound, also to a
      lambda or def in the handler, and rebinding or mutating e there defines
      nothing. A top-level x = 1; del x defines no x.
    • A cell whose symbol table Python refuses is the warning python_bodies_unread,
      where its function bodies...
Read more