resolve

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: Apache-2.0 Imports: 8 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 resolve chooses a consistent set of package versions for a set of requirements. It is a version-solving resolver in the PubGrub style: it reasons over incompatibilities (sets of package terms that cannot all hold), propagates their consequences as units, and on a conflict derives a new incompatibility and backjumps. Because the universe of versions for a package is finite, constraints are represented as finite version sets.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Verify

func Verify(ctx context.Context, source pypi.Source, env requirement.Environment, roots []*requirement.Requirement, sol *Solution) error

Verify checks that a solution actually satisfies the requirements: every applicable root and every applicable dependency of every resolved package is present at a version that meets its constraint. It returns an error describing the first violation, or nil when the solution is valid.

Types

type Option

type Option func(*Resolver)

Option configures a Resolver.

func WithEnvironment

func WithEnvironment(env requirement.Environment) Option

WithEnvironment sets the marker environment used to evaluate dependency markers. The target Python version should be present for requires-python checks.

func WithPythonVersion

func WithPythonVersion(v *version.Version) Option

WithPythonVersion sets the target Python version for requires-python filtering.

type ResolutionError

type ResolutionError struct {
	Cause *incompatibility
}

ResolutionError reports that no set of versions satisfies the requirements.

func (*ResolutionError) Error

func (e *ResolutionError) Error() string

type Resolver

type Resolver struct {
	// contains filtered or unexported fields
}

Resolver holds resolution state for one run.

func New

func New(source pypi.Source, opts ...Option) *Resolver

New creates a resolver over the given source.

func (*Resolver) Resolve

func (r *Resolver) Resolve(ctx context.Context, roots []*requirement.Requirement) (*Solution, error)

Resolve finds versions for the given root requirements.

type Solution

type Solution struct {
	Packages map[string]*version.Version
	Roots    []string
	Edges    map[string][]string
}

Solution is the result of resolution: the chosen version of each package, the canonical names required directly by the project, and the dependency edges between resolved packages. Edges and Roots drive the lockfile and the explain tree.

Jump to

Keyboard shortcuts

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