Skip to content

duckgrep 0.2.0

Choose a tag to compare

@ccf ccf released this 03 Oct 13:15
· 28 commits to main since this release
1996695

Added

  • The typed tier: Python receiver calls (obj.method()) get one confident edge when the receiver's class can be read from syntax. It covers:

    • x = Foo();
    • annotations, including Optional[...], X | None and string annotations;
    • self.attr set or annotated in the class;
    • one hop of return annotations;
    • imported module-level instances;
    • self and super() through base classes in other files.

    Against jedi, confident coverage of in-repo calls rose from 66.8% to 87.8% on django, 74.3% to 90.9% on freqtrade and 67.6% to 90.1% on requests, with every typed edge exact.

  • Calls on receivers whose class is outside the repo (io.StringIO(), literals, classes with an external base) are now unresolved, not name guesses.

Changed

  • The resolver refuses rather than guesses: a name bound more than once in a file, Python's method resolution order where syntax can't settle it, and a name a nested def or class shares all get no typed edge and keep the older tiers.
  • Edge refresh after an edit reads dirty refs in batches, and falls back to a batched rebuild if it runs out of memory, instead of leaving the index unable to answer call-graph queries.
  • The schema is at version 4 (a new bindings table and symbols.returns). Existing indexes rebuild themselves on first use.
  • The query(sql) tool description names the typed tier.

Fixed

  • Standard-library imports (import json, datetime, math ...) no longer resolve to a nested repo module that happens to share the name.
  • duckgrep.__version__ now reports the installed package's version.

Known gaps

  • A class or return that turns external in another file: when a class's ancestry, or a function's return annotation, starts or stops being external in another file, calls on its instances keep their old name/unresolved tier until those refs are next recomputed.