pyBiocFileCache 0.3.0__py3-none-any.whl → 0.5.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.3.0.dist-info → pyBiocFileCache-0.5.1.dist-info}/AUTHORS.md +1 -0
- pyBiocFileCache-0.5.1.dist-info/METADATA +116 -0
- pyBiocFileCache-0.5.1.dist-info/RECORD +13 -0
- {pyBiocFileCache-0.3.0.dist-info → pyBiocFileCache-0.5.1.dist-info}/WHEEL +1 -1
- pybiocfilecache/__init__.py +2 -8
- pybiocfilecache/cache.py +633 -0
- pybiocfilecache/config.py +42 -0
- pybiocfilecache/const.py +1 -0
- pybiocfilecache/exceptions.py +31 -0
- pybiocfilecache/models.py +84 -0
- pybiocfilecache/utils.py +61 -46
- pyBiocFileCache-0.3.0.dist-info/METADATA +0 -99
- pyBiocFileCache-0.3.0.dist-info/RECORD +0 -13
- pybiocfilecache/BiocFileCache.py +0 -234
- pybiocfilecache/_exceptions.py +0 -15
- pybiocfilecache/db/Base.py +0 -34
- pybiocfilecache/db/__init__.py +0 -5
- pybiocfilecache/db/schema.py +0 -35
- {pyBiocFileCache-0.3.0.dist-info → pyBiocFileCache-0.5.1.dist-info}/LICENSE.txt +0 -0
- {pyBiocFileCache-0.3.0.dist-info → pyBiocFileCache-0.5.1.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: pyBiocFileCache
|
|
3
|
+
Version: 0.5.1
|
|
4
|
+
Summary: File based cache for resources and metadata
|
|
5
|
+
Home-page: https://github.com/epiviz/pyBiocFileCache
|
|
6
|
+
Author: jkanche
|
|
7
|
+
Author-email: jayaram.kancherla@gmail.com
|
|
8
|
+
License: MIT
|
|
9
|
+
Project-URL: Documentation, https://pyscaffold.org/
|
|
10
|
+
Platform: any
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Programming Language :: Python
|
|
13
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
14
|
+
License-File: LICENSE.txt
|
|
15
|
+
License-File: AUTHORS.md
|
|
16
|
+
Requires-Dist: importlib-metadata; python_version < "3.8"
|
|
17
|
+
Requires-Dist: sqlalchemy
|
|
18
|
+
Provides-Extra: testing
|
|
19
|
+
Requires-Dist: setuptools; extra == "testing"
|
|
20
|
+
Requires-Dist: pytest; extra == "testing"
|
|
21
|
+
Requires-Dist: pytest-cov; extra == "testing"
|
|
22
|
+
|
|
23
|
+
[](https://pyscaffold.org/)
|
|
24
|
+
[](https://pypi.org/project/pyBiocFileCache/)
|
|
25
|
+

|
|
26
|
+
|
|
27
|
+
# pyBiocFileCache
|
|
28
|
+
|
|
29
|
+
`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](https://github.com/Bioconductor/BiocFileCache).
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
Install from [PyPI](https://pypi.org/project/pyBiocFileCache/),
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
pip install pybiocfilecache
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Quick Start
|
|
40
|
+
|
|
41
|
+
```python
|
|
42
|
+
from pybiocfilecache import BiocFileCache
|
|
43
|
+
|
|
44
|
+
# Initialize cache
|
|
45
|
+
cache = BiocFileCache("path/to/cache/directory")
|
|
46
|
+
|
|
47
|
+
# Add a file to cache
|
|
48
|
+
resource = cache.add("myfile", "path/to/file.txt")
|
|
49
|
+
|
|
50
|
+
# Retrieve a file from cache
|
|
51
|
+
resource = cache.get("myfile")
|
|
52
|
+
|
|
53
|
+
# Use the cached file
|
|
54
|
+
print(resource.rpath) # Path to cached file
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Advanced Usage
|
|
58
|
+
|
|
59
|
+
### Configuration
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
from pybiocfilecache import BiocFileCache, CacheConfig
|
|
63
|
+
from datetime import timedelta
|
|
64
|
+
from pathlib import Path
|
|
65
|
+
|
|
66
|
+
# Create custom configuration
|
|
67
|
+
config = CacheConfig(
|
|
68
|
+
cache_dir=Path("cache_directory"),
|
|
69
|
+
max_size_bytes=1024 * 1024 * 1024, # 1GB
|
|
70
|
+
cleanup_interval=timedelta(days=7),
|
|
71
|
+
compression=True
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
# Initialize cache with configuration
|
|
75
|
+
cache = BiocFileCache(config=config)
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Resource Management
|
|
79
|
+
|
|
80
|
+
```python
|
|
81
|
+
# Add file with tags and expiration
|
|
82
|
+
from datetime import datetime, timedelta
|
|
83
|
+
|
|
84
|
+
resource = cache.add(
|
|
85
|
+
"myfile",
|
|
86
|
+
"path/to/file.txt",
|
|
87
|
+
tags=["data", "raw"],
|
|
88
|
+
expires=datetime.now() + timedelta(days=30)
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
# List resources by tag
|
|
92
|
+
resources = cache.list_resources(tag="data")
|
|
93
|
+
|
|
94
|
+
# Search resources
|
|
95
|
+
results = cache.search("myfile", field="rname")
|
|
96
|
+
|
|
97
|
+
# Update resource
|
|
98
|
+
cache.update("myfile", "path/to/new_file.txt")
|
|
99
|
+
|
|
100
|
+
# Remove resource
|
|
101
|
+
cache.remove("myfile")
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Cache Statistics and Maintenance
|
|
105
|
+
|
|
106
|
+
```python
|
|
107
|
+
# Get cache statistics
|
|
108
|
+
stats = cache.get_stats()
|
|
109
|
+
print(stats)
|
|
110
|
+
|
|
111
|
+
# Clean up expired resources
|
|
112
|
+
removed_count = cache.cleanup()
|
|
113
|
+
|
|
114
|
+
# Purge entire cache
|
|
115
|
+
cache.purge()
|
|
116
|
+
```
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
pybiocfilecache/__init__.py,sha256=kClwDkzgGPYAyDW-fuo5LI4lKCruYJhDHvw0lq9u4b0,652
|
|
2
|
+
pybiocfilecache/cache.py,sha256=YOCur7R7209WBI6JEW3Q9VzD7ymu7Wj2DDLGEMFCeDo,21395
|
|
3
|
+
pybiocfilecache/config.py,sha256=hfknpMCzNk6wt84lTvbfH3Z0g66u_-2Fer3AftgDJBA,1040
|
|
4
|
+
pybiocfilecache/const.py,sha256=c9167eSCGBp0wF1xuAEvr-fbYCzp0lcOtKF9sqxlLF8,26
|
|
5
|
+
pybiocfilecache/exceptions.py,sha256=8jrnctFYF7Rc1xsITtLUwKKvx8GMoKbarucyc-4f2zI,706
|
|
6
|
+
pybiocfilecache/models.py,sha256=A6BIrT78qqURxJoDvBjkDRBFV5cLdi3WKxreSCPB9tw,2125
|
|
7
|
+
pybiocfilecache/utils.py,sha256=lBK4BmzT6Z7XCn4j8kmhz9BPQpWT-RYfWvWC7YNtIGM,2291
|
|
8
|
+
pyBiocFileCache-0.5.1.dist-info/AUTHORS.md,sha256=ptvMLokf9Knfp0Ng-dHSgtEimkXWZhjZAR_o2aJm9bw,161
|
|
9
|
+
pyBiocFileCache-0.5.1.dist-info/LICENSE.txt,sha256=bV5MJ4ezdCnC4yREyxU30iel5hFq8T8kGqobu4Kc-WM,1082
|
|
10
|
+
pyBiocFileCache-0.5.1.dist-info/METADATA,sha256=N1hNP2VEuDt-u2maLQW9b5qmS7llNtkKgGUusWNpolU,2991
|
|
11
|
+
pyBiocFileCache-0.5.1.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
|
12
|
+
pyBiocFileCache-0.5.1.dist-info/top_level.txt,sha256=_A2QFmYMnsz6WoSRPk1EFMDr5mkQVGx9Xtz2RMv3aF4,16
|
|
13
|
+
pyBiocFileCache-0.5.1.dist-info/RECORD,,
|
pybiocfilecache/__init__.py
CHANGED
|
@@ -15,11 +15,5 @@ except PackageNotFoundError: # pragma: no cover
|
|
|
15
15
|
finally:
|
|
16
16
|
del version, PackageNotFoundError
|
|
17
17
|
|
|
18
|
-
from .
|
|
19
|
-
|
|
20
|
-
from .db.schema import Metadata as Metadata
|
|
21
|
-
from .db.schema import Resource as Resource
|
|
22
|
-
|
|
23
|
-
from ._exceptions import NoFpathError as NoFpathError
|
|
24
|
-
from ._exceptions import RnameExistsError as RnameExistsError
|
|
25
|
-
from ._exceptions import RpathTimeoutError as RpathTimeoutError
|
|
18
|
+
from .cache import BiocFileCache
|
|
19
|
+
from .config import CacheConfig
|