Documentation
¶
Index ¶
Constants ¶
const ( DefaultMaxWorkers = 10 DefaultTimeout = 30 * time.Second DefaultUserAgent = "angela/0.1.0 (https://github.com/CarterPerez-dev/angela)" )
PyPI client configuration defaults.
const DefaultCacheTTL = 1 * time.Hour
DefaultCacheTTL defines how long cached PyPI responses remain valid
Variables ¶
var ErrInvalidVersion = errors.New("invalid PEP 440 version")
ErrInvalidVersion indicates a string that does not conform to PEP 440
Functions ¶
func NormalizeName ¶
NormalizeName converts a PyPI package name to its canonical form per PEP 503
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache provides file-backed storage for PyPI API responses with ETag support
func (*Cache) Get ¶
func (c *Cache) Get(key string) (*CacheEntry, bool)
Get retrieves a cache entry by package name, returning false on miss
func (*Cache) IsFresh ¶
func (c *Cache) IsFresh(entry *CacheEntry) bool
IsFresh reports whether the entry is still within its TTL window
type CacheEntry ¶
type CacheEntry struct {
ETag string `json:"etag"`
Versions []string `json:"versions"`
CachedAt time.Time `json:"cached_at"`
}
CacheEntry holds a cached PyPI response alongside its freshness metadata
type ChangeKind ¶
type ChangeKind int
ChangeKind classifies a version bump by semver magnitude
const ( Patch ChangeKind = iota + 1 Minor Major )
Version change magnitudes.
func ClassifyChange ¶
func ClassifyChange(from, to Version) ChangeKind
ClassifyChange determines whether moving from v to other is a major, minor, or patch bump based on their release segments
func (ChangeKind) String ¶
func (c ChangeKind) String() string
String returns the lowercase name of the change kind
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client queries the PyPI Simple API for package version information
func (*Client) ClearCache ¶
ClearCache removes all cached PyPI responses
func (*Client) FetchAllVersions ¶
func (c *Client) FetchAllVersions( ctx context.Context, names []string, ) []FetchResult
FetchAllVersions queries multiple packages concurrently and returns per-package results. Failures for individual packages do not prevent the remaining packages from being fetched.
type FetchResult ¶
FetchResult holds the outcome of querying a single package
type Version ¶
type Version struct {
Raw string
Epoch int
Release []int
PreKind string
PreNum int
Post int
Dev int
Local string
}
Version represents a parsed PEP 440 version with all optional components
func LatestStable ¶
LatestStable finds the highest stable version from a list of version strings
func ParseVersion ¶
ParseVersion parses a PEP 440 version string into its structured components
func (Version) Compare ¶
Compare returns -1, 0, or 1 following PEP 440 ordering rules.
The ordering within a given release segment is:
1.0.dev1 < 1.0a1 < 1.0b1 < 1.0rc1 < 1.0 < 1.0.post1