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 ¶
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 ¶
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 ¶
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