lockfile

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: Apache-2.0 Imports: 5 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 lockfile turns a resolution into gpt.lock, a deterministic JSON lockfile, and renders the dependency tree. The lockfile is a pure function of the resolution: package and dependency lists are sorted, so the same resolution always produces byte-identical output on any machine or operating system.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Explain

func Explain(sol *resolve.Solution) string

Explain renders the resolved dependency tree as indented text, starting from the direct requirements. A package that reappears on the current path is marked as a cycle rather than expanded, so the output is always finite.

Types

type Lock

type Lock struct {
	Version  int       `json:"version"`
	Roots    []string  `json:"roots"`
	Packages []Package `json:"packages"`
}

Lock is the content of a gpt.lock file.

func Build

func Build(sol *resolve.Solution) *Lock

Build creates a lock from a resolution.

func Parse

func Parse(data []byte) (*Lock, error)

Parse reads a lock from its JSON form.

func (*Lock) Marshal

func (l *Lock) Marshal() ([]byte, error)

Marshal renders the lock as pretty-printed JSON with a trailing newline. The output is deterministic for a given lock.

type Package

type Package struct {
	Name    string `json:"name"`
	Version string `json:"version"`
	// Extras are the optional features of this package the resolution selected,
	// sorted. Absent when none were, so a lock without extras is unchanged.
	Extras []string `json:"extras,omitempty"`
	// Hashes are the digests of the artifacts published for this version, in
	// pip's hash syntax, sorted. Absent when the index published none.
	Hashes       []string `json:"hashes,omitempty"`
	Dependencies []string `json:"dependencies,omitempty"`
}

Package is one locked package with the resolved packages it depends on.

Jump to

Keyboard shortcuts

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