pyBiocFileCache 0.8.0__py3-none-any.whl → 0.8.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pybiocfilecache-0.8.0.dist-info → pybiocfilecache-0.8.1.dist-info}/METADATA +99 -4
- {pybiocfilecache-0.8.0.dist-info → pybiocfilecache-0.8.1.dist-info}/RECORD +5 -5
- {pybiocfilecache-0.8.0.dist-info → pybiocfilecache-0.8.1.dist-info}/WHEEL +0 -0
- {pybiocfilecache-0.8.0.dist-info → pybiocfilecache-0.8.1.dist-info}/licenses/AUTHORS.md +0 -0
- {pybiocfilecache-0.8.0.dist-info → pybiocfilecache-0.8.1.dist-info}/licenses/LICENSE.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: pybiocfilecache
|
|
3
|
-
Version: 0.8.
|
|
3
|
+
Version: 0.8.1
|
|
4
4
|
Summary: File based cache for resources and metadata
|
|
5
5
|
Project-URL: Homepage, https://github.com/BiocPy/pybiocfilecache
|
|
6
6
|
Project-URL: Documentation, https://biocpy.github.io/pybiocfilecache
|
|
@@ -53,7 +53,102 @@ Requires-Dist: pytest-cov; extra == 'testing'
|
|
|
53
53
|
Requires-Dist: setuptools; extra == 'testing'
|
|
54
54
|
Description-Content-Type: text/markdown
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
[](https://pypi.org/project/pyBiocFileCache/)
|
|
57
|
+

|
|
58
|
+

|
|
59
|
+
|
|
60
|
+
# pyBiocFileCache
|
|
61
|
+
|
|
62
|
+
`pyBiocFileCache` is a Python package that provides a file caching system with resource validation, expiration management, and SQLite-backed metadata. Compatible with the [BiocFileCache R package](https://github.com/Bioconductor/BiocFileCache).
|
|
63
|
+
|
|
64
|
+
## Installation
|
|
65
|
+
|
|
66
|
+
Install from [PyPI](https://pypi.org/project/pyBiocFileCache/):
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
pip install pybiocfilecache
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Quick Start
|
|
73
|
+
|
|
74
|
+
```python
|
|
75
|
+
from pybiocfilecache import BiocFileCache
|
|
76
|
+
|
|
77
|
+
# Initialize cache
|
|
78
|
+
cache = BiocFileCache("path/to/cache/directory")
|
|
79
|
+
|
|
80
|
+
# Add a file to cache
|
|
81
|
+
resource = cache.add("myfile", "path/to/file.txt")
|
|
82
|
+
|
|
83
|
+
# Retrieve a file from cache
|
|
84
|
+
resource = cache.get("myfile")
|
|
85
|
+
|
|
86
|
+
# Use the cached file
|
|
87
|
+
print(resource["rpath"]) # Path to cached file
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Advanced Usage
|
|
91
|
+
|
|
92
|
+
### Configuration
|
|
93
|
+
|
|
94
|
+
```python
|
|
95
|
+
from datetime import timedelta
|
|
96
|
+
from pathlib import Path
|
|
97
|
+
|
|
98
|
+
from pybiocfilecache import BiocFileCache, CacheConfig
|
|
99
|
+
|
|
100
|
+
# Create custom configuration
|
|
101
|
+
config = CacheConfig(
|
|
102
|
+
cache_dir=Path("cache_directory"),
|
|
103
|
+
cleanup_interval=timedelta(days=7),
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
# Initialize cache with configuration
|
|
107
|
+
cache = BiocFileCache(config=config)
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Resource Management
|
|
111
|
+
|
|
112
|
+
```python
|
|
113
|
+
from datetime import datetime, timedelta, timezone
|
|
114
|
+
|
|
115
|
+
# Add file with expiration
|
|
116
|
+
resource = cache.add(
|
|
117
|
+
"myfile",
|
|
118
|
+
"path/to/file.txt",
|
|
119
|
+
expires=datetime.now(timezone.utc) + timedelta(days=30),
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
# Immediate lookup without waiting on missing files
|
|
123
|
+
record = cache.get(rid="BFC1", wait=False)
|
|
124
|
+
|
|
125
|
+
# List resources
|
|
126
|
+
resources = cache.list_resources()
|
|
127
|
+
|
|
128
|
+
# Search resources (exact or substring match)
|
|
129
|
+
results = cache.search("myfile", field="rname")
|
|
130
|
+
|
|
131
|
+
# Update resource by name or rid
|
|
132
|
+
cache.update("myfile", "path/to/new_file.txt")
|
|
133
|
+
cache.update(rid="BFC1", fpath="path/to/new_file.txt")
|
|
134
|
+
|
|
135
|
+
# Remove resource by name or rid
|
|
136
|
+
cache.remove("myfile")
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Cache Statistics and Maintenance
|
|
140
|
+
|
|
141
|
+
```python
|
|
142
|
+
# Get cache statistics
|
|
143
|
+
stats = cache.get_stats()
|
|
144
|
+
print(stats)
|
|
145
|
+
|
|
146
|
+
# Clean up expired resources
|
|
147
|
+
removed_count = cache.cleanup()
|
|
148
|
+
|
|
149
|
+
# Verify integrity of cached files
|
|
150
|
+
valid, invalid = cache.verify_cache()
|
|
151
|
+
|
|
152
|
+
# Purge entire cache
|
|
153
|
+
cache.purge()
|
|
59
154
|
```
|
|
@@ -5,8 +5,8 @@ pybiocfilecache/const.py,sha256=c9167eSCGBp0wF1xuAEvr-fbYCzp0lcOtKF9sqxlLF8,26
|
|
|
5
5
|
pybiocfilecache/models.py,sha256=6CFAmSLDhIBjBGU2leV6B4MxEZQQnJE0xrF55CRT6mw,2582
|
|
6
6
|
pybiocfilecache/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
7
|
pybiocfilecache/utils.py,sha256=HzONrEmukpHVJkXKMrvVVV2DSwn2vynK_o72dggKtCE,3247
|
|
8
|
-
pybiocfilecache-0.8.
|
|
9
|
-
pybiocfilecache-0.8.
|
|
10
|
-
pybiocfilecache-0.8.
|
|
11
|
-
pybiocfilecache-0.8.
|
|
12
|
-
pybiocfilecache-0.8.
|
|
8
|
+
pybiocfilecache-0.8.1.dist-info/METADATA,sha256=GjytX5aIdeS1Ek9nc_uxeWm_o4wAHqCupssmNVGldmo,5169
|
|
9
|
+
pybiocfilecache-0.8.1.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
10
|
+
pybiocfilecache-0.8.1.dist-info/licenses/AUTHORS.md,sha256=ptvMLokf9Knfp0Ng-dHSgtEimkXWZhjZAR_o2aJm9bw,161
|
|
11
|
+
pybiocfilecache-0.8.1.dist-info/licenses/LICENSE.txt,sha256=bV5MJ4ezdCnC4yREyxU30iel5hFq8T8kGqobu4Kc-WM,1082
|
|
12
|
+
pybiocfilecache-0.8.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|