feat: add Python patching support with comprehensive tests#28
Merged
Mikola Lysenko (mikolalysenko) merged 5 commits intomainfrom Feb 13, 2026
Merged
Conversation
- Add getBunGlobalPrefix() function to detect bun's global package path - Update getGlobalNodeModulesPaths() to include pnpm, yarn, and bun paths - Export getBunGlobalPrefix() for external use 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Export the getBunGlobalPrefix function to allow checking bun's global package prefix. Also adds test coverage for the export. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Add Python ecosystem support to socket-patch including: - PythonCrawler for discovering packages in site-packages via dist-info/METADATA - PURL utilities for PyPI package parsing and qualification stripping - Apply/rollback support for PyPI packages with qualifier variant fallback - Scan command integration with ecosystem summary (npm + python) Test coverage (52 new tests across 6 files): - purl-utils: stripPurlQualifiers, isPyPIPurl, isNpmPurl, parsePyPIPurl - python-crawler: canonicalizePyPIName, crawlAll, crawlBatches, findByPurls, findPythonDirs, findLocalVenvSitePackages, getSitePackagesPaths - apply-python: patch application to pypi packages, mixed npm+pypi, dry-run - apply-qualifier-fallback: variant selection, hash matching, dedup - scan-python: combined scanning, API integration, ecosystem summary - python-venv: real venv tests (skippable if python3 unavailable) Also exports canonicalizePyPIName, findPythonDirs, findLocalVenvSitePackages from crawlers module, and extends test-utils with createTestPythonPackage and pypi support in setupTestEnvironment. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Ensure finally blocks always restore process.env.VIRTUAL_ENV to its original state, including deleting it when it was originally undefined. Prevents env var leaks between tests. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove the python3 -c fallback from findLocalVenvSitePackages. In local mode (non-global), only project-local venvs should be scanned (VIRTUAL_ENV, .venv, venv). System-wide packages are only discovered when --global is passed, via getGlobalPythonSitePackages. This fixes e2e test failures where empty projects incorrectly found system Python packages on CI runners. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add Python ecosystem support to socket-patch with comprehensive test coverage:
createTestPythonPackagehelper and pypi support insetupTestEnvironmentTest Coverage (52 new tests across 6 files)
purl-utils.test.tspython-crawler.test.tsapply-python.test.tsapply-qualifier-fallback.test.tsscan-python.test.tspython-venv.test.tsAll 195 tests pass (52 new + 143 existing, 0 regressions).
🤖 Generated with Claude Code