:py:mod:`index` =============== .. py:module:: conda.core.index .. autoapi-nested-parse:: Tools for fetching the current index. Functions --------- .. autoapisummary:: conda.core.index.check_allowlist conda.core.index.get_index conda.core.index.fetch_index conda.core.index.dist_str_in_index conda.core.index._supplement_index_with_prefix conda.core.index._supplement_index_with_cache conda.core.index._make_virtual_package conda.core.index._supplement_index_with_features conda.core.index._supplement_index_with_system conda.core.index.get_archspec_name conda.core.index.calculate_channel_urls conda.core.index.get_reduced_index Attributes ---------- .. autoapisummary:: conda.core.index.LAST_CHANNEL_URLS .. py:function:: check_allowlist(channel_urls: list[str]) -> None Check if the given channel URLs are allowed by the context's allowlist. :param channel_urls: A list of channel URLs to check against the allowlist. :raises ChannelNotAllowed: If any URL is not in the allowlist. .. py:data:: LAST_CHANNEL_URLS :value: [] .. py:function:: 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. :param channel_urls: Channels to include in the index. :param prepend: If False, only the channels passed in are used. :param platform: Target platform for the index. :param use_local: Whether to use local channels. :param use_cache: Whether to use cached index information. :param unknown: Include unknown packages. :param prefix: Path to environment prefix to include in the index. :param repodata_fn: Filename of the repodata file. :return: A dictionary representing the package index. .. py:function:: 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. :param channel_urls: A list of channel URLs to fetch the index from. :param use_cache: Whether to use the cached index data. :param index: An optional pre-existing index to update. :param repodata_fn: The name of the repodata file. :return: A dictionary representing the fetched or updated package index. .. py:function:: dist_str_in_index(index: dict[Any, Any], dist_str: str) -> bool Check if a distribution string matches any package in the index. :param index: The package index. :param dist_str: The distribution string to match against the index. :return: True if there is a match; False otherwise. .. py:function:: _supplement_index_with_prefix(index: dict[Any, Any], prefix: str) -> None Supplement the given index with information from the specified environment prefix. :param index: The package index to supplement. :param prefix: The path to the environment prefix. .. py:function:: _supplement_index_with_cache(index: dict[Any, Any]) -> None Supplement the given index with packages from the cache. :param index: The package index to supplement. .. py:function:: _make_virtual_package(name: str, version: str | None = None, build_string: str | None = None) -> conda.models.records.PackageRecord Create a virtual package record. :param name: The name of the virtual package. :param version: The version of the virtual package, defaults to "0". :param build_string: The build string of the virtual package, defaults to "0". :return: A PackageRecord representing the virtual package. .. py:function:: _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. :param index: The package index to supplement. :param features: A list of feature names to add to the index. .. py:function:: _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. :param index: The package index to supplement. .. py:function:: get_archspec_name() -> str | None Determine the architecture specification name for the current environment. :return: The architecture name if available, otherwise None. .. py:function:: 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. :param channel_urls: Initial list of channel URLs. :param prepend: Whether to prepend default channels to the list. :param platform: The target platform for the channels. :param use_local: Whether to include the local channel. :return: The calculated list of channel URLs. .. py:function:: 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. :param prefix: Path to an environment prefix to include installed packages. :param channels: A list of channel names to include in the index. :param subdirs: A list of subdirectories to consider for each channel. :param specs: A list of MatchSpec objects to filter the packages. :param repodata_fn: Filename of the repodata file to use. :return: A dictionary representing the reduced package index.