wheel

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package wheel builds PEP 427 .whl files from resolved Go binaries.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildMetadataText

func BuildMetadataText(cfg Config, version string, classifiers []string) string

BuildMetadataText returns the METADATA content that BuildAll would embed in a wheel without requiring any binaries. classifiers should be the platform-independent set; OS classifiers depend on which binaries are uploaded and must be omitted when calling this for comparison purposes.

All Project-URLs (primary Repository from cfg.URL plus cfg.ExtraURLs) are sorted alphabetically so the output is deterministic and diff-friendly. This sort applies only here; BuildAll preserves its existing emission order.

func DevelopmentStatus

func DevelopmentStatus(version string) string

DevelopmentStatus returns the PyPI trove classifier string for the given PEP 440 version. Pre-release suffixes (a, b, rc, .dev) map to the corresponding development stages; all other versions map to Production/Stable.

func NormalizeName

func NormalizeName(name string) string

NormalizeName applies PEP 625 / PEP 427 name normalisation: lowercase and run of [-._]+ replaced by a single underscore.

func PlatformIndependentClassifiers

func PlatformIndependentClassifiers(version string) []string

PlatformIndependentClassifiers returns the trove classifiers that every gowheels-built wheel carries regardless of target platform: a version-derived Development Status, the Console environment, and Python 3 language. OS-specific classifiers ("Operating System :: …") are platform-dependent and are added separately by BuildAll from the resolved binary list.

func ValidateLicenseExpression

func ValidateLicenseExpression(expr string) error

ValidateLicenseExpression reports whether expr is a well-formed SPDX expression for use in the Metadata-Version 2.4 License-Expression field.

It validates the character set and operator casing. It does not verify that individual identifiers exist in the SPDX license list — pass a clearly incorrect value like "Apache 2.0" (instead of "Apache-2.0") and this will not catch the wrong identifier, but it will catch malformed expressions such as those containing commas, slashes, underscores, or lowercase operators.

Types

type BuiltWheel

type BuiltWheel struct {
	Filename string
	Metadata string // RFC 822 METADATA content embedded in the dist-info directory
	Data     []byte
}

BuiltWheel represents a .whl file that was created on disk and whose bytes are held in memory for the optional upload step.

func BuildAll

func BuildAll(cfg Config, binaries []source.Binary) ([]BuiltWheel, error)

BuildAll builds one wheel per WheelTag across all binaries. A Linux binary with two wheel tags (manylinux + musllinux) produces two wheels from the same bytes without re-reading the source.

type Config

type Config struct {
	// Package identity
	RawName     string // binary name as supplied (e.g. "my-tool")
	PackageName string // Python package name; defaults to NormalizeName(RawName)
	EntryPoint  string // console_scripts key; defaults to RawName

	// Metadata
	Version     string // PEP 440, already normalised
	Summary     string
	URL         string
	LicenseExpr string // SPDX expression, e.g. "MIT"
	LicensePath string // local license file; empty → no license bundled
	ReadmePath  string // explicit readme; empty → auto-detect; "-" → none

	// Keywords are optional search terms included in the wheel METADATA as a
	// space-separated Keywords field. GitHub topics are a good source.
	Keywords []string

	// Classifiers are additional PyPI trove classifiers. BuildAll always emits
	// Development Status, Programming Language, and Environment classifiers
	// automatically; entries here are appended after those.
	Classifiers []string

	// ExtraURLs are additional Project-URL entries beyond the primary URL.
	// Each element is a [2]string{label, url} pair, e.g.
	// {"Bug Tracker", "https://github.com/owner/repo/issues"}.
	ExtraURLs [][2]string

	// Output
	OutputDir string // defaults to "dist"
}

Config parameterises a wheel build.

Jump to

Keyboard shortcuts

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