requirementsnet

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 20, 2025 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Overview

Package requirementsnet extracts requirements files with .

Index

Constants

View Source
const (
	// Name is the unique name of this extractor.
	Name = "python/requirementsnet"
)

Variables

This section is empty.

Functions

func NewDefault

func NewDefault() filesystem.Extractor

NewDefault returns an extractor with the default config settings.

Types

type Config

type Config struct {
	// This should be an extractor to extract inventories from requirements.txt offline.
	*requirements.Extractor // Extractor to extract inventories from requirements.txt offline.
	resolve.Client
}

Config is the configuration for the Extractor.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns the default configuration for the extractor.

type Extractor

type Extractor struct {
	BaseExtractor *requirements.Extractor // The base extractor that we use to extract direct dependencies.
	resolve.Client
}

Extractor extracts python packages from requirements.txt files.

func New

func New(cfg Config) *Extractor

New returns a requirements.txt transitive extractor.

For most use cases, initialize with: ``` e := New(DefaultConfig()) ```

func (Extractor) Ecosystem

func (Extractor) Ecosystem(i *extractor.Package) string

Ecosystem returns the OSV Ecosystem of the software extracted by this extractor.

func (Extractor) Extract

Extract extracts packages from requirements files passed through the scan input.

func (Extractor) FileRequired

func (e Extractor) FileRequired(api filesystem.FileAPI) bool

FileRequired returns true if the specified file matches python Metadata file patterns.

func (Extractor) Name

func (e Extractor) Name() string

Name of the extractor.

func (Extractor) Requirements

func (e Extractor) Requirements() *plugin.Capabilities

Requirements of the extractor.

func (Extractor) ToPURL

func (e Extractor) ToPURL(p *extractor.Package) *purl.PackageURL

ToPURL converts an inventory created by this extractor into a PURL. TODO(b/400910349): Remove and use Package.PURL() directly.

func (Extractor) Version

func (e Extractor) Version() int

Version of the extractor.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL