Package extractors#

Package extractors handle the unpacking of different package archive formats. Each extractor specifies which file extensions it supports (e.g., .conda, .tar.bz2) and provides an extraction function.

This plugin hook allows adding support for new package formats without modifying conda's core code.

class CondaPackageExtractor#

Return type to use when defining a conda package extractor plugin hook.

Package extractors handle the extraction of different package archive formats. Each extractor specifies which file extensions it supports and provides an extraction function to unpack the archive.

For details on how this is used, see conda_package_extractors().

Parameters:
  • name -- Extractor name (e.g., conda-package, wheel-package).

  • extensions -- List of file extensions this extractor handles (e.g., [".conda", ".tar.bz2"] or [".whl"]).

  • extract -- Callable that extracts the package archive. Takes the source archive path and the destination directory where the package contents should be extracted.

extensions#
extract#
name#
conda_package_extractors()#

Register package extractors for different archive formats.

Package extractors handle the unpacking of package archives. Each extractor specifies which file extensions it supports (e.g., .conda, .tar.bz2) and provides an extraction function that takes the source archive path and destination directory.

Example:

from conda import plugins
from conda.common.path import PathType


def extract_custom(source_path: PathType, destination_directory: PathType) -> None:
    # Custom extraction logic for a hypothetical package format
    ...


@plugins.hookimpl
def conda_package_extractors():
    yield plugins.types.CondaPackageExtractor(
        name="custom-package",
        extensions=[".custom"],
        extract=extract_custom,
    )
Returns:

An iterable of CondaPackageExtractor entries.