feat: handle editable installs as third-party packages#84
Conversation
Fixtures from editable installs (pip install -e) are now recognized as third-party packages. Discovers editable installs via direct_url.json and .pth files in site-packages, resolves entry points through editable source roots, and displays them in the CLI tree under site-packages with an "(editable install)" label.
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #84 +/- ##
==========================================
+ Coverage 53.05% 54.94% +1.88%
==========================================
Files 26 26
Lines 2829 2992 +163
==========================================
+ Hits 1501 1644 +143
- Misses 1328 1348 +20 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 99130095d4
ℹ️ 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".
There was a problem hiding this comment.
Pull request overview
Adds support for treating fixtures coming from Python editable installs (pip install -e) as third-party by discovering editable source roots during venv scanning and using them for plugin/module resolution and CLI display. This aligns fixture classification/reporting with how Python actually resolves editable installs (via .pth / direct_url.json).
Changes:
- Discover editable installs in
site-packagesand use editable source roots as a fallback for resolving pytest plugin entry points and absolute imports. - Mark fixtures originating from external editable installs as
is_third_partyso they’re excluded from unused-fixture reporting. - Remap editable-install fixture paths for CLI tree display and add test coverage for editable classification and discovery.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/fixtures/scanner.rs |
Adds editable-install discovery (direct_url.json + .pth) and entry-point resolution fallback; extends import scan to include editable-root files. |
src/fixtures/mod.rs |
Introduces EditableInstall and workspace-aware third-party detection helper. |
src/fixtures/imports.rs |
Adds absolute import fallback to search editable install source roots. |
src/fixtures/analyzer.rs |
Extends is_third_party classification to include external editable installs. |
src/fixtures/cli.rs |
Remaps editable-install fixture paths for display under site-packages and labels editable directories in the tree. |
tests/test_fixtures.rs |
Adds integration-style tests for is_third_party behavior and unused-fixture exclusion for editables. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Add raw_package_name to EditableInstall for namespace package labeling - Remove url fallback (wrong for src-layout); .pth is canonical source - Fix .pth prefix matching to require version digit after dash separator - Canonicalize workspace_root, site_packages, and VIRTUAL_ENV paths - Validate .pth content (reject control chars, verify directory) - Fix CLI namespace label using dot-split raw name - Remap usage count keys after editable path remapping
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Validate site_packages is a directory before read_dir - Reject .pth lines containing path traversal sequences (..) - Add comments clarifying canonicalize + is_dir validation
Summary
Closes #76.
pip install -e) viadirect_url.json+.pthfiles in site-packages during venv scanningis_third_party, excluding them from unused fixture reports(editable install)label_<pkg>.pth) and new (__editable__.<pkg>.pth) pip naming conventions, including packages with dashes and dots in their namesTest plan
extract_package_name_from_dist_info(various name formats including dashes/dots)discover_editable_installs(mock site-packages withdirect_url.json+.pth).pthfiles with dashes and dots in package names.clear()behavior)is_third_party = trueis_third_party = false