Skip to content

Python API reference: correct and complete it for cldk 2.0.0 #14

Open

Description

@rahlk

The Python API reference (reference/python-api/) needs a pass for cldk 2.0.0. An audit ran every sample against cldk==2.0.0 from PyPI on the docs' sample projects (Flask, Commons CLI 1.7.0, Zod). Separate verifier agents then checked every finding.

Authored text (outside the generated block):

  • Dead links: /cocoa/ and /guides/common-tasks/ on index.md, core.md, python.md and java.md. Both pages were removed in 40d5fd3.
  • Wrong outputs and samples that do not run:
    • get_classes() on Commons CLI prints 75, not 23.
    • The Python samples use a my_pkg project that does not exist.
    • The Java get_callers sample uses a short parameter type and returns {}.
    • The Python call-graph edge attribute is provenance, not prov.
  • Missing facts:
    • the install commands and extras (cldk[java], cldk[neo4j]);
    • SYSTEM_PYTHON for a virtualenv;
    • which analysis level each method needs, and the silent empty results below that level;
    • how the cache behaves, and the TypeScript cache that ignores the level;
    • the exceptions a reader can see;
    • Neo4j prerequisites;
    • that Java analysis includes test sources.
  • index.md says "Go and Rust are planned". The diagrams leave out CLDK.typescript().

Generated block (scripts/gen_api_docs.py):

  • Signatures drop the keyword-only * marker on 57 methods. A positional call, as the page shows it, raises TypeError.
  • Returns sections split one description into many bullets (103 of 124 sections).
  • Reference text leaks into the output: Sphinx role fragments (class:~cldk...), :: markers, .. deprecated:: directives and --, which renders as an em-dash.
  • Attribute descriptions are lost, and inherited fields and type aliases (TSType, TSClassAttribute and more) are missing.
  • No entries exist for the types that signatures use: AnalysisLevel, the backend configs, the result models (LocateResult, Slice, EdgePage, FlowPaths, TaintResult and more), the exceptions in cldk.utils.exceptions, the Java projections and the tree-sitter helpers.
  • The pages say "generated from cldk 2.0.0rc7". Regenerating from 2.0.0 supersedes docs(api): sync Python API reference to python-sdk 2.1.0 #8.

Related: #4.

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