pypi

package
v0.0.0-...-1e56917 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SourceAPI is the format string for the PyPi API
	SourceAPI = "https://pypi.python.org/pypi/%s/json"
	// DateFormat is the Time format used by PyPi
	DateFormat = "2006-01-02T15:04:05"
)

Variables

View Source
var TarballRegex = regexp.MustCompile("https?://[^/]*py[^/]*/packages/(?:[^/]+/)+(.+)$")

TarballRegex matches PyPi source tarballs

Functions

func ConvertURLS

func ConvertURLS(cr []URL, name, version string) *results.Result

ConvertURLS translates PyPi URLs to Cuppa results

Types

type Info

type Info struct {
	Version string `json:"version"`
}

Info contains a PyPi Version number

type LatestSource

type LatestSource struct {
	Info Info  `json:"info"`
	URLs []URL `json:"urls"`
}

LatestSource contains a JSON representation of a PyPi Source

func (*LatestSource) Convert

func (cr *LatestSource) Convert(name string) *results.Result

Convert turns a PyPi latest into a Cuppa Result

type Provider

type Provider struct{}

Provider is the upstream provider interface for pypi

func (Provider) Latest

func (c Provider) Latest(params []string) (r *results.Result, err error)

Latest finds the newest release for a pypi package

func (Provider) Match

func (c Provider) Match(query string) (params []string)

Match checks to see if this provider can handle this kind of query

func (Provider) Releases

func (c Provider) Releases(params []string) (rs *results.ResultSet, err error)

Releases finds all matching releases for a pypi package

func (Provider) String

func (c Provider) String() string

String gives the name of this provider

type Releases

type Releases struct {
	Releases map[string][]URL `json:"releases"`
}

Releases holds one or more Source URLs

func (*Releases) Convert

func (crs *Releases) Convert(name string) *results.ResultSet

Convert turns PyPi releases into a Cuppa results set

type URL

type URL struct {
	UploadTime string `json:"upload_time"`
	URL        string `json:"url"`
}

URL contains a JSON representation of a PyPi tarball URL

Jump to

Keyboard shortcuts

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