Let us walk on the 3-isogeny graph
|
Data Fields | |
canonical_name | |
editable_project_location | |
installed_location | |
metadata | |
raw_name | |
Protected Member Functions | |
email.message.Message | _metadata_impl (self) |
email.message.Message | _metadata_cached (self) |
Optional[Iterator[str]] | _iter_declared_entries_from_record (self) |
Optional[Iterator[str]] | _iter_declared_entries_from_legacy (self) |
Iterator[RequiresEntry] | _iter_requires_txt_entries (self) |
Iterable[str] | _iter_egg_info_extras (self) |
Iterable[str] | _iter_egg_info_dependencies (self) |
None | _add_egg_info_requires (self, email.message.Message metadata) |
str __repr__ | ( | self | ) |
str __str__ | ( | self | ) |
|
protected |
Add egg-info requires.txt information to the metadata.
Definition at line 572 of file base.py.
References BaseDistribution._iter_egg_info_dependencies(), BaseDistribution._iter_egg_info_extras(), and i.
Referenced by BaseDistribution._metadata_cached().
|
protected |
Definition at line 474 of file base.py.
References pip._internal.metadata.base._convert_installed_files_path(), i, BaseDistribution.info_location(), WheelDistribution.info_location, Distribution.info_location(), _PackageInfo.location, InvalidWheel.location, BaseDistribution.location(), Wheel.location, FilesystemWheel.location, MemoryWheel.location, Distribution.location(), Distribution.location, LocationParseError.location, BaseDistribution.read_text(), Distribution.read_text(), and WheelDistribution.read_text().
Referenced by BaseDistribution.iter_declared_entries().
|
protected |
Definition at line 466 of file base.py.
References i, BaseDistribution.read_text(), Distribution.read_text(), and WheelDistribution.read_text().
Referenced by BaseDistribution.iter_declared_entries().
|
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.
Definition at line 545 of file base.py.
References BaseDistribution._iter_requires_txt_entries(), and i.
Referenced by BaseDistribution._add_egg_info_requires().
|
protected |
Get extras from the egg-info directory.
Definition at line 536 of file base.py.
References BaseDistribution._iter_requires_txt_entries(), and i.
Referenced by BaseDistribution._add_egg_info_requires().
|
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.
Definition at line 511 of file base.py.
References i, BaseDistribution.read_text(), Distribution.read_text(), and WheelDistribution.read_text().
Referenced by BaseDistribution._iter_egg_info_dependencies(), and BaseDistribution._iter_egg_info_extras().
|
protected |
Definition at line 390 of file base.py.
References BaseDistribution._add_egg_info_requires(), BaseDistribution._metadata_impl(), and Distribution._metadata_impl().
Referenced by BaseDistribution.metadata().
|
protected |
Reimplemented in Distribution, and Distribution.
Definition at line 386 of file base.py.
References i.
Referenced by BaseDistribution._metadata_cached().
NormalizedName canonical_name | ( | self | ) |
Reimplemented in Distribution, and Distribution.
Definition at line 279 of file base.py.
References i.
Referenced by BaseDistribution.raw_name().
Optional[DirectUrl] 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.
Definition at line 295 of file base.py.
References i, BaseDistribution.read_text(), Distribution.read_text(), and WheelDistribution.read_text().
Referenced by BaseDistribution.editable_project_location().
bool editable | ( | self | ) |
Definition at line 337 of file base.py.
Referenced by InstallRequirement.__repr__(), FrozenRequirement.__str__(), DirInfo._to_dict(), InstallRequirement.install(), InstallRequirement.isolated_editable_sanity_check(), InstallRequirement.prepare_metadata(), and InstallRequirement.update_editable().
Optional[str] 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.
Definition at line 169 of file base.py.
References BaseDistribution.direct_url(), i, _PackageInfo.location, InvalidWheel.location, BaseDistribution.location(), Wheel.location, FilesystemWheel.location, MemoryWheel.location, Distribution.location(), Distribution.location, LocationParseError.location, BaseDistribution.raw_name(), and BaseDistribution.raw_name.
"BaseDistribution" from_directory | ( | cls, | |
str | directory | ||
) |
Load the distribution from a metadata directory. :param directory: Path to a metadata directory, e.g. ``.dist-info``.
Reimplemented in Distribution, and Distribution.
Definition at line 109 of file base.py.
References i.
"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 Distribution, and Distribution.
Definition at line 117 of file base.py.
References i.
"BaseDistribution" from_wheel | ( | cls, | |
"Wheel" | wheel, | ||
str | name | ||
) |
Load the distribution from a given wheel. :param wheel: A concrete wheel definition. :param name: File name of the wheel. :raises InvalidWheel: Whenever loading of the wheel causes a :py:exc:`zipfile.BadZipFile` exception to be thrown. :raises UnsupportedWheel: If the wheel is a valid zip, but malformed internally.
Reimplemented in Distribution, and Distribution.
Definition at line 135 of file base.py.
References i.
bool in_site_packages | ( | self | ) |
Definition at line 357 of file base.py.
References i, BaseDistribution.installed_location(), BaseDistribution.installed_location, and Distribution.installed_location().
bool in_usersite | ( | self | ) |
Definition at line 351 of file base.py.
References i, BaseDistribution.installed_location(), BaseDistribution.installed_location, and Distribution.installed_location().
Optional[str] 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 Distribution, and Distribution.
Definition at line 204 of file base.py.
References i.
Referenced by BaseDistribution._iter_declared_entries_from_legacy(), BaseDistribution.installed_by_distutils(), BaseDistribution.installed_with_dist_info(), BaseDistribution.installed_with_setuptools_egg_info(), and WheelDistribution.read_text().
bool 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.
Definition at line 233 of file base.py.
References i, _PackageInfo.location, InvalidWheel.location, BaseDistribution.location(), Wheel.location, FilesystemWheel.location, MemoryWheel.location, Distribution.location(), Distribution.location, and LocationParseError.location.
bool 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 Distribution.
Definition at line 220 of file base.py.
References i, BaseDistribution.info_location(), WheelDistribution.info_location, Distribution.info_location(), and BaseDistribution.is_file().
Optional[str] 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).
Reimplemented in Distribution, and Distribution.
Definition at line 191 of file base.py.
References i.
Referenced by BaseDistribution.in_site_packages(), BaseDistribution.in_usersite(), and BaseDistribution.local().
bool 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).
Definition at line 263 of file base.py.
References i, BaseDistribution.info_location(), WheelDistribution.info_location, and Distribution.info_location().
bool 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``.
Definition at line 245 of file base.py.
References i, BaseDistribution.info_location(), WheelDistribution.info_location, and Distribution.info_location().
str installer | ( | self | ) |
Definition at line 321 of file base.py.
References i, BaseDistribution.read_text(), Distribution.read_text(), and WheelDistribution.read_text().
bool is_file | ( | self, | |
InfoPath | path | ||
) |
Check whether an entry in the info directory is a file.
Reimplemented in Distribution, and Distribution.
Definition at line 362 of file base.py.
References i.
Referenced by BaseDistribution.installed_by_distutils(), and BaseDistribution.requested().
Optional[Iterator[str]] 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``.
Definition at line 495 of file base.py.
References BaseDistribution._iter_declared_entries_from_legacy(), and BaseDistribution._iter_declared_entries_from_record().
Iterable[Requirement] iter_dependencies | ( | self, | |
Collection[str] | extras = () |
||
) |
Dependencies of this distribution. For modern .dist-info distributions, this is the collection of "Requires-Dist:" entries in distribution metadata.
Reimplemented in Distribution, and Distribution.
Definition at line 450 of file base.py.
References i.
Iterator[str] iter_distutils_script_names | ( | self | ) |
Find distutils 'scripts' entries metadata. If 'scripts' is supplied in ``setup.py``, distutils records those in the installed distribution's ``scripts`` directory, a file for each script.
Reimplemented in Distribution, and Distribution.
Definition at line 366 of file base.py.
References i.
Iterable[BaseEntryPoint] iter_entry_points | ( | self | ) |
Reimplemented in Distribution, and Distribution.
Definition at line 383 of file base.py.
References i.
Iterable[str] 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.
Reimplemented in Distribution, and Distribution.
Definition at line 458 of file base.py.
References i.
bool local | ( | self | ) |
If distribution is installed in the current virtual environment. Always True if we're not in a virtualenv.
Definition at line 341 of file base.py.
References BaseDistribution.installed_location(), BaseDistribution.installed_location, and Distribution.installed_location().
Optional[str] 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 Distribution, and Distribution.
Definition at line 155 of file base.py.
References i.
Referenced by BaseDistribution._iter_declared_entries_from_legacy(), Distribution._metadata_impl(), FilesystemWheel.as_zipfile(), BaseDistribution.editable_project_location(), BaseDistribution.installed_as_egg(), and Distribution.installed_location().
email.message.Message 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.
Definition at line 398 of file base.py.
References BaseDistribution._metadata_cached().
Referenced by Distribution._get_requirements(), InstallRequirement._set_requirement(), InstallRequirement.archive(), InstallRequirement.assert_source_matches_version(), Distribution.iter_dependencies(), Distribution.iter_provided_extras(), Distribution.matches_requirement(), BaseDistribution.metadata_version(), Distribution.provides(), BaseDistribution.raw_name(), BaseDistribution.requires_python(), Distribution.source_url(), and InstallRequirement.warn_on_mismatching_name().
Dict[str, Any] 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.
Definition at line 409 of file base.py.
Optional[str] metadata_version | ( | self | ) |
Value of "Metadata-Version:" in distribution metadata, if available.
Definition at line 420 of file base.py.
References BaseDistribution.metadata(), BaseDistribution.metadata, InstallRequirement.metadata(), Distribution.metadata, and Wheel.metadata().
Referenced by LegacyMetadata._remove_line_prefix(), and LegacyMetadata.write_file().
str raw_name | ( | self | ) |
Value of "Name:" in distribution metadata.
Definition at line 425 of file base.py.
References BaseDistribution.canonical_name(), BaseDistribution.canonical_name, Distribution.canonical_name(), FrozenRequirement.canonical_name, BaseDistribution.metadata(), BaseDistribution.metadata, InstallRequirement.metadata(), Distribution.metadata, and Wheel.metadata().
Referenced by BaseDistribution.editable_project_location(), Distribution.installed_location(), and BaseDistribution.setuptools_filename().
str read_text | ( | self, | |
InfoPath | path | ||
) |
Read a file in the info directory. :raise FileNotFoundError: If ``path`` does not exist in the directory. :raise NoneMetadataError: If ``path`` exists in the info directory, but cannot be read.
Reimplemented in Distribution, and Distribution.
Definition at line 374 of file base.py.
References i.
Referenced by BaseDistribution._iter_declared_entries_from_legacy(), BaseDistribution._iter_declared_entries_from_record(), BaseDistribution._iter_requires_txt_entries(), Distribution._metadata_impl(), BaseDistribution.direct_url(), and BaseDistribution.installer().
bool requested | ( | self | ) |
Definition at line 333 of file base.py.
References Link.is_file(), BaseDistribution.is_file(), and Distribution.is_file().
SpecifierSet 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.
Definition at line 432 of file base.py.
References BaseDistribution.metadata(), BaseDistribution.metadata, InstallRequirement.metadata(), Distribution.metadata, and Wheel.metadata().
Referenced by Link.__str__().
str setuptools_filename | ( | self | ) |
Convert a project name to its setuptools-compatible filename. This is a copy of ``pkg_resources.to_filename()`` for compatibility.
Definition at line 287 of file base.py.
References BaseDistribution.raw_name(), and BaseDistribution.raw_name.
DistributionVersion version | ( | self | ) |
Reimplemented in Distribution, and Distribution.
Definition at line 283 of file base.py.
References i.
Referenced by AlreadyInstalledCandidate.__eq__(), Distribution.__eq__(), Distribution.__hash__(), InstallationCandidate.__repr__(), Distribution.__repr__(), Metadata.__repr__(), InstallationCandidate.__str__(), InstalledDistribution.__str__(), EggInfoDistribution.__str__(), PlatformDirsABC._append_app_name_and_version(), WrappedSocket._custom_validate(), Wheel._get_extensions(), Wheel.build(), Wheel.filename(), InstalledDistribution.get_distinfo_file(), Wheel.get_wheel_metadata(), LinuxDistribution.info(), Wheel.install(), LinuxDistribution.linux_distribution(), Wheel.metadata(), LinuxDistribution.name(), Distribution.name_and_version(), Distribution.provides(), Metadata.provides(), Wheel.update(), Wheel.verify(), and LinuxDistribution.version_parts().
canonical_name |
Reimplemented in Distribution, and Distribution.
Definition at line 315 of file base.py.
Referenced by BaseDistribution.raw_name().
installed_location |
Reimplemented in Distribution, and Distribution.
Definition at line 348 of file base.py.
Referenced by BaseDistribution.in_site_packages(), BaseDistribution.in_usersite(), and BaseDistribution.local().
metadata |
Definition at line 417 of file base.py.
Referenced by Distribution._get_requirements(), InstallRequirement._set_requirement(), InstallRequirement.archive(), InstallRequirement.assert_source_matches_version(), Distribution.iter_dependencies(), Distribution.iter_provided_extras(), Distribution.matches_requirement(), BaseDistribution.metadata_version(), Distribution.provides(), BaseDistribution.raw_name(), BaseDistribution.requires_python(), Distribution.source_url(), and InstallRequirement.warn_on_mismatching_name().
raw_name |
Definition at line 446 of file base.py.
Referenced by BaseDistribution.editable_project_location(), Distribution.installed_location(), and BaseDistribution.setuptools_filename().