Skip to content

Incorporate codeanalyzer-python v1.6.0 #427

Open

Description

@rahlk

A new codeanalyzer-python release (v1.6.0) is published.
Update the codeanalyzer-python pin in this repo and adapt the
integration to the changes below (see PyCodeanalyzer._run_analyzer).

[1.6.0] - 2026-10-11

Changed

  • Level-4 analysis uses about 7x less memory, with the same output (#224). On a
    6,685-module project (Odoo 20.0), peak RSS fell from 42.6 GB to 5.7 GB for JSON output,
    and from 65.1 GB to 5.5 GB for --emit neo4j. On the same input, analysis.json and
    the analysis cache have the same content as 1.5.4. The Neo4j snapshot has the same
    statements, but edge batches can come in a different order. Representation and lifetime
    changes only; no analysis logic changed:
    • The schema's leaf records are slotted stdlib dataclasses, not pydantic models. This
      covers Span, BodyNode, the cfg/cdg/ddg/summary/param_* edges, PyCallEdge,
      PyCallsite, PyCallArgument, PySymbol, PyComment, PyVariableDeclaration,
      PyCallableParameter, PyDecorator and PyImport. The containers (PyModule,
      PyClass, PyCallable, PyApplication, Analysis) stay pydantic models.
    • analysis.json and the cache are written one module at a time, not as whole-tree
      copies. The edge lists are written in chunks. The JSON now uses compact separators
      (only whitespace differs).
    • ASTs, PDG data and the level-4 IR are released as soon as nothing needs them.
    • The Neo4j graph.cypher snapshot is written in two passes. Nodes are written first,
      sorted as before. Edge batches are written as they fill.
    • Ray runs as a private local cluster with object spilling turned off. It is shut down
      after the symbol-table phase. CANPY_RAY_OBJECT_STORE (bytes, default 1 GB) caps the
      object store, and CANPY_RAY_CPUS caps the workers.
  • In-process API: the leaf types above no longer have .model_dump() or
    .model_validate(). Use dataclasses.asdict(...) or the constructor. The
    codeanalyzer.schema helpers (model_dump, model_copy, ...) and the container
    models handle them transparently.

Removed

  • BREAKING: Python 3.9 and 3.10 are no longer supported; the analyzer needs Python 3.11+
    (requires-python = ">=3.11"). The level-4 memory cut (#224) makes the schema's
    per-edge and per-statement records slotted stdlib dataclasses. Only pydantic v2 validates
    and serializes those the same way as models, and below 3.11 the dependency pins resolved
    to pydantic v1 (with ray==2.0.0). The python_version < '3.11' pin set, the tomli
    backport, the pydantic-v1 branches of the codeanalyzer.schema helpers, and the 3.10
    compat release job are gone. codeanalyzer.schema.PYDANTIC_V2 stays importable and is
    always True. Migration: install the analyzer under Python 3.11 or newer.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions