Skip to main content

DataCache

Tests Coverage PyPI

Download a dataset once, verify it, and reuse the local file on later runs. DataCache handles streaming downloads, gzip/ZIP decompression, tar-tree installation, offline inspection and SQLite caches built from pandas DataFrames. It is the download layer of the OpenVax tools: PyEnsembl, pepdata, orfdata and Vaxrank use it, and any Python application can.

Install

Python 3.11 or newer is required; CI tests Python 3.11–3.14.

python -m pip install datacache
# Optional HTML-table conversion:
python -m pip install "datacache[html]"

Quick start

Download a file once, then reuse its local path on later calls:

from datacache import Cache

cache = Cache("my-project")
url = "https://raw.githubusercontent.com/openvax/datacache/master/LICENSE"
path = cache.fetch(url, filename="LICENSE", timeout=30)
print(open(path).readline().strip())

# Reuses the cached file without a network request, even in a later process.
print(cache.fetch(url, filename="LICENSE") == path)
Apache License
True

path is under the platform cache directory, for example ~/Library/Caches/my-project/LICENSE on macOS or ~/.cache/my-project/LICENSE on Linux. Replace the URL and filename with your dataset. Existing files are reused until you refresh them with force=True, or periodically with expire_after; DataCache doesn't ask the server whether a file has changed. Add show_progress=True to display a download bar; no extra installation is needed.

Documentation

The documentation starts with an offline example that verifies a file's checksum, then covers one task per page. In reading order:

  1. Download and inspect files: exact destinations, integrity checks, freshness, retries, resumable transfers and offline inspection.
  2. Read tables and build SQLite caches from CSV files and pandas DataFrames.
  3. Share a cache between users and packages.
  4. Install pinned bundles of files that belong together, or archive trees.
  5. Build derived files from downloads and publish them together.
  6. Integrate a consuming library.

Also see choose an interface, the API reference and the release notes.

Dependencies and progress display

tqdm is installed by default; existing download APIs enable displays with show_progress=True, while materialize enables them by default. Quiet use does not import tqdm or configure your application's logging. The old datacache[progress] install syntax remains supported as a compatibility alias.

DataCache requires pandas>=3,<4 and Python 3.11 or newer. CI tests current pandas 3.x across Python 3.11–3.14 and checks the pandas 3.0.0 minimum on Python 3.11. Existing SQLite caches remain reusable without rebuilding them.

Development

python -m pip install -e ".[test]"
./lint.sh   # ruff
./test.sh   # pytest with coverage
python -m examples.basic_usage

The development wrappers use python from your active environment. Set PYTHON=/path/to/python to select another interpreter. Pass pytest arguments through ./test.sh -k test_name or ./lint-and-test.sh -k test_name.

Tests use local files, mocked responses, and local HTTP servers. They do not depend on external dataset servers. See CI for the Python, dependency, and operating-system combinations exercised.

Build the site with python -m pip install -r requirements-docs.txt and ./docs.sh. See the release procedure.

License

Apache License 2.0

Metadata

Release files for datacache 1.39.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for datacache 1.39.0
File Size Uploaded Provenance Actions
datacache-1.39.0.tar.gz 304.2 kB Without provenance Details for datacache-1.39.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for datacache 1.39.0
File Interpreter ABI Platform Actions
datacache-1.39.0-py3-none-any.whl Python 3 none any Details for datacache-1.39.0-py3-none-any.whl

Total release size: 442.9 kB

Release files / datacache-1.39.0.tar.gz

Download URL datacache-1.39.0.tar.gz
Size 304.2 kB
Tags Source
SHA-256 checksum
How to use checksums
9a522f6b42c6306b3f5fdb96b533acd99f8d34c2f8af47c4c099dd1778c1e4be
BLAKE2b-256 checksum
How to use checksums
faf7d1e9e3139830b026e9f1b87ef37e15651dc0e53af5b30af1cb941ff9d095
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.6

Release files / datacache-1.39.0-py3-none-any.whl

Download URL datacache-1.39.0-py3-none-any.whl
Size 138.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f2c2f60020392cbc349abe151169aaef305aa6d0c6782811164fa5400161d10b
BLAKE2b-256 checksum
How to use checksums
0aed9af03cb7c505580fb5fc68c84ccb28fe38ab4c38d30291a58097f46f2988
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.6

Security for datacache 1.39.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.39.0 This release

2 release files No provenance

0.4.7

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page