Documentation ¶
Index ¶
- Variables
- func NormalizedPkgName(pkg string) string
- type PackageIndex
- func (p *PackageIndex) AllPackages() ([]string, error)
- func (p *PackageIndex) FetchPackageRequirements(pkg string) ([]*Requirement, error)
- func (p *PackageIndex) FetchRawMetadata(pkg string, tarPattern, eggPattern, zipPattern *regexp.Regexp) ([]byte, error)
- func (p *PackageIndex) FetchSourceRepoURL(pkg string) (string, error)
- func (p *PackageIndex) FetchSourceTopLevelModules(pkg string) ([]string, error)
- type PyPIGraph
- type Requirement
Constants ¶
This section is empty.
Variables ¶
var DefaultPyPI = &PackageIndex{URI: "https://pypi.python.org"}
Functions ¶
func NormalizedPkgName ¶
Normalizes package names so they are comparable
Types ¶
type PackageIndex ¶
type PackageIndex struct {
URI string
}
func (*PackageIndex) AllPackages ¶
func (p *PackageIndex) AllPackages() ([]string, error)
Get names of all packages served by a PyPI server.
func (*PackageIndex) FetchPackageRequirements ¶
func (p *PackageIndex) FetchPackageRequirements(pkg string) ([]*Requirement, error)
Fetches package requirements from PyPI by downloading the package archive and extracting the requires.txt file. If no such file exists (sometimes it doesn't), returns an error.
func (*PackageIndex) FetchRawMetadata ¶
func (*PackageIndex) FetchSourceRepoURL ¶
func (p *PackageIndex) FetchSourceRepoURL(pkg string) (string, error)
Returns the source repository URL for a given PyPI package. This information is not explicitly specified anywhere in PyPI metadata, so try to infer it by doing the following: First, check if it is hardcoded below. If not, then fetch the metadata from the PyPI server and check if the website (specified in the metdata) pattern matches a repository URL.
func (*PackageIndex) FetchSourceTopLevelModules ¶
func (p *PackageIndex) FetchSourceTopLevelModules(pkg string) ([]string, error)
Returns the top-level modules for a given PyPI package. This information is typically stored in the PyPI metadata, which is fetched from the remote PyPI server. In some cases where the information is unavailable in the metadata, it has been hard-coded below.
type PyPIGraph ¶
Dependency graph over repositories in a given Python Package Index.
var DefaultPyPIGraph *PyPIGraph
func NewPyPIGraph ¶
Deserializes a PyPIGraph stored in a file
func (*PyPIGraph) RequiredBy ¶
type Requirement ¶
func ParseRequirement ¶
func ParseRequirement(reqStr string) (*Requirement, error)
Parse a single raw requirement, e.g., from "flask=1.0.1"
func ParseRequirements ¶
func ParseRequirements(rawReqs string) ([]*Requirement, error)
Parse requirements from a raw string in the requirements format expected by pip (e.g., in requirements.txt)
func RequirementsForDir ¶
func RequirementsForDir(dir string) ([]*Requirement, error)
Return requirements for python PyPI package in directory