index
#
Tools for fetching the current index.
Functions#
|
Check if the given channel URLs are allowed by the context's allowlist. |
|
Return the index of packages available on the channels |
|
Fetch the package index from the specified channels. |
|
Check if a distribution string matches any package in the index. |
|
Supplement the given index with information from the specified environment prefix. |
|
Supplement the given index with packages from the cache. |
|
Create a virtual package record. |
|
Supplement the given index with virtual feature records. |
|
Loads and populates virtual package records from conda plugins |
|
Determine the architecture specification name for the current environment. |
|
Calculate the full list of channel URLs to use based on the given parameters. |
|
Generate a reduced package index based on the given specifications. |
Attributes#
- check_allowlist(channel_urls: list[str]) None #
Check if the given channel URLs are allowed by the context's allowlist.
- Parameters:
channel_urls -- A list of channel URLs to check against the allowlist.
- Raises:
ChannelNotAllowed -- If any URL is not in the allowlist.
- LAST_CHANNEL_URLS = []#
- get_index(channel_urls: tuple[str] = (), prepend: bool = True, platform: str | None = None, use_local: bool = False, use_cache: bool = False, unknown: bool | None = None, prefix: str | None = None, repodata_fn: str = context.repodata_fns[-1]) dict #
Return the index of packages available on the channels
If prepend=False, only the channels passed in as arguments are used. If platform=None, then the current platform is used. If prefix is supplied, then the packages installed in that prefix are added.
- Parameters:
channel_urls -- Channels to include in the index.
prepend -- If False, only the channels passed in are used.
platform -- Target platform for the index.
use_local -- Whether to use local channels.
use_cache -- Whether to use cached index information.
unknown -- Include unknown packages.
prefix -- Path to environment prefix to include in the index.
repodata_fn -- Filename of the repodata file.
- Returns:
A dictionary representing the package index.
- fetch_index(channel_urls: list[str], use_cache: bool = False, index: dict | None = None, repodata_fn: str = context.repodata_fns[-1]) dict #
Fetch the package index from the specified channels.
- Parameters:
channel_urls -- A list of channel URLs to fetch the index from.
use_cache -- Whether to use the cached index data.
index -- An optional pre-existing index to update.
repodata_fn -- The name of the repodata file.
- Returns:
A dictionary representing the fetched or updated package index.
- dist_str_in_index(index: dict[Any, Any], dist_str: str) bool #
Check if a distribution string matches any package in the index.
- Parameters:
index -- The package index.
dist_str -- The distribution string to match against the index.
- Returns:
True if there is a match; False otherwise.
- _supplement_index_with_prefix(index: dict[Any, Any], prefix: str) None #
Supplement the given index with information from the specified environment prefix.
- Parameters:
index -- The package index to supplement.
prefix -- The path to the environment prefix.
- _supplement_index_with_cache(index: dict[Any, Any]) None #
Supplement the given index with packages from the cache.
- Parameters:
index -- The package index to supplement.
- _make_virtual_package(name: str, version: str | None = None, build_string: str | None = None) conda.models.records.PackageRecord #
Create a virtual package record.
- Parameters:
name -- The name of the virtual package.
version -- The version of the virtual package, defaults to "0".
build_string -- The build string of the virtual package, defaults to "0".
- Returns:
A PackageRecord representing the virtual package.
- _supplement_index_with_features(index: dict[conda.models.records.PackageRecord, conda.models.records.PackageRecord], features: list[str] = []) None #
Supplement the given index with virtual feature records.
- Parameters:
index -- The package index to supplement.
features -- A list of feature names to add to the index.
- _supplement_index_with_system(index: dict[conda.models.records.PackageRecord, conda.models.records.PackageRecord]) None #
Loads and populates virtual package records from conda plugins and adds them to the provided index, unless there is a naming conflict.
- Parameters:
index -- The package index to supplement.
- get_archspec_name() str | None #
Determine the architecture specification name for the current environment.
- Returns:
The architecture name if available, otherwise None.
- calculate_channel_urls(channel_urls: tuple[str] = (), prepend: bool = True, platform: str | None = None, use_local: bool = False) list[str] #
Calculate the full list of channel URLs to use based on the given parameters.
- Parameters:
channel_urls -- Initial list of channel URLs.
prepend -- Whether to prepend default channels to the list.
platform -- The target platform for the channels.
use_local -- Whether to include the local channel.
- Returns:
The calculated list of channel URLs.
- get_reduced_index(prefix: str | None, channels: list[str], subdirs: list[str], specs: list[conda.models.match_spec.MatchSpec], repodata_fn: str) dict #
Generate a reduced package index based on the given specifications.
This function is useful for optimizing the solver by reducing the amount of data it needs to consider.
- Parameters:
prefix -- Path to an environment prefix to include installed packages.
channels -- A list of channel names to include in the index.
subdirs -- A list of subdirectories to consider for each channel.
specs -- A list of MatchSpec objects to filter the packages.
repodata_fn -- Filename of the repodata file to use.
- Returns:
A dictionary representing the reduced package index.