Skip to content

Client#

AuthenticationMiddleware #

Middleware to handle authentication from keychain

__repr__ #

__repr__()

Returns a representation of the Middleware

Examples#
>>> from rattler.networking import Client
>>> middleware = AuthenticationMiddleware()
>>> middleware
AuthenticationMiddleware()
>>> Client([middleware])
Client()
>>>

Client #

A client that can be used to make requests.

__repr__ #

__repr__()

Returns a representation of the Client

Examples#
>>> Client()
Client()
>>>

authenticated_client staticmethod #

authenticated_client()

Returns an authenticated client.

Examples#
>>> Client.authenticated_client()
Client()
>>>

FetchRepoDataOptions dataclass #

bz2_enabled class-attribute instance-attribute #

bz2_enabled = True

Whether the BZ2 compression is enabled or not.

cache_action class-attribute instance-attribute #

cache_action = 'cache-or-fetch'

How to interact with the cache.

  • 'cache-or-fetch' (default): Use the cache if its up to date or fetch from the URL if there is no valid cached value.
  • 'use-cache-only': Only use the cache, but error out if the cache is not up to date
  • 'force-cache-only': Only use the cache, ignore whether or not it is up to date.
  • 'no-cache': Do not use the cache even if there is an up to date entry

jlap_enabled class-attribute instance-attribute #

jlap_enabled = True

Whether the JLAP compression is enabled or not.

variant class-attribute instance-attribute #

variant = 'after-patches'

Which type of repodata to download

  • 'after-patches' (default): Fetch the repodata.json file. This repodata.json has repodata patches applied.
  • 'from-packages' Fetch the repodata_from_packages.json file
  • 'current': Fetch current_repodata.json file. This file contains only the latest version of each package.

zstd_enabled class-attribute instance-attribute #

zstd_enabled = True

Whether the ZSTD compression is enabled or not.

GCSMiddleware #

Middleware to work with gcs:// URLs

Examples#

>>> from rattler.networking import Client
>>> middleware = GCSMiddleware()
>>> middleware
GCSMiddleware()
>>> Client([middleware])
Client()
>>>

MirrorMiddleware #

__init__ #

__init__(mirrors)

Create a new MirrorMiddleware instance. The mirrors argument should be a dictionary where the keys are the original mirror URLs and the values are lists of mirror URLs to replace the original mirror with.

Examples#
>>> from rattler.networking import Client
>>> middleware = MirrorMiddleware({"https://conda.anaconda.org/conda-forge": ["https://repo.prefix.dev/conda-forge"]})
>>> middleware
MirrorMiddleware()
>>> Client([middleware])
Client()
>>>

__repr__ #

__repr__()

Returns a representation of the Middleware

Examples#
>>> middleware = MirrorMiddleware({"https://conda.anaconda.org/conda-forge": ["https://repo.prefix.dev/conda-forge"]})
>>> middleware
MirrorMiddleware()
>>>

S3Middleware #

Middleware to work with s3:// URLs

Examples#

>>> from rattler.networking import Client
>>> middleware = S3Middleware()
>>> middleware
S3Middleware()
>>> Client([middleware])
Client()
>>>

FetchRepoDataOptions dataclass #

bz2_enabled class-attribute instance-attribute #

bz2_enabled = True

Whether the BZ2 compression is enabled or not.

cache_action class-attribute instance-attribute #

cache_action = 'cache-or-fetch'

How to interact with the cache.

  • 'cache-or-fetch' (default): Use the cache if its up to date or fetch from the URL if there is no valid cached value.
  • 'use-cache-only': Only use the cache, but error out if the cache is not up to date
  • 'force-cache-only': Only use the cache, ignore whether or not it is up to date.
  • 'no-cache': Do not use the cache even if there is an up to date entry

jlap_enabled class-attribute instance-attribute #

jlap_enabled = True

Whether the JLAP compression is enabled or not.

variant class-attribute instance-attribute #

variant = 'after-patches'

Which type of repodata to download

  • 'after-patches' (default): Fetch the repodata.json file. This repodata.json has repodata patches applied.
  • 'from-packages' Fetch the repodata_from_packages.json file
  • 'current': Fetch current_repodata.json file. This file contains only the latest version of each package.

zstd_enabled class-attribute instance-attribute #

zstd_enabled = True

Whether the ZSTD compression is enabled or not.

fetch_repo_data async #

fetch_repo_data(
    *,
    channels,
    platforms,
    cache_path,
    callback,
    client=None,
    fetch_options=None,
)

Returns a list of RepoData for given channels and platform.

Parameters:

Name Type Description Default
channels List[Channel]

A list of Channels to fetch repo data.

required
platforms List[Platform]

A list of Platforms for which the repo data should be fetched.

required
cache_path Union[str, PathLike[str]]

A os.PathLike[str] where the repo data should be downloaded.

required
callback Optional[Callable[[int, int], None]]

A Callable[[int, int], None] to report the download progress of repo data.

required
client Optional[Client]

A Client to use for fetching the repo data.

None

Returns:

Type Description
List[SparseRepoData]

A list of SparseRepoData for requested channels and platforms.