|
| "BaseDistribution" | from_directory (cls, str directory) |
| |
| "BaseDistribution" | from_metadata_file_contents (cls, bytes metadata_contents, str filename, str project_name) |
| |
| "BaseDistribution" | from_wheel (cls, "Wheel" wheel, str name) |
| |
|
str | __repr__ (self) |
| |
|
str | __str__ (self) |
| |
| Optional[str] | location (self) |
| |
| Optional[str] | editable_project_location (self) |
| |
| Optional[str] | installed_location (self) |
| |
| Optional[str] | info_location (self) |
| |
| bool | installed_by_distutils (self) |
| |
| bool | installed_as_egg (self) |
| |
| bool | installed_with_setuptools_egg_info (self) |
| |
| bool | installed_with_dist_info (self) |
| |
|
NormalizedName | canonical_name (self) |
| |
|
DistributionVersion | version (self) |
| |
| str | setuptools_filename (self) |
| |
| Optional[DirectUrl] | direct_url (self) |
| |
|
str | installer (self) |
| |
|
bool | requested (self) |
| |
|
bool | editable (self) |
| |
| bool | local (self) |
| |
|
bool | in_usersite (self) |
| |
|
bool | in_site_packages (self) |
| |
| bool | is_file (self, InfoPath path) |
| |
| Iterator[str] | iter_distutils_script_names (self) |
| |
| str | read_text (self, InfoPath path) |
| |
|
Iterable[BaseEntryPoint] | iter_entry_points (self) |
| |
| email.message.Message | metadata (self) |
| |
| Dict[str, Any] | metadata_dict (self) |
| |
| Optional[str] | metadata_version (self) |
| |
| str | raw_name (self) |
| |
| SpecifierSet | requires_python (self) |
| |
| Iterable[Requirement] | iter_dependencies (self, Collection[str] extras=()) |
| |
| Iterable[str] | iter_provided_extras (self) |
| |
| bool | is_extra_provided (self, str extra) |
| |
| Optional[Iterator[str]] | iter_declared_entries (self) |
| |
|
|
| canonical_name |
| |
|
| editable_project_location |
| |
|
| installed_location |
| |
|
| metadata |
| |
|
| raw_name |
| |
◆ _add_egg_info_requires()
| None pip._internal.metadata.base.BaseDistribution._add_egg_info_requires |
( |
|
self, |
|
|
email.message.Message |
metadata |
|
) |
| |
|
protected |
Add egg-info requires.txt information to the metadata.
◆ _iter_egg_info_dependencies()
| Iterable[str] pip._internal.metadata.base.BaseDistribution._iter_egg_info_dependencies |
( |
|
self | ) |
|
|
protected |
Get distribution dependencies from the egg-info directory.
To ease parsing, this converts a legacy dependency entry into a PEP 508
requirement string. Like ``_iter_requires_txt_entries()``, there is code
in ``importlib.metadata`` that does mostly the same, but not do exactly
what we need.
Namely, ``importlib.metadata`` does not normalize the extra name before
putting it into the requirement string, which causes marker comparison
to fail because the dist-info format do normalize. This is consistent in
all currently available PEP 517 backends, although not standardized.
◆ _iter_egg_info_extras()
| Iterable[str] pip._internal.metadata.base.BaseDistribution._iter_egg_info_extras |
( |
|
self | ) |
|
|
protected |
Get extras from the egg-info directory.
◆ _iter_requires_txt_entries()
| Iterator[RequiresEntry] pip._internal.metadata.base.BaseDistribution._iter_requires_txt_entries |
( |
|
self | ) |
|
|
protected |
Parse a ``requires.txt`` in an egg-info directory.
This is an INI-ish format where an egg-info stores dependencies. A
section name describes extra other environment markers, while each entry
is an arbitrary string (not a key-value pair) representing a dependency
as a requirement string (no markers).
There is a construct in ``importlib.metadata`` called ``Sectioned`` that
does mostly the same, but the format is currently considered private.
◆ _metadata_impl()
| email.message.Message pip._internal.metadata.base.BaseDistribution._metadata_impl |
( |
|
self | ) |
|
|
protected |
◆ direct_url()
| Optional[DirectUrl] pip._internal.metadata.base.BaseDistribution.direct_url |
( |
|
self | ) |
|
Obtain a DirectUrl from this distribution.
Returns None if the distribution has no `direct_url.json` metadata,
or if `direct_url.json` is invalid.
◆ editable_project_location()
| Optional[str] pip._internal.metadata.base.BaseDistribution.editable_project_location |
( |
|
self | ) |
|
The project location for editable distributions.
This is the directory where pyproject.toml or setup.py is located.
None if the distribution is not installed in editable mode.
◆ from_directory()
| "BaseDistribution" pip._internal.metadata.base.BaseDistribution.from_directory |
( |
|
cls, |
|
|
str |
directory |
|
) |
| |
◆ from_metadata_file_contents()
| "BaseDistribution" pip._internal.metadata.base.BaseDistribution.from_metadata_file_contents |
( |
|
cls, |
|
|
bytes |
metadata_contents, |
|
|
str |
filename, |
|
|
str |
project_name |
|
) |
| |
Load the distribution from the contents of a METADATA file.
This is used to implement PEP 658 by generating a "shallow" dist object that can
be used for resolution without downloading or building the actual dist yet.
:param metadata_contents: The contents of a METADATA file.
:param filename: File name for the dist with this metadata.
:param project_name: Name of the project this dist represents.
Reimplemented in pip._internal.metadata.importlib._dists.Distribution, and pip._internal.metadata.pkg_resources.Distribution.
◆ from_wheel()
| "BaseDistribution" pip._internal.metadata.base.BaseDistribution.from_wheel |
( |
|
cls, |
|
|
"Wheel" |
wheel, |
|
|
str |
name |
|
) |
| |
◆ info_location()
| Optional[str] pip._internal.metadata.base.BaseDistribution.info_location |
( |
|
self | ) |
|
Location of the .[egg|dist]-info directory or file.
Similarly to ``location``, a string value is not necessarily a
filesystem path. ``None`` means the distribution is created in-memory.
For a modern .dist-info installation on disk, this should be something
like ``{location}/{raw_name}-{version}.dist-info``.
Do not canonicalize this value with e.g. ``pathlib.Path.resolve()``. If
this is a symbolic link, we want to preserve the relative path between
it and other files in the distribution.
Reimplemented in pip._internal.metadata.importlib._dists.Distribution, and pip._internal.metadata.pkg_resources.Distribution.
◆ installed_as_egg()
| bool pip._internal.metadata.base.BaseDistribution.installed_as_egg |
( |
|
self | ) |
|
Whether this distribution is installed as an egg.
This usually indicates the distribution was installed by (older versions
of) easy_install.
◆ installed_by_distutils()
| bool pip._internal.metadata.base.BaseDistribution.installed_by_distutils |
( |
|
self | ) |
|
Whether this distribution is installed with legacy distutils format.
A distribution installed with "raw" distutils not patched by setuptools
uses one single file at ``info_location`` to store metadata. We need to
treat this specially on uninstallation.
Reimplemented in pip._internal.metadata.pkg_resources.Distribution.
◆ installed_location()
| Optional[str] pip._internal.metadata.base.BaseDistribution.installed_location |
( |
|
self | ) |
|
The distribution's "installed" location.
This should generally be a ``site-packages`` directory. This is
usually ``dist.location``, except for legacy develop-installed packages,
where ``dist.location`` is the source code location, and this is where
the ``.egg-link`` file is.
The returned location is normalized (in particular, with symlinks removed).
◆ installed_with_dist_info()
| bool pip._internal.metadata.base.BaseDistribution.installed_with_dist_info |
( |
|
self | ) |
|
Whether this distribution is installed with the "modern format".
This indicates a "modern" installation, e.g. storing metadata in the
``.dist-info`` directory. This applies to installations made by
setuptools (but through pip, not directly), or anything using the
standardized build backend interface (PEP 517).
◆ installed_with_setuptools_egg_info()
| bool pip._internal.metadata.base.BaseDistribution.installed_with_setuptools_egg_info |
( |
|
self | ) |
|
Whether this distribution is installed with the ``.egg-info`` format.
This usually indicates the distribution was installed with setuptools
with an old pip version or with ``single-version-externally-managed``.
Note that this ensure the metadata store is a directory. distutils can
also installs an ``.egg-info``, but as a file, not a directory. This
property is *False* for that case. Also see ``installed_by_distutils``.
◆ is_extra_provided()
| bool pip._internal.metadata.base.BaseDistribution.is_extra_provided |
( |
|
self, |
|
|
str |
extra |
|
) |
| |
◆ is_file()
| bool pip._internal.metadata.base.BaseDistribution.is_file |
( |
|
self, |
|
|
InfoPath |
path |
|
) |
| |
◆ iter_declared_entries()
| Optional[Iterator[str]] pip._internal.metadata.base.BaseDistribution.iter_declared_entries |
( |
|
self | ) |
|
Iterate through file entries declared in this distribution.
For modern .dist-info distributions, this is the files listed in the
``RECORD`` metadata file. For legacy setuptools distributions, this
comes from ``installed-files.txt``, with entries normalized to be
compatible with the format used by ``RECORD``.
:return: An iterator for listed entries, or None if the distribution
contains neither ``RECORD`` nor ``installed-files.txt``.
◆ iter_dependencies()
| Iterable[Requirement] pip._internal.metadata.base.BaseDistribution.iter_dependencies |
( |
|
self, |
|
|
Collection[str] |
extras = () |
|
) |
| |
◆ iter_distutils_script_names()
| Iterator[str] pip._internal.metadata.base.BaseDistribution.iter_distutils_script_names |
( |
|
self | ) |
|
◆ iter_provided_extras()
| Iterable[str] pip._internal.metadata.base.BaseDistribution.iter_provided_extras |
( |
|
self | ) |
|
Extras provided by this distribution.
For modern .dist-info distributions, this is the collection of
"Provides-Extra:" entries in distribution metadata.
The return value of this function is not particularly useful other than
display purposes due to backward compatibility issues and the extra
names being poorly normalized prior to PEP 685. If you want to perform
logic operations on extras, use :func:`is_extra_provided` instead.
Reimplemented in pip._internal.metadata.importlib._dists.Distribution, and pip._internal.metadata.pkg_resources.Distribution.
◆ local()
| bool pip._internal.metadata.base.BaseDistribution.local |
( |
|
self | ) |
|
If distribution is installed in the current virtual environment.
Always True if we're not in a virtualenv.
◆ location()
| Optional[str] pip._internal.metadata.base.BaseDistribution.location |
( |
|
self | ) |
|
Where the distribution is loaded from.
A string value is not necessarily a filesystem path, since distributions
can be loaded from other sources, e.g. arbitrary zip archives. ``None``
means the distribution is created in-memory.
Do not canonicalize this value with e.g. ``pathlib.Path.resolve()``. If
this is a symbolic link, we want to preserve the relative path between
it and files in the distribution.
Reimplemented in pip._internal.metadata.importlib._dists.Distribution, and pip._internal.metadata.pkg_resources.Distribution.
◆ metadata()
| email.message.Message pip._internal.metadata.base.BaseDistribution.metadata |
( |
|
self | ) |
|
Metadata of distribution parsed from e.g. METADATA or PKG-INFO.
This should return an empty message if the metadata file is unavailable.
:raises NoneMetadataError: If the metadata file is available, but does
not contain valid metadata.
◆ metadata_dict()
| Dict[str, Any] pip._internal.metadata.base.BaseDistribution.metadata_dict |
( |
|
self | ) |
|
PEP 566 compliant JSON-serializable representation of METADATA or PKG-INFO.
This should return an empty dict if the metadata file is unavailable.
:raises NoneMetadataError: If the metadata file is available, but does
not contain valid metadata.
◆ metadata_version()
| Optional[str] pip._internal.metadata.base.BaseDistribution.metadata_version |
( |
|
self | ) |
|
Value of "Metadata-Version:" in distribution metadata, if available.
◆ raw_name()
| str pip._internal.metadata.base.BaseDistribution.raw_name |
( |
|
self | ) |
|
Value of "Name:" in distribution metadata.
◆ read_text()
| str pip._internal.metadata.base.BaseDistribution.read_text |
( |
|
self, |
|
|
InfoPath |
path |
|
) |
| |
◆ requires_python()
| SpecifierSet pip._internal.metadata.base.BaseDistribution.requires_python |
( |
|
self | ) |
|
Value of "Requires-Python:" in distribution metadata.
If the key does not exist or contains an invalid value, an empty
SpecifierSet should be returned.
◆ setuptools_filename()
| str pip._internal.metadata.base.BaseDistribution.setuptools_filename |
( |
|
self | ) |
|
Convert a project name to its setuptools-compatible filename.
This is a copy of ``pkg_resources.to_filename()`` for compatibility.
The documentation for this class was generated from the following file:
- docs/help/help-venv/lib/python3.12/site-packages/pip/_internal/metadata/base.py