wheel

package
v0.0.0-...-cc320b4 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: BSD-3-Clause Imports: 19 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package wheel builds spec-compliant, byte-reproducible pure-Python wheels from a local source tree. It only relocates and zips files; it never executes the source it packs (no setup.py, no PEP 517 backend, no subprocess of any kind).

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoPythonFiles indicates the source tree has no .py files to pack.
	ErrNoPythonFiles = errs.New("source tree contains no Python files")
	// ErrNativeContent indicates the source tree contains compiled, platform-specific files.
	ErrNativeContent = errs.New("source tree contains non-pure-Python (compiled) files")
	// ErrMissingMetadata indicates the package name or version could not be determined.
	ErrMissingMetadata = errs.New("package name and version are required")
)

Functions

func Pack

func Pack(srcDir string, meta Metadata, outDir string) (string, error)

Pack builds a pure-Python wheel from the already-resolved meta (use ResolveMetadata to derive it from pyproject.toml), writes it into outDir as {normalized_name}-{version}-py3-none-any.whl, and returns the wheel path.

The wheel root mirrors srcDir: the caller points srcDir at the directory whose children are the importable packages. The top-level pyproject.toml, __pycache__ directories, *.pyc/*.pyo files, and version-control directories are not packed. Compiled files (.so/.pyd/.dll/.dylib) are rejected.

Output is byte-reproducible: identical input trees produce identical wheels regardless of file timestamps. On any failure no wheel is left at the path.

Types

type Metadata

type Metadata struct {
	Name    string
	Version string
	Summary string
	// Requires holds PEP 508 requirement strings, recorded as Requires-Dist.
	Requires []string
}

Metadata is the core package metadata recorded in the wheel. Empty fields fall back to pyproject.toml; non-empty fields override it.

func ResolveMetadata

func ResolveMetadata(srcDir string, override Metadata) (*Metadata, error)

ResolveMetadata reads srcDir's pyproject.toml [project] table and applies the non-empty fields of override on top, producing the metadata to pack with. It returns a *MissingMetadataError when neither source supplies a name or version. Requires always comes from pyproject.toml's dependencies.

type MissingMetadataError

type MissingMetadataError struct {
	Fields []string
	// Pyproject is the pyproject.toml that was read, or empty when there is none.
	Pyproject string
	// Dynamic holds the missing fields pyproject.toml lists in [project].dynamic,
	// which a build backend computes and so cannot be read from the file.
	Dynamic []string
}

MissingMetadataError reports which of name and version neither the caller nor pyproject.toml supplied, and what pyproject.toml said about them, so the user can be told how to provide them.

func (*MissingMetadataError) Error

func (e *MissingMetadataError) Error() string

func (*MissingMetadataError) Is

func (e *MissingMetadataError) Is(target error) bool

Jump to

Keyboard shortcuts

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