Welcome to conda-package-handling’s documentation!#
conda-package-handling is a library and command line utility used to handle
conda_package_handling.api to create and extract
conda packages. This package also provides the
cph command line tool to
extract, create, and convert between formats.
See also conda-package-streaming
A new major version#
As of version 2.x,
conda-package-handling provides a backwards-compatible
plus additional package creation functionality not found in
conda-package-handling always expects to read and
write to the filesystem. If you need a simpler API to extract or inspect conda
packages, check out
Version 2.x is approximately two times faster extracting
.conda packages, by
.tar.zst without first writing it to a
temporary file. It uses
python-zstandard and the
Python standard library instead of a custom
libarchive and so is easier to
build. Extraction does not
chdir to the output directory, and is thread-safe.
Version 2.x creates
.conda packages slightly differently as well.
info-archive comes after the
pkg-‘s ZIP metadata use a fixed timestamp, instead of the current time - can be seen with
python -m zipfile -l [filename].conda.
groupnameinstead of preserving these from the filesystem.
.tar.bz2are created by Python’s standard
No particular attention has been paid to archiving time which will be dominated
by the compression algorithm, but this also avoids using a temporary
There are two conda formats. The new conda format, described at .conda file
consists of an outer, uncompressed ZIP-format container, with 2 inner compressed
.tar files. It is designed to have much faster metadata access and utilize more
modern compression algorithms. The old conda format is a
The cph command line tool can transmute (convert) the old package format to the new one, and vice versa.
cph transmute mkl-2018.0.3-1.tar.bz2 .conda
The new package format is an indexed, uncompressed zip file that contains two Zstandard-compressed tarfiles. The info metadata about packages is separated into its own tarfile from the rest of the package contents. By doing this, we can extract only the metadata, for speeding up operations like indexing.
And, the Zstandard algorithm is much, much faster to decompress than bz2.
Package creation is primarily something that conda-build uses, as cph only packages but does not create metadata that makes a conda package useful.
cph create /path/to/some/dir my-cute-archive.conda
This would not necessarily create a valid conda package, unless the directory being archived contained all the metadata in an “info” directory that a standard conda package needs. The .conda file it creates, however, uses all the nice new compression formats, though, and you could use cph on some other computer to extract it.
Install this package and its test dependencies; run tests.
pip install -e ".[test]" pytest