Welcome to conda-package-handling’s documentation!¶
conda-package-handling is a library and command line utility used to handle
.conda and .tar.bz2 conda
packages.
conda and conda-build use 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
wrapper around
conda-package-streaming,
plus additional package creation functionality not found in
conda-package-streaming. 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
conda-package-streaming.
Version 2.x is approximately two times faster extracting .conda packages, by
extracting .conda’s embedded .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.
.conda’sinfo-archive comes after thepkg-archive.Inside
.conda, theinfo-andpkg-‘s ZIP metadata use a fixed timestamp, instead of the current time - can be seen withpython -m zipfile -l [filename].conda..conda’s embedded.tar.zststripuid/gid/username/groupnameinstead of preserving these from the filesystem.Both
.condaand.tar.bz2are created by Python’s standardzipfileandtarfileinstead oflibarchive.
No particular attention has been paid to archiving time which will be dominated
by the compression algorithm, but this also avoids using a temporary .tar.zst.
Overview¶
There are two conda formats. The new conda format, described at .conda file
format,
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 .tar.bz2 archive.
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.
Development¶
Install this package and its test dependencies; run tests.
pip install -e ".[test]"
pytest
Contents¶
- conda_package_handling
- Changelog
- 2.4.0 (2024-10-08)
- 2.3.0 (2024-06-05)
- 2.2.0 (2023-07-28)
- 2.1.0 (2023-05-04)
- 2.0.2 (2022-12-01)
- 2.0.1 (2022-11-18)
- 2.0.0 (2022-11-17)
- 1.9.0 (2022-09-06)
- 1.8.1 (2022-04-01)
- 1.8.0 (2022-03-12)
- 1.7.3 (2021-04-12)
- 1.7.2 (2020-10-16)
- 1.6.0 (2019-09-20)
- 1.5.0 (2019-08-31)
- 1.4.1 (2019-08-04)
- 1.4.0 (2019-08-02)
- 1.3.11 (2019-07-11)
- 1.3.10 (2019-06-24)
- 1.3.9 (2019-06-14)
- 1.3.8 (2019-06-13)
- 1.3.7 (2019-06-12)
- 1.3.6 (2019-06-12)
- 1.3.5 (2019-06-12)
- 1.3.4 (2019-06-11)
- 1.3.3 (2019-06-11)
- 1.3.2 (2019-06-11)
- 1.3.1 (2019-06-11)
- 1.3.0 (2019-06-10)
- 1.2.0 (2019-06-08)
- 1.1.5 (2019-05-21)
- 1.1.4 (2019-05-21)
- 1.1.3 (2019-05-20)
- 1.1.2 (2019-05-20)
- 1.1.1 (2019-05-14)
- 1.1.0 (2019-05-10)
- 1.0.4 (2019-02-13)
- 1.0.3 (2019-02-04)
- 1.0.2 (2019-02-04)
- 1.0.1 (2019-02-04)