Skip to content

feat: handle editable installs as third-party packages#84

Merged
bellini666 merged 3 commits intomasterfrom
feat/editable-install-third-party
Feb 14, 2026
Merged

feat: handle editable installs as third-party packages#84
bellini666 merged 3 commits intomasterfrom
feat/editable-install-third-party

Conversation

@bellini666
Copy link
Copy Markdown
Owner

Summary

Closes #76.

  • Discover editable installs (pip install -e) via direct_url.json + .pth files in site-packages during venv scanning
  • Resolve pytest plugin entry points through editable install source roots as a fallback when standard site-packages resolution fails
  • Mark fixtures from external editable installs as is_third_party, excluding them from unused fixture reports
  • Display editable install fixtures in the CLI tree under their site-packages path with an (editable install) label
  • Handle bidirectional workspace overlap (editable source inside workspace, or workspace inside editable source) to avoid misclassifying the user's own project
  • Support both old (_<pkg>.pth) and new (__editable__.<pkg>.pth) pip naming conventions, including packages with dashes and dots in their names

Test plan

  • Unit tests for extract_package_name_from_dist_info (various name formats including dashes/dots)
  • Unit tests for discover_editable_installs (mock site-packages with direct_url.json + .pth)
  • Unit tests for editable entry point resolution fallback
  • Unit tests for .pth files with dashes and dots in package names
  • Unit test for dedup on rescan (.clear() behavior)
  • Integration test: external editable → is_third_party = true
  • Integration test: in-workspace editable → is_third_party = false
  • Integration test: third-party editable fixtures excluded from unused report
  • All 497 existing tests pass
  • Clippy clean

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.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 14, 2026

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 14, 2026

Codecov Report

❌ Patch coverage is 69.64286% with 51 lines in your changes missing coverage. Please review.
✅ Project coverage is 54.94%. Comparing base (9c5cd5e) to head (ab4f47b).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
src/fixtures/cli.rs 0.00% 34 Missing ⚠️
src/fixtures/scanner.rs 87.93% 14 Missing ⚠️
src/fixtures/imports.rs 0.00% 3 Missing ⚠️
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.
📢 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.

Copy link
Copy Markdown

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

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: 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".

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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-packages and 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_party so 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
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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
@bellini666 bellini666 merged commit a30fa62 into master Feb 14, 2026
20 checks passed
@bellini666 bellini666 deleted the feat/editable-install-third-party branch February 14, 2026 15:28
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.

Handle Editable Installs as Third-Party Packages

2 participants