|
| | __init__ (self, search_path=None, platform=get_supported_platform(), python=PY_MAJOR) |
| |
| | can_add (self, dist) |
| |
| | remove (self, dist) |
| |
| | scan (self, search_path=None) |
| |
| | __getitem__ (self, project_name) |
| |
| | add (self, dist) |
| |
| | best_match (self, req, working_set, installer=None, replace_conflicting=False) |
| |
| | obtain (self, requirement, installer=None) |
| |
| | __iter__ (self) |
| |
| | __iadd__ (self, other) |
| |
| | __add__ (self, other) |
| |
Searchable snapshot of distributions on a search path
◆ __init__()
| pip._vendor.pkg_resources.Environment.__init__ |
( |
|
self, |
|
|
|
search_path = None, |
|
|
|
platform = get_supported_platform(), |
|
|
|
python = PY_MAJOR |
|
) |
| |
Snapshot distributions available on a search path
Any distributions found on `search_path` are added to the environment.
`search_path` should be a sequence of ``sys.path`` items. If not
supplied, ``sys.path`` is used.
`platform` is an optional string specifying the name of the platform
that platform-specific distributions must be compatible with. If
unspecified, it defaults to the current platform. `python` is an
optional string naming the desired version of Python (e.g. ``'3.6'``);
it defaults to the current version.
You may explicitly set `platform` (and/or `python`) to ``None`` if you
wish to map *all* distributions, not just those compatible with the
running platform or Python version.
◆ __add__()
| pip._vendor.pkg_resources.Environment.__add__ |
( |
|
self, |
|
|
|
other |
|
) |
| |
Add an environment or distribution to an environment
◆ __getitem__()
| pip._vendor.pkg_resources.Environment.__getitem__ |
( |
|
self, |
|
|
|
project_name |
|
) |
| |
Return a newest-to-oldest list of distributions for `project_name`
Uses case-insensitive `project_name` comparison, assuming all the
project's distributions use their project's name converted to all
lowercase as their key.
◆ __iadd__()
| pip._vendor.pkg_resources.Environment.__iadd__ |
( |
|
self, |
|
|
|
other |
|
) |
| |
In-place addition of a distribution or environment
◆ __iter__()
| pip._vendor.pkg_resources.Environment.__iter__ |
( |
|
self | ) |
|
Yield the unique project names of the available distributions
◆ add()
| pip._vendor.pkg_resources.Environment.add |
( |
|
self, |
|
|
|
dist |
|
) |
| |
Add `dist` if we ``can_add()`` it and it has not already been added
◆ best_match()
| pip._vendor.pkg_resources.Environment.best_match |
( |
|
self, |
|
|
|
req, |
|
|
|
working_set, |
|
|
|
installer = None, |
|
|
|
replace_conflicting = False |
|
) |
| |
Find distribution best matching `req` and usable on `working_set`
This calls the ``find(req)`` method of the `working_set` to see if a
suitable distribution is already active. (This may raise
``VersionConflict`` if an unsuitable version of the project is already
active in the specified `working_set`.) If a suitable distribution
isn't active, this method returns the newest distribution in the
environment that meets the ``Requirement`` in `req`. If no suitable
distribution is found, and `installer` is supplied, then the result of
calling the environment's ``obtain(req, installer)`` method will be
returned.
◆ can_add()
| pip._vendor.pkg_resources.Environment.can_add |
( |
|
self, |
|
|
|
dist |
|
) |
| |
Is distribution `dist` acceptable for this environment?
The distribution must match the platform and python version
requirements specified when this environment was created, or False
is returned.
◆ obtain()
| pip._vendor.pkg_resources.Environment.obtain |
( |
|
self, |
|
|
|
requirement, |
|
|
|
installer = None |
|
) |
| |
Obtain a distribution matching `requirement` (e.g. via download)
Obtain a distro that matches requirement (e.g. via download). In the
base ``Environment`` class, this routine just returns
``installer(requirement)``, unless `installer` is None, in which case
None is returned instead. This method is a hook that allows subclasses
to attempt other ways of obtaining a distribution before falling back
to the `installer` argument.
◆ remove()
| pip._vendor.pkg_resources.Environment.remove |
( |
|
self, |
|
|
|
dist |
|
) |
| |
Remove `dist` from the environment
◆ scan()
| pip._vendor.pkg_resources.Environment.scan |
( |
|
self, |
|
|
|
search_path = None |
|
) |
| |
Scan `search_path` for distributions usable in this environment
Any distributions found are added to the environment.
`search_path` should be a sequence of ``sys.path`` items. If not
supplied, ``sys.path`` is used. Only distributions conforming to
the platform/python version defined at initialization are added.
The documentation for this class was generated from the following file:
- docs/help/help-venv/lib/python3.12/site-packages/pip/_vendor/pkg_resources/__init__.py