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" 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 returns the WheelConfig for the cog SDK based on COG_WHEEL env var.
Resolution order:
- COG_WHEEL env var (if set, explicit override)
- Auto-detect: check dist/cog-*.whl (for development)
- Default: PyPI
For development builds (snapshot versions), auto-detection is enabled. For release builds, auto-detection is skipped (always PyPI unless overridden).
func GetCogletWheelConfig ¶
func GetCogletWheelConfig() (*WheelConfig, error)
GetCogletWheelConfig returns the WheelConfig for coglet based on COGLET_WHEEL env var.
Coglet is always opt-in via COGLET_WHEEL env var. Supported values:
- "dist" - Use local dist/ directory
- "pypi" or "pypi:version" - Install from PyPI
- URL or file path - Direct wheel location
Returns nil, nil if coglet should not be installed (default). Returns nil, error if configuration is invalid.
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 (*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