Skip to main content

Project generated with PyScaffold PyPI-Server Unit tests

pyBiocFileCache

pyBiocFileCache is a Python package that provides a robust file caching system with resource validation, cache size management, file compression, and resource tagging. Compatible with BiocFileCache R package.

Installation

Install from PyPI,

pip install pybiocfilecache

Quick Start

from pybiocfilecache import BiocFileCache

# Initialize cache
cache = BiocFileCache("path/to/cache/directory")

# Add a file to cache
resource = cache.add("myfile", "path/to/file.txt")

# Retrieve a file from cache
resource = cache.get("myfile")

# Use the cached file
print(resource["rpath"])  # Path to cached file

Advanced Usage

Configuration

from pybiocfilecache import BiocFileCache, CacheConfig
from datetime import timedelta
from pathlib import Path

# Create custom configuration
config = CacheConfig(
    cache_dir=Path("cache_directory"),
    cleanup_interval=timedelta(days=7),
)

# Initialize cache with configuration
cache = BiocFileCache(config=config)

Resource Management

# Add file with tags and expiration
from datetime import datetime, timedelta

resource = cache.add(
    "myfile",
    "path/to/file.txt",
    tags=["data", "raw"],
    expires=datetime.now() + timedelta(days=30)
)

# List resources by tag
resources = cache.list_resources(tag="data")

# Search resources
results = cache.search("myfile", field="rname")

# Update resource
cache.update("myfile", "path/to/new_file.txt")

# Remove resource
cache.remove("myfile")

Cache Statistics and Maintenance

# Get cache statistics
stats = cache.get_stats()
print(stats)

# Clean up expired resources
removed_count = cache.cleanup()

# Purge entire cache
cache.purge()

Release files for pyBiocFileCache 0.7.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 pyBiocFileCache 0.7.0
File Size Uploaded
pybiocfilecache-0.7.0.tar.gz 29.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyBiocFileCache 0.7.0
File Interpreter ABI Platform
pybiocfilecache-0.7.0-py3-none-any.whl Python 3 none any Details

Total release size: 42.3 kB

Release files / pybiocfilecache-0.7.0.tar.gz

Download URL pybiocfilecache-0.7.0.tar.gz
Size 29.6 kB
Tags Source
SHA-256 checksum
How to use checksums
ff60d0727f64de1de6fb915c4d3c400703b94b8cf5e3dc84c7b9cc9ced836b60
BLAKE2b-256 checksum
How to use checksums
05c6c2f0bad4849d7e7af99d49f68c899c0b0c33cf7a1ce6ae2756f403db098c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 23, 2025.

Transparency log

Release files / pybiocfilecache-0.7.0-py3-none-any.whl

Download URL pybiocfilecache-0.7.0-py3-none-any.whl
Size 12.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4740ee7b1d3d503eab65e0ca1ca4dd97bb5eb76353fdc1eff700159bb15a07ae
BLAKE2b-256 checksum
How to use checksums
3d8aa645dcf9097bdd75012be719b2b3061907ae61197d26e8d39e8e4317faee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 23, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.7.0 This release

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.0.2

2 release files

0.0.1

2 release files

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