A workshop of small, sharp utilities - carefully shaped helpers you reuse across projects to keep everyday coding tasks fast, tidy, and consistent.
Project description
braincraft
A workshop of small, sharp utilities - carefully shaped helpers you reuse across projects to keep everyday coding tasks fast, tidy, and consistent.
Requirements
- Python
>=3.14
Usage
retry_rand_exp
Calls an async coroutine with automatic retry and full-jitter exponential back-off.
Retries on any exception up to max_attempts times, sleeping a random jittered
duration between attempts. Re-raises the last exception when all attempts are exhausted.
from braincraft import retry_rand_exp
async def fetch_data(url: str) -> str:
# your async operation here
...
result = await retry_rand_exp(
fetch_data,
"https://example.com/api",
max_attempts=5,
base_delay=1.0,
max_delay=30.0,
)
Development
Prerequisites
- Poetry
2.2+
Install dependencies
poetry install
Format and lint
poetry run black braincraft; poetry run pylint braincraft
Run tests with coverage
poetry run pytest --cov=braincraft tests --cov-report html
Changelog
See CHANGELOG.md for a full history of changes.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file braincraft-1.0.0.tar.gz.
File metadata
- Download URL: braincraft-1.0.0.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.4 CPython/3.14.4 Windows/11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ebdb93f22f5849ed44fa4dd787e5fe9c03d442285d2943cedcb30c79d4390ca
|
|
| MD5 |
d6ba38201e78b86a5bdb4fef279643fe
|
|
| BLAKE2b-256 |
73f544e05c0b81130f943f11f5fa9f58ae4945cd4d54f6a87897d3bff487b913
|
File details
Details for the file braincraft-1.0.0-py3-none-any.whl.
File metadata
- Download URL: braincraft-1.0.0-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.4 CPython/3.14.4 Windows/11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
57bc203691b105d1f76b09f3064f8b76f28cb0f64f675607d32ede6209fa4bc2
|
|
| MD5 |
1a7ad5254fd37bc8afa179d7619ffc4d
|
|
| BLAKE2b-256 |
3f77ca7b867b49b9b21674b71016a6ef1e5beced7a0f2ade65abce81930a2c4b
|