channel#
Defines Channel and MultiChannel objects and other channel-related functions.
Object inheritance:

Classes#
This metaclass does basic caching and enables static constructor method usage with a |
|
Channel: |
|
Channel: |
Functions#
|
|
|
|
|
|
|
|
|
|
|
Make a dictionary of channel priorities. |
|
|
|
|
|
Return current channels as Channel objects |
- class ChannelType#
Bases:
typeThis metaclass does basic caching and enables static constructor method usage with a single arg.
- __call__(*args, **kwargs)#
Call self as a function.
- class Channel(scheme: str | None = None, auth: str | None = None, location: str | None = None, token: str | None = None, name: str | None = None, platform: str | None = None, package_filename: str | None = None)#
Channel: scheme <> auth <> location <> token <> channel <> subchannel <> platform <> package_filename
Package Spec: channel <> subchannel <> namespace <> package_name
- _cache_#
- static from_value(value: str | None) Channel#
Construct a new
Channelfrom a single value.- Parameters:
value --
Anyone of the following forms:
- None, or one of the special strings "<unknown>", "None:///<unknown>", or "None":
represents the unknown channel, used for packages with unknown origin.
- A URL including a scheme like
file://orhttps://: represents a channel URL.
- A local directory path:
represents a local channel; relative paths must start with
./.- A package file (i.e. the path to a file ending in
.condaor.tar.bz2): represents a channel for a single package
- A known channel name:
represents a known channel, e.g. from the users
.condarcfile or the global configuration.
- Returns:
A channel object.
- static make_simple_channel(channel_alias: Channel, channel_url: str, name: str | None = None) Channel#
- urls(with_credentials: bool = False, subdirs: collections.abc.Iterable[str] | None = None) list[str]#
Generate URLs for this channel across specified platforms.
- Parameters:
with_credentials -- If True, include authentication credentials (token, auth) in URLs.
subdirs -- Specific platform subdirs to generate URLs for. If None, uses the channel's platform (if defined) or falls back to context.subdirs. If this is explicitly provided, overrides any platform defined in the channel.
Examples
>>> channel = Channel("conda-forge") >>> channel.urls() # Uses context.subdirs ['https://conda.anaconda.org/conda-forge/linux-64', 'https://conda.anaconda.org/conda-forge/noarch']
>>> channel = Channel("conda-forge/linux-aarch64") >>> channel.urls() # Uses channel's platform ['https://conda.anaconda.org/conda-forge/linux-aarch64', 'https://conda.anaconda.org/conda-forge/noarch']
>>> channel.urls(subdirs=("osx-64", "noarch")) ['https://conda.anaconda.org/conda-forge/osx-64', 'https://conda.anaconda.org/conda-forge/noarch']
- class MultiChannel(name: str, channels: collections.abc.Iterable[Channel], platform: str | None = None)#
Bases:
ChannelChannel: scheme <> auth <> location <> token <> channel <> subchannel <> platform <> package_filename
Package Spec: channel <> subchannel <> namespace <> package_name
- urls(with_credentials: bool = False, subdirs: collections.abc.Iterable[str] | None = None) list[str]#
Generate URLs for this channel across specified platforms.
- Parameters:
with_credentials -- If True, include authentication credentials (token, auth) in URLs.
subdirs -- Specific platform subdirs to generate URLs for. If None, uses the channel's platform (if defined) or falls back to context.subdirs. If this is explicitly provided, overrides any platform defined in the channel.
Examples
>>> channel = Channel("conda-forge") >>> channel.urls() # Uses context.subdirs ['https://conda.anaconda.org/conda-forge/linux-64', 'https://conda.anaconda.org/conda-forge/noarch']
>>> channel = Channel("conda-forge/linux-aarch64") >>> channel.urls() # Uses channel's platform ['https://conda.anaconda.org/conda-forge/linux-aarch64', 'https://conda.anaconda.org/conda-forge/noarch']
>>> channel.urls(subdirs=("osx-64", "noarch")) ['https://conda.anaconda.org/conda-forge/osx-64', 'https://conda.anaconda.org/conda-forge/noarch']
- tokenized_startswith(test_iterable: collections.abc.Iterable[Any], startswith_iterable: collections.abc.Iterable[Any]) bool#
- tokenized_conda_url_startswith(test_url: collections.abc.Iterable[str], startswith_url: collections.abc.Iterable[str]) bool#
- _read_channel_configuration(scheme: str | None, host: str | None, port: str | None, path: str | None) tuple[str | None, str | None, str | None, str | None, str | None]#
- prioritize_channels(channels: collections.abc.Iterable[Channel | str], with_credentials: bool = True, subdirs: collections.abc.Iterable[str] | None = None) dict[str, tuple[str, int]]#
Make a dictionary of channel priorities.
Maps channel names to priorities, e.g.:
>>> prioritize_channels(["conda-canary", "defaults", "conda-forge"]) { 'https://conda.anaconda.org/conda-canary/osx-arm64': ('conda-canary', 0), 'https://conda.anaconda.org/conda-canary/noarch': ('conda-canary', 0), 'https://repo.anaconda.com/pkgs/main/osx-arm64': ('defaults', 1), 'https://repo.anaconda.com/pkgs/main/noarch': ('defaults', 1), 'https://repo.anaconda.com/pkgs/r/osx-arm64': ('defaults', 2), 'https://repo.anaconda.com/pkgs/r/noarch': ('defaults', 2), 'https://conda.anaconda.org/conda-forge/osx-arm64': ('conda-forge', 3), 'https://conda.anaconda.org/conda-forge/noarch': ('conda-forge', 3), }
Compare with
conda.resolve.Resolve._make_channel_priorities.
- all_channel_urls(channels: collections.abc.Iterable[str | Channel], subdirs: collections.abc.Iterable[str] | None = None, with_credentials: bool = True) boltons.setutils.IndexedSet#
- get_channel_objs(ctx: conda.base.context.Context) tuple[Channel, Ellipsis]#
Return current channels as Channel objects