This release is a pre-release and may not be stable for production use.
numba-lock-cache
A Python package that monkey-patches Numba's caching mechanism to safely coordinate concurrent cache access using file locks.
Why?
Numba’s function-level caching (@jit(cache=True)) is not concurrency-safe by default. This can lead to:
- Crashes when multiple processes load/write to the same cache
- Especially problematic on shared filesystems (e.g., NFS)
Locking Mechanism
- Uses
flufl.lockfor file-based locking. - Lock file is created next to the cache index file:
/path/to/cache/func.nbi.lock - Lock behavior:
- Timeout to acquire: 60 minutes (configurable)
- Lifetime:
None(lock persists until released) - NFS-safe: relies on atomic file creation
Installation
pip install numba-lock-cache
How to use it
Just import the patch Numba in your application:
import numba_cache_lock
numba_cache_lock.patch_numba_cache()
from numba import jit
@jit(cache=True)
def my_func(x):
return x * 2
By default, patch_numba_cache will hold a lock for 1 hour in the worst case.
One can change this value by assigning the lifetime= keyword argument to a
timedelta object.
Metadata
Release files for numba-cache-lock 0.1.0a2
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 | |
|---|---|---|---|---|
| numba_cache_lock-0.1.0a2.tar.gz | 2.8 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| numba_cache_lock-0.1.0a2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 6.1 kB
Release files / numba_cache_lock-0.1.0a2.tar.gz
| Download URL | numba_cache_lock-0.1.0a2.tar.gz |
|---|---|
| Size | 2.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
45f274356771ac3c8dbb3ee8a3ee27ba39769b25218ed1734c7e7c2b09bf52fb
|
|
BLAKE2b-256 checksum How to use checksums |
e74266c2bf259487edc90e1da2bddc15b6cc216d12a61a6eca535807a6a908d2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.12.11 Linux/6.11.0-1018-azure
|
Release files / numba_cache_lock-0.1.0a2-py3-none-any.whl
| Download URL | numba_cache_lock-0.1.0a2-py3-none-any.whl |
|---|---|
| Size | 3.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f626e77faac3c77f19c471b720f64a460d6941d6c83733bb5b1e754d4267ff2e
|
|
BLAKE2b-256 checksum How to use checksums |
b25fcfc3836e01bd7025f6df1ba70f41aee5fecdeb5dd102fe720ebaa4eb7b1a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.12.11 Linux/6.11.0-1018-azure
|
Security for numba-cache-lock 0.1.0a2
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.