DataCache
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:
- Download and inspect files: exact destinations, integrity checks, freshness, retries, resumable transfers and offline inspection.
- Read tables and build SQLite caches from CSV files and pandas DataFrames.
- Share a cache between users and packages.
- Install pinned bundles of files that belong together, or archive trees.
- Build derived files from downloads and publish them together.
- 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.
The existing pandas dependency range is unchanged; upgrading DataCache does not introduce a pandas 1.5 requirement. CI covers pandas 1.4.4, 1.5.3, and current releases on supported Python versions.
Development
python -m pip install -e ".[test]"
./lint.sh # ruff
./test.sh # pytest with coverage
python -m examples.basic_usage
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
Metadata
Release files for datacache 1.30.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| datacache-1.30.2.tar.gz | 302.9 kB | Without provenance | Details for datacache-1.30.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| datacache-1.30.2-py3-none-any.whl | Python 3 | none | any | Details for datacache-1.30.2-py3-none-any.whl |
Total release size: 419.9 kB
Release files / datacache-1.30.2.tar.gz
| Download URL | datacache-1.30.2.tar.gz |
|---|---|
| Size | 302.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
45ceb7d2b67899ca527d7a94e1fefbc4671629a09f883db683e58e5dcd7aeab5
|
|
BLAKE2b-256 checksum How to use checksums |
71e41159324113aeeaff4d9b6f103d7d882a7fd8caac44e94a2bd12369221764
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|
Release files / datacache-1.30.2-py3-none-any.whl
| Download URL | datacache-1.30.2-py3-none-any.whl |
|---|---|
| Size | 117.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dcda81d260e0890327af6ae8d5160479798d0e689dbdeff41281a20ab4296017
|
|
BLAKE2b-256 checksum How to use checksums |
235b8a7339f06b185ee22ee9db747d352b05ec607eb9286947fccc412f0ce698
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|
Security for datacache 1.30.2
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.