Skip to content

fix(modules): mark an editable install in the distribution reader - #59

Merged
abhisek merged 6 commits into
mainfrom
claude/python-call-graph-plan-vakrcz
Oct 31, 2026
Merged

abhisek merged 6 commits into
mainfrom
claude/python-call-graph-plan-vakrcz

Conversation

@abhisek

@abhisek abhisek commented Oct 31, 2026

Copy link
Copy Markdown
Member

Summary

An editable install, as pip install -e . or uv sync makes for the project, has a .dist-info in site-packages whose RECORD lists a .pth file and no Python file. The distribution graph walked it, found no file and opened it, so a project that installs itself in editable mode reached an open node on each scan. The code of an editable install is the project itself, not a copy under site-packages.

  • modules.Distribution gets Editable, which readDistribution sets from the dir_info.editable field of direct_url.json, the file that PEP 610 writes for an install from a directory or a URL. A .dist-info with no such file is a regular install, and one with an install from a git URL is not editable.
  • distgraph.Build leaves an editable install out of the nodes. The walk of the project reads its code.
  • docs/distgraph.md says so.

safedep/vet#854, merged, pins this branch and reads Editable to skip such a distribution as a unit of dependency code. Once this merges, vet re-pins main.

The branch carries two merge commits from the time it tracked #58 before #58 merged. The change against main is the five files of the editable install.

Tests

  • TestPythonDistributions covers an editable install and an install from a git URL.
  • TestBuildLeavesOutAnEditableInstall checks that the graph has no node for the editable install and that its imports come from the project.
  • go test ./... of the touched packages and golangci-lint pass.

Generated by Claude Code

The run builds the call graph of each file in the workers, for the
index. A cached plugin that reads the call graph, as the file plugin of
vet, built it again in Analyze. The extra plugins run on the goroutine
of the run, so that second build is serial work. On gitea it took 8.9 s
of the 21 s that the plugin of vet spent on that goroutine, and the
goroutine set the wall time of the run.

The worker now keeps the call graph of the index in its outcome. A
plugin that implements the new GraphPlugin gets it through
AnalyzeGraph. A file with no call graph, as one whose index failed,
still goes to Analyze. The index is complete before the plugin runs, so
the plugin cannot change the index. The callgraph plugin gets
AnalyzeGraph too, so a caller with a graph runs its callback and its
partial check without a second build.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
Signed-off-by: Claude <noreply@anthropic.com>
A review found three gaps in the shared call graph.

Each outcome kept its call graph, also in a run with no GraphPlugin. The
pool keeps two outcomes per worker in flight, so a run with no plugin
held graphs that it never read. The pool now keeps a graph only when the
run has a GraphPlugin.

The GraphPlugin doc said that a file whose index failed goes to Analyze.
A file that the deadline cut has a failed index and a partial graph, and
it goes to AnalyzeGraph. The doc now says that a file whose call graph
did not build goes to Analyze. It also says that a file that the workers
finished before the deadline gets its full graph.

The run test checked only the file name of the graph. It now compares
the graph with the one that callgraph.Build gives for the tree.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
Signed-off-by: Claude <noreply@anthropic.com>
The call graph build wrote a debug line for each call, each definition
and each resolved call or constructor. A debug index run of gitea wrote
185,860 lines, and 160,836 of them were "Go call". The log took 2.3 s
of a 15.8 s run. The lines named what the graph holds, so they did not
help to find a fault.

dry/log has no trace level, so the build no longer writes them. It
keeps the line for each file and the lines that report a problem, as a
node with no name or a limit that the build hit. The debug run of gitea
writes 5,566 lines and takes 13.8 s.

A new test builds a file with one call and with 50 calls in Go,
JavaScript, Python and Java, and expects the same number of log lines.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PFQbqPqd9xn1fT6hBsyoUm
Signed-off-by: Claude <noreply@anthropic.com>
An editable install has a .dist-info in site-packages, and its RECORD
lists a .pth file and no Python file. The distribution graph walked it,
found no file and opened it, so a project that pip install -e . installs
reached an open node on each scan. The code of an editable install is the
project itself.

The distribution reader now reads direct_url.json and marks an editable
install. The distribution graph leaves it out.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0149TuYSppnJAa4JVsXXqHDA
@safedep

safedep Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

SafeDep Report Summary

Green Malicious Packages Badge Green Vulnerable Packages Badge Green Risky License Badge

No dependency changes detected. Nothing to scan.

View complete scan results →

This report is generated by SafeDep GitHub App

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-31T12:51:41.349073Z 7229801 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@abhisek
abhisek merged commit 39cf1e2 into main Oct 31, 2026
7 of 8 checks passed
@abhisek
abhisek deleted the claude/python-call-graph-plan-vakrcz branch October 31, 2026 12:50

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7229801d16

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread distgraph/graph.go
Comment on lines +322 to +323
if !d.Editable {
b.addDistribution(sp, d)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Retain editable dependencies outside the scanned project

When the environment contains an editable dependency installed from another directory (for example, a sibling library), Editable does not mean its source is inside ProjectFS. Dropping that distribution also removes its import names from byTop, while the project walk never reads its code. If the project imports that library inside a try guarded by ImportError, resolve now ignores the import entirely instead of reaching the library's open node, so the library's transitive dependencies can incorrectly appear unreachable. Only omit an editable distribution after establishing that the project walk covers its source; otherwise retain it as an open node.

Useful? React with 👍 / 👎.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 76.47059% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.18%. Comparing base (0661438) to head (7229801).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
projectgraph/modules/pydist.go 73.33% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main      #59   +/-   ##
=======================================
  Coverage   77.17%   77.18%           
=======================================
  Files         180      180           
  Lines       18148    18163   +15     
=======================================
+ Hits        14006    14019   +13     
- Misses       3299     3300    +1     
- Partials      843      844    +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

abhisek added a commit to safedep/vet that referenced this pull request Oct 31, 2026
v2 pinned a commit on a branch of safedep/code, because the import graph
of a Python manifest needed the editable-install flag of the
distribution reader before safedep/code#59 merged. main holds it now.


Claude-Session: https://claude.ai/code/session_0149TuYSppnJAa4JVsXXqHDA

Co-authored-by: Claude <noreply@anthropic.com>
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.

3 participants