Add Pip3 support (#75)

* add pip3 support

* add pip3 e2e

* chore: rename var
This commit is contained in:
Sahil Bansal
2025-12-03 20:28:45 +05:30
committed by GitHub
parent c47cb30de0
commit 50d7b55445
7 changed files with 122 additions and 2 deletions
+21 -2
View File
@@ -19,8 +19,8 @@ func (p *PipExtractor) GetPackageManager() PackageManagerName {
return Pip
}
func (n *PipExtractor) Extract(lockfilePath, scanDir string) ([]*packagev1.PackageVersion, error) {
return parseLockfile(lockfilePath, scanDir, n.GetEcosystem())
func (p *PipExtractor) Extract(lockfilePath, scanDir string) ([]*packagev1.PackageVersion, error) {
return parseLockfile(lockfilePath, scanDir, p.GetEcosystem())
}
// UvExtractor handles uv.lock files
@@ -60,3 +60,22 @@ func (p *PoetryExtractor) GetPackageManager() PackageManagerName {
func (p *PoetryExtractor) Extract(lockfilePath, scanDir string) ([]*packagev1.PackageVersion, error) {
return parseLockfile(lockfilePath, scanDir, p.GetEcosystem())
}
// Pip3Extractor handles requirements.txt files
type Pip3Extractor struct{}
func (p *Pip3Extractor) GetSupportedFiles() []string {
return []string{"requirements.txt"}
}
func (p *Pip3Extractor) GetEcosystem() packagev1.Ecosystem {
return packagev1.Ecosystem_ECOSYSTEM_PYPI
}
func (p *Pip3Extractor) GetPackageManager() PackageManagerName {
return Pip3
}
func (p *Pip3Extractor) Extract(lockfilePath, scanDir string) ([]*packagev1.PackageVersion, error) {
return parseLockfile(lockfilePath, scanDir, p.GetEcosystem())
}