Python gets exact code navigation on GitHub

GitHub has made two code navigation improvements generally available on github.com and in the new code search technology preview. The first brings code navigation to pull request reviews, and the second upgrades Python navigation from search-based "fuzzy" results to precise, definition-aware lookups.

Code navigation inside pull requests

Previously, code navigation was limited to the code browser. Now it also works in the "files changed" tab of every pull request. Clicking a symbol definition or reference there takes you to the code browser on the pull request’s head branch. This lets you trace the impact of a proposed change—for example, seeing all callers of a function you are about to modify.

jump to definition in a pull request

Stack graphs replace fuzzy search for Python

Earlier code navigation was "fuzzy" or search based: clicking a reference showed every definition in the repository with that name, which produced noisy results for common identifiers. GitHub’s new stack graphs framework encodes Python’s name binding rules so each reference can be linked to the specific definition it resolves to.

search-based code navigation results

These precise results are now available for Python:

precise code navigation results

The stack graphs implementation needs no configuration. There are no CI workflows to add and no build steps to disclose. It works for all public repositories and any private repositories you can access—if a repository contains Python code, its code navigation is now precise.

Other supported languages continue to use search-based results for now. GitHub plans to add stack graph support to additional languages in the coming months. The stack-graphs library is open source and builds on the Tree-sitter parser ecosystem; GitHub will also publish guidance on how language communities can add stack graph support themselves. More detail is available in the deep dive post and Strange Loop presentation.