Documentation
¶
Overview ¶
Package wheels provides configuration for sourcing cog and coglet wheels.
Index ¶
Constants ¶
const CogWheelEnvVar = "COG_WHEEL"
CogWheelEnvVar is the environment variable name for cog SDK wheel selection
const CogletWheelEnvVar = "COGLET_WHEEL"
CogletWheelEnvVar is the environment variable name for coglet wheel selection
Variables ¶
This section is empty.
Functions ¶
func SemverToPEP440 ¶
SemverToPEP440 converts a semver pre-release version to PEP 440 format. e.g. "0.17.0-alpha1" -> "0.17.0a1", "0.17.0-beta2" -> "0.17.0b2", "0.17.0-rc1" -> "0.17.0rc1", "0.17.0-dev1" -> "0.17.0.dev1" Stable versions pass through unchanged: "0.17.0" -> "0.17.0"
Types ¶
type WheelConfig ¶
type WheelConfig struct {
// Source indicates where the wheel comes from
Source WheelSource
// URL is set when Source is WheelSourceURL
URL string
// Path is set when Source is WheelSourceFile (absolute path)
Path string
// Version is set when Source is WheelSourcePyPI (optional, empty = latest)
Version string
}
WheelConfig represents the configuration for which wheel to install
func GetCogWheelConfig ¶
func GetCogWheelConfig() (*WheelConfig, error)
GetCogWheelConfig is a convenience wrapper that reads COG_WHEEL from the environment and version from global.Version.
func GetCogletWheelConfig ¶
func GetCogletWheelConfig() (*WheelConfig, error)
GetCogletWheelConfig is a convenience wrapper that reads COGLET_WHEEL from the environment.
func ParseWheelValue ¶
func ParseWheelValue(value string) *WheelConfig
ParseWheelValue parses a wheel env var value and returns the appropriate WheelConfig. Supported values:
- "pypi" - Install from PyPI (latest version)
- "pypi:0.12.0" - Install specific version from PyPI
- "dist" - Use local dist/ directory (error if not found)
- "https://..." or "http://..." - Direct wheel URL
- "/path/to/file.whl" or "./path/to/file.whl" - Local wheel file
Returns nil if the value is empty (caller should use auto-detection).
func ResolveCogWheel ¶
func ResolveCogWheel(envValue string, version string) (*WheelConfig, error)
ResolveCogWheel resolves the WheelConfig for the cog SDK.
Parameters:
- envValue: value of COG_WHEEL env var (empty string if not set)
- version: the CLI version (e.g. "dev", "0.17.0", "0.17.0-alpha1")
Resolution order:
- envValue (if non-empty, explicit override)
- Auto-detect: check dist/cog-*.whl (for development builds only)
- Default: PyPI (with version pin for release builds)
func ResolveCogletWheel ¶
func ResolveCogletWheel(envValue string) (*WheelConfig, error)
ResolveCogletWheel resolves the WheelConfig for coglet.
Parameters:
- envValue: value of COGLET_WHEEL env var (empty string if not set)
Coglet is always opt-in. Returns nil, nil if envValue is empty. Returns nil, error if configuration is invalid.
func (*WheelConfig) PyPIPackageURL ¶
func (c *WheelConfig) PyPIPackageURL(packageName string) string
PyPIPackageURL returns the pip install specifier for a PyPI package. If version is empty, returns just the package name (latest). Otherwise returns "package==version" with the version converted to PEP 440.
type WheelSource ¶
type WheelSource int
WheelSource represents the source type for the wheel to install
const ( // WheelSourcePyPI installs from PyPI (default for released builds) WheelSourcePyPI WheelSource = iota // WheelSourceURL uses a custom URL WheelSourceURL // WheelSourceFile uses a local file path WheelSourceFile )
func (WheelSource) String ¶
func (s WheelSource) String() string
String returns the string representation of the WheelSource