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 WithConcurrency ¶ added in v0.1.1
WithConcurrency sets how many index requests may be in flight at once. It affects only how quickly a resolution is reached, never what it resolves to.
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 ¶
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
func (*ResolutionError) Explain ¶ added in v0.1.1
func (e *ResolutionError) Explain() []string
Explain returns the requirements that together make the resolution impossible, in the order they were discovered.
The solver reaches a contradiction through a chain of derived incompatibilities, each resolved from two others. Those derivations are the machinery, not the reason. Walking back to the facts that were stated rather than derived, each of which is a requirement a person or a package actually declared, gives the conflict in terms the reader can act on.
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
Resolver holds resolution state for one run.
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
// Extras records, per package, the extras the resolution selected, sorted.
// A package with no extras selected has no entry.
Extras map[string][]string
// Hashes records, per package, the digests of the artifacts published for the
// resolved version, sorted. Every artifact is listed because which one gets
// installed depends on the machine doing the installing.
Hashes 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.