utils-py
A set of python utilities.
Usage
poetry add outcome-utils
Cache
To add cache to a module
from outcome.utils import cache
cache_settings = {
'<your_prefix>.expiration': 300, # Default
'<your_prefix>.backend': 'memory', # Default
}
region = cache.get_cache_region()
cache.configure_cache_region(region, settings=cache_settings, prefix='<your_prefix>')
Then add to the functions to cache:
@region.cache_on_arguments()
def func_to_cache():
...
Or for async functions:
@region.cache_on_arguments()
@cache.cache_async
async def async_func_to_cache():
...
To have the cache persist on disk, specify the path
from pathlib import Path
cache_settings = {
...
'<your_prefix>.cache_path': f'{Path.home()}/.cache/example_path/cache.pkl'',
...
}
Development
Remember to run ./pre-commit.sh when you clone the repository.
Release files for outcome-utils 5.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| outcome-utils-5.1.0.tar.gz | 16.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| outcome_utils-5.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 37.0 kB
Release files / outcome-utils-5.1.0.tar.gz
| Download URL | outcome-utils-5.1.0.tar.gz |
|---|---|
| Size | 16.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1068a0d11f36da664b3d403810ec1b2349e5217868d4a4045307c1b4639e6445
|
|
BLAKE2b-256 checksum How to use checksums |
d37271ce42deee0f6477451029d3d4f2a3f8b0aa86560eccd1c577e1f6e4304d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.5 CPython/3.8.6 Linux/5.4.0-1046-azure
|
Release files / outcome_utils-5.1.0-py3-none-any.whl
| Download URL | outcome_utils-5.1.0-py3-none-any.whl |
|---|---|
| Size | 20.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7223d3239db8fe41c27c7b94c598c677b75c38076a6dc79be5f3db5ae9103963
|
|
BLAKE2b-256 checksum How to use checksums |
4dd4c5a3706f026d2ac48dc314369335e98a36eb1d4111947e14856adeb05792
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.5 CPython/3.8.6 Linux/5.4.0-1046-azure
|