Skip to content

Add optional Jedi definition metadata provider - #1488

Open
Aschenbath wants to merge 8 commits into
Instagram:mainfrom
Aschenbath:feat/jedi-definition-provider-451
Open

Aschenbath wants to merge 8 commits into
Instagram:mainfrom
Aschenbath:feat/jedi-definition-provider-451

Conversation

@Aschenbath

Copy link
Copy Markdown

Summary

Add JediDefinitionProvider for resolving Python definitions without a running Pyre server, as proposed in #451. Name and Attribute nodes receive immutable JediDefinition snapshots; calls with those callees receive the same definitions. The results describe inferred definitions, not expression return types or complete type annotations.

The provider integrates with FullRepoManager, analyzes the wrapper's current source, and keeps only pickleable paths in the manager cache. Jedi loads lazily through the optional libcst[jedi] extra. Provider resolutions are serialized across threads because Jedi uses shared parser state. Documentation includes usage, supported nodes, environment and syntax limitations, and timeout behavior.

Fixes #451.

Test Plan

  • 14 new tests cover definitions, imports and aliases, attributes and calls, Unicode/CRLF positions, unsaved source, ambiguous/unresolved names, pickling, missing dependencies, and threaded resolution. New provider statement and branch coverage is 100%.
  • The full official suite ran 2,172 tests with 14 skips, two expected failures and no assertion failures. Its sole setup error was a missing Pyre executable; after installing Pyre, all three affected TypeInferenceProvider tests passed separately. Fixture regeneration leaves no diff. Source coverage is 95.7%.
  • Strict Pyre 0.9.18 checks all 5,621 functions with zero errors, using the CI Python 3.10 target and sequential execution. Whole-source flake8, ufmt, slotscheck, copyright and lock checks pass.
  • Full Sphinx HTML build, including notebook execution, succeeds. Four existing tutorial warnings and a missing local Graphviz warning remain; the new documentation section passes a strict build.
  • A separate Codex reviewer checked real imports, aliases, current source, Unicode positions, pickle restoration, and process/thread use, and verified the final source against the tested files.

Local runtime validation used Linux CPython 3.12 and the native parser from the released LibCST 1.9.0 musllinux wheel; the native parser was not rebuilt from this checkout. Both Jedi 0.19.2 and 0.20.1 were exercised. Fork Actions have produced no runs, so the wider OS/interpreter matrix is still unverified.

AI assistance: OpenAI Codex implemented and tested this change, with independent review by a separate Codex agent. No human code review is claimed.

@meta-cla

meta-cla Bot commented Nov 7, 2026

Copy link
Copy Markdown

Hi @Aschenbath!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TypeInferenceProvider using another tool than pyre - Jedi

1 participant