An efficient library to read from new and old format .conda and .tar.bz2 conda packages. It enables downloading conda metadata from packages without transferring the entire file and getting metadata from local .tar.bz2 packages without reading entire files. The library, currently at version 0.12.0, uses enhanced pip lazy_wheel for `.conda` files and `tarfile.open` for `.tar.bz2` to stream data efficiently. It maintains a regular release cadence, with major updates roughly every few months.
pip install conda-package-streamingVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to stream package metadata (specifically `info/index.json`) from a remote `.conda` or `.tar.bz2` package URL without downloading the entire file. It iterates through the package's members and extracts the `index.json` content.
Be mindful of the package format you are processing. For `.conda` files, you can `break` early once the desired metadata is found. For `.tar.bz2`, be prepared to iterate through more members or implement specific filtering.
Ensure your file-like objects for `.conda` are seekable if using `conda_reader_for_url`. If dealing with non-seekable streams and `.conda` packages, consider alternative streaming approaches or pre-downloading if seeking is unavoidable.
If your use case requires the entire package content, download the `.conda` or `.tar.bz2` file first using a standard HTTP client, then use the file-based APIs provided by `conda-package-streaming` or `conda-package-handling`.
Correct the import path to `from conda_package_streaming import package_streaming` and then access functions like `package_streaming.stream_conda_info`.
Ensure `member.name` correctly identifies a JSON file (e.g., `'info/index.json'`) and that `tar.extractfile(member)` returns a valid, non-empty file-like object containing well-formed JSON before attempting to load it.