pypi

package
v1.15.9 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2025 License: MIT Imports: 36 Imported by: 0

Documentation

Overview

Package pypi facilitates executing the program as a proxy server for translating pypi requests into OCI registry operations. This enables an OCI registry to act as a pypi package registry.

Index

Constants

View Source
const (
	// PythonDistributionDigest is the annotation key used for denoting the digest (e.g., sha256:deedbef...) of the distribution file (often a whl).
	PythonDistributionDigest = "vnd.act3-ace.python.distribution.digest"

	// PythonDistributionFilename is the annotation key used for denoting the file name of the distribution file (often a mypkg-1.0.0-something.whl).
	PythonDistributionFilename = "vnd.act3-ace.python.distribution.filename"

	// PythonDistributionMetadataDigest is the annotation key used for denoting the digest of the METADATA of the whl or sdist.
	PythonDistributionMetadataDigest = "vnd.act3-ace.python.distribution.core-metadata.digest"

	// PythonDistributionVersion is the annotation key used for denoting the version of the distribution file (e.g., 1.2.3).
	PythonDistributionVersion = "vnd.act3-ace.python.distribution.version"

	// PythonDistributionRequiresPython is the annotation key used for denoting the requied python version to use the distribution file (e.g., >=3.7).
	PythonDistributionRequiresPython = "vnd.act3-ace.python.distribution.requires-python"

	// PythonDistributionProject is the annotation key used for denoting the project name of the distribution file (e.g., pyzmq).
	PythonDistributionProject = "vnd.act3-ace.python.distribution.project"

	// PythonDistributionYanked is the annotation key used for denoting that a distribution has been marked as yanked.  The value is the reason.  If this annotation is present with an empty value it means it is yanked but without a reason.
	PythonDistributionYanked = "vnd.act3-ace.python.distribution.yanked"

	// PythonSyncVersion is the annotation key used for denoting the sync software protocol/version used to create the manifest.
	PythonSyncVersion = "vnd.act3-ace.python.sync.version"
)
View Source
const (
	MediaTypePythonDistributionWheel   = "applications/vnd.act3-ace.python.bdist.wheel+zip"
	MediaTypePythonDistributionSource  = "applications/vnd.act3-ace.python.sdist.tar+gzip"
	MediaTypePythonDistributionEgg     = "applications/vnd.act3-ace.python.bdist.egg+zip"
	MediaTypePythonDistributionUnknown = "applications/vnd.act3-ace.python.unknown"

	MediaTypePythonSourceDistribution   = "applications/vnd.act3-ace.python.sdist.tar+gzip"
	MediaTypePythonDistributionMetadata = "application/vnd.act3-ace.python.core-metadata.v1"
	MediaTypePythonDistributionIndex    = "application/vnd.act3-ace.python.index.v1+json"
	MediaTypePythonDistribution         = "application/vnd.act3-ace.python.distribution.v1+json"
)

MediaTypes for python artifacts.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	*actions.DataTool

	// AllowYanked allows yanked packages to be mirrored
	AllowYanked bool
}

Action represents a general pypi action.

func (*Action) PyPIClient

func (action *Action) PyPIClient() (remote.Client, error)

PyPIClient create a http Client that pulls basic auth credentials from docker.

type App

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

App implements the HTML web application.

func NewApp

func NewApp(log *slog.Logger, repo registry.Repository, repoRef, userAgent, version string, allowYanked bool) (*App, error)

NewApp creates the web application used for serving the PyPI site (backed by OCI).

func (*App) Initialize

func (a *App) Initialize(handler httputil.Router)

Initialize the routes.

type Serve

type Serve struct {
	*Action

	Listen string
}

Serve is the action for starting the server.

func (*Serve) Run

func (action *Serve) Run(ctx context.Context, repository string) error

Run is the action method.

type ToOCI

type ToOCI struct {
	*Action

	// Selectors holds the python/abi/platform selectors
	Selectors []string

	// DryRun only figures what work it would do.  It does not make any changes to OCI.
	DryRun bool

	// Reproducible removes timestamps.
	Reproducible bool

	// Clean will copy everything over assuming there is no existing OCI artifacts.  When true, the prior files that were downloaded are ignored when constructing artifacts.
	Clean bool

	// IndexURL is the primary index URL
	IndexURL string

	// ExtraIndexURLs is a slice of extra index URLs to use to find packages.  These are processed after IndexURL.
	ExtraIndexURLs []string

	// RequirementFile is a slice of requirement files to sync
	RequirementFiles []string

	// Also include the extra packages from requirements
	IncludeExtras bool

	// Continue even if an error occurs in processing a Python project or distribution.
	// This is useful when combined with FailedRequirementsFile to collect the failures in a way that can be used to process the erroneous entries.
	ContinueOnError bool

	// FailedRequirementsPath is a file path to write the requirements that failed to be transferred
	FailedRequirementsFile string
}

ToOCI represents the pypi to-oci action.

func (*ToOCI) Run

func (action *ToOCI) Run(ctx context.Context, repository string, additionalRequirements ...string) error

Run performs the pypi to-oci operation.

type ToPyPI

type ToPyPI struct {
	*Action

	// DryRun prevents uploading distribution files to the package index
	DryRun bool
	// contains filtered or unexported fields
}

ToPyPI represents the pypi to-pypi action.

func (*ToPyPI) Run

func (action *ToPyPI) Run(ctx context.Context, ociRepo, pypi string) error

Run the action.

Jump to

Keyboard shortcuts

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