Skip to main content

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

License: MIT Version

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

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

braincraft-1.0.0.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

braincraft-1.0.0-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

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

Hashes for braincraft-1.0.0.tar.gz
Algorithm Hash digest
SHA256 0ebdb93f22f5849ed44fa4dd787e5fe9c03d442285d2943cedcb30c79d4390ca
MD5 d6ba38201e78b86a5bdb4fef279643fe
BLAKE2b-256 73f544e05c0b81130f943f11f5fa9f58ae4945cd4d54f6a87897d3bff487b913

See more details on using hashes here.

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

Hashes for braincraft-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 57bc203691b105d1f76b09f3064f8b76f28cb0f64f675607d32ede6209fa4bc2
MD5 1a7ad5254fd37bc8afa179d7619ffc4d
BLAKE2b-256 3f77ca7b867b49b9b21674b71016a6ef1e5beced7a0f2ade65abce81930a2c4b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page