Skip to main content

Download and extract (single) files from ZIP archives in Zenodo records.

Project description

PyPI License Code style: black

ZenodoZipDownloader

A Python package to download and extract selected files from ZIP archives in Zenodo records, with pattern matching, CRC32 integrity checks, and robust retry logic.

Features

  • Download files from Zenodo records using DOI or record URL
  • Filter ZIP files and inner files using glob patterns
  • Download only a subset of files if desired
  • CRC32 integrity check for downloaded files
  • Retry logic for network and file operations
  • Command-line interface (CLI)

Installation

pip install zenodozipdownloader

Or from source:

git clone https://github.com/yourusername/zenodozipdownloader.git
cd zenodozipdownloader
pip install .

Requirements

  • Python 3.10 or newer
  • Network access to https://zenodo.org/
  • Optional: tqdm for download progress (see below)

Optional progress bar

The package can show download progress if tqdm is available. Install it alongside the downloader with:

pip install zenodozipdownloader[tqdm]

Usage

As a Python module

# [optional] set logging level to INFO for more verbose output
import logging
logging.basicConfig(level=logging.INFO)

from zenodozipdownloader import ZenodoZipDownloader

doi = "10.5281/zenodo.5423457"
downloader = ZenodoZipDownloader(doi, download_dir="zenodo_downloads")
downloaded_files = downloader.download(zip_pattern="*.zip", inner_pattern="*tubulin*.mat")

for path in downloaded_files:
    print(f"Saved: {path}")

By default:

  • Extracted files stay inside the chosen download_dir; unsafe ZIP paths are skipped.
  • All files are downloaded unless you provide inner_pattern.
  • Downloads retry up to three times and validate CRC32 checksums.

As a CLI tool

zenodozipdownloader 10.5281/zenodo.5423457 --download_dir zenodo_downloads --zip_pattern "*.zip" --inner_pattern "*tubulin*.mat"

Run zenodozipdownloader --help for the full CLI reference. It shares defaults with the Python API; omit --first_n_zip and --first_n_inner to process every match.

Arguments

  • doi: Zenodo DOI or record URL
  • --download_dir: Directory to save downloaded files (default: current directory)
  • --zip_pattern: Glob pattern for ZIP files in the record (default: *.zip)
  • --inner_pattern: Glob pattern for files inside ZIPs (default: all)
  • --first_n_zip: Only process the first N matching ZIP files (default: all)
  • --first_n_inner: Only download the first N matching files within each ZIP (default: all)

Testing

To run the integration tests and check code coverage:

pip install pytest pytest-cov
pytest --cov=zenodozipdownloader tests/

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zenodozipdownloader-0.1.0a1.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zenodozipdownloader-0.1.0a1-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file zenodozipdownloader-0.1.0a1.tar.gz.

File metadata

  • Download URL: zenodozipdownloader-0.1.0a1.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for zenodozipdownloader-0.1.0a1.tar.gz
Algorithm Hash digest
SHA256 ab9a7c8e5c98fd85ef4e4fe81531f697983d2b339e6c27fefc16789e2ba070e2
MD5 2d3fae96d3ec76346ce9f6281ffee7a1
BLAKE2b-256 259158e09f5918810b5e4ce1e3a474608588747d0070eab4c7822c3f34f4c52c

See more details on using hashes here.

Provenance

The following attestation bundles were made for zenodozipdownloader-0.1.0a1.tar.gz:

Publisher: publish.yml on thielec/ZenodoZipDownloader

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file zenodozipdownloader-0.1.0a1-py3-none-any.whl.

File metadata

File hashes

Hashes for zenodozipdownloader-0.1.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 6a518bd0b56e05b453f14c6877d7dc53a2d4ee4eb77ac30fdef9c05317a41656
MD5 6d7b6200575ed4f4674f03af540a2149
BLAKE2b-256 e08d427f3dcad4f223003078d60a71cf539ba41cb593cb2ffd68bb3f64299c61

See more details on using hashes here.

Provenance

The following attestation bundles were made for zenodozipdownloader-0.1.0a1-py3-none-any.whl:

Publisher: publish.yml on thielec/ZenodoZipDownloader

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page