NotFoundDistribution

class NotFoundDistribution[source]

Distribution of package which couldn’t be found.

This class is used not to repeat the try-except pattern over and over again. If a package isn’t found an instance of this class is returned by get_distribution() and the parts of the API which are used by verbose_version_info are kept intact for the way they are used.

See also

get_distribution

Attributes Summary

entry_points

files

List of files in this distribution.

metadata

Return the parsed metadata for this Distribution.

name

Return the 'Name' metadata for the distribution package.

requires

List of generated requirements specified for this Distribution.

version

User set string if no version was found.

Methods Summary

at

Return a Distribution for the indicated metadata path

discover

Return an iterable of Distribution objects for all packages.

from_name

Return the Distribution for the given package name.

locate_file

Given a path to a file in this distribution, return a path to it.

read_text

Attempt to load metadata file given by the name.

Methods Documentation

static at(path)

Return a Distribution for the indicated metadata path

Parameters:

path – a string or path-like object

Returns:

a concrete Distribution instance for the path

classmethod discover(**kwargs)

Return an iterable of Distribution objects for all packages.

Pass a context or pass keyword arguments for constructing a context.

Context:

A DistributionFinder.Context object.

Returns:

Iterable of Distribution objects for all packages.

classmethod from_name(name)

Return the Distribution for the given package name.

Parameters:

name – The name of the distribution package to search for.

Returns:

The Distribution instance (or subclass thereof) for the named package, if found.

Raises:

PackageNotFoundError – When the named package’s distribution metadata cannot be found.

locate_file(path: PathLike | str) PathLike[source]

Given a path to a file in this distribution, return a path to it.

Just added to satisfy mypy, since the superclass one is an abstractmethod.

Parameters:

path (PathLike | str) – Path to a file.

Returns:

Just the initial path ensure to be type PathLike.

Return type:

PathLike

read_text(filename: str) None[source]

Attempt to load metadata file given by the name.

Just added to satisfy mypy, since the superclass one is an abstractmethod.

Parameters:

filename (str) – Name of a file in the distribution

Return type:

None