Skip to content

Output schema

The artifact codeanalyzer-python emits is a single PyApplication. Every model below is a Pydantic model defined in codeanalyzer.schema.py_schema; the JSON and msgpack outputs are serializations of the same schema. Line/column fields default to -1 when unknown.

flowchart TB
    APP[PyApplication] --> ST["symbol_table: {path: PyModule}"]
    APP --> CG["call_graph: [PyCallEdge]"]
    APP --> EP["entrypoints: {framework: [PyEntrypoint]}"]
    ST --> MOD[PyModule]
    MOD --> CLS[PyClass]
    MOD --> FN[PyCallable]
    CLS --> M[PyCallable]
    CLS --> ATTR[PyClassAttribute]
    FN --> CALL[PyCallsite]
    FN --> PARAM[PyCallableParameter]
    FN --> DEC[PyDecorator]

The root object.

FieldTypeDescription
symbol_tableDict[str, PyModule]File path → module model. The whole-project inventory.
call_graphList[PyCallEdge]Identity-keyed call edges.
entrypointsDict[str, List[PyEntrypoint]]Framework name → detected roots.

One per source file.

FieldTypeDescription
file_pathstrAbsolute path to the file.
module_namestrDotted module name.
importsList[PyImport]Import statements.
commentsList[PyComment]Comments and docstrings.
classesDict[str, PyClass]Top-level classes by name.
functionsDict[str, PyCallable]Top-level functions by name.
variablesList[PyVariableDeclaration]Module-level variables.
content_hash, last_modified, file_sizestr / float / intCache-invalidation metadata.
FieldTypeDescription
namestrClass short name.
signaturestrFully-qualified identity (e.g. module.ClassName).
base_classesList[str]Names of base classes.
decoratorsList[PyDecorator]Class decorators.
methodsDict[str, PyCallable]Methods by name.
attributesDict[str, PyClassAttribute]Class attributes by name.
inner_classesDict[str, PyClass]Nested classes.
comments, codeList[PyComment] / strDocstrings/comments and source.
start_line, end_lineintSource span.

A function or method. The richest model in the artifact.

FieldTypeDescription
namestrCallable short name.
pathstrFile the callable is defined in.
signaturestrFully-qualified identity (e.g. module.Class.method). The call-graph node key.
parametersList[PyCallableParameter]Declared parameters.
return_typeOptional[str]Resolved return type, if known.
decoratorsList[PyDecorator]Applied decorators.
codeOptional[str]The source body.
call_sitesList[PyCallsite]Calls made from this callable.
accessed_symbolsList[PySymbol]Symbols read/written in the body.
local_variablesList[PyVariableDeclaration]Locals.
inner_callables, inner_classesDict[str, ...]Nested definitions.
cyclomatic_complexityintComputed complexity.
is_entrypointboolWhether a finder marked this an entrypoint.
entrypoint_frameworkOptional[str]The framework, if so.
start_line, end_line, code_start_lineintSource spans.

A single call made from within a callable — the rich per-call metadata behind a graph edge.

FieldTypeDescription
method_namestrThe invoked name as written.
receiver_expr, receiver_typeOptional[str]The receiver expression and its resolved type.
argument_typesList[str]Resolved argument types.
return_typeOptional[str]Resolved return type.
callee_signatureOptional[str]The resolved target’s signature (CodeQL may backfill this).
is_constructor_callboolWhether the call constructs an instance.
start_line, end_line, …intSource location.

An identity-only call-graph edge.

FieldTypeDescription
sourcestrCaller’s PyCallable.signature.
targetstrCallee’s PyCallable.signature.
type"CALL_DEP"Edge kind.
weightintEdge weight (default 1).
provenanceList[str]Which engine(s) produced it: "jedi", "codeql", or an extension token. Open vocabulary.
tagsDict[str, str]Free-form, extension-namespaced metadata (e.g. an ORM-dispatch trigger predicate). Never interpreted by core.

A framework-dispatched root, referencing a callable by signature.

FieldTypeDescription
signaturestrThe PyCallable.signature this entrypoint refers to.
frameworkstrThe dispatching framework.
detection_sourcestrHow it was detected — decorator, base_class, url_resolver, router_mount, blueprint, lambda_template, typer_subapp, click_add_command, argparse_dispatch, convention, or extension. Open vocabulary.
route_path, http_methodsOptional[str] / List[str]For HTTP routes.
celery_task_name, cli_command_name, lambda_handler_key, grpc_service_nameOptional[str]Framework-specific identifiers, when applicable.
source_fileOptional[str]File declaring the binding (urls.py, template.yaml, …).
tagsDict[str, str]Free-form, namespaced metadata for extensions.
  • PyImportmodule, name, alias, and source span.
  • PyCommentcontent, is_docstring, and source span.
  • PyDecoratorname, resolved qualified_name, and raw positional_arguments / keyword_arguments (source-text fragments for finders to parse).
  • PyCallableParametername, type, default_value, source span.
  • PyClassAttributename, type, comments, source span.
  • PyVariableDeclarationname, type, initializer, value, scope.
  • PySymbol — a referenced symbol: name, scope, kind, resolved type, qualified_name, is_builtin.

Every model is decorated for MessagePack support, exposing to_msgpack_bytes() / from_msgpack_bytes() (gzip-compressed) and to_msgpack_dict() / from_msgpack_dict(). PyApplication additionally exposes get_compression_ratio(). For JSON, use the Pydantic v1/v2 compatibility helpers model_dump_json / model_validate_json from codeanalyzer.schema. Models built via the fluent builder pattern — PyApplication.builder().symbol_table(...).call_graph(...).build().