🐍 PyEssential
A growing collection of Python utilities and decorators to simplify common development tasks.
✨ Features
PyEssential aims to be the go-to library for small, reusable tools that you often find yourself writing from scratch.
- Performance: Includes the ready-to-use
@timeitdecorator for simple function benchmarking. - Command line: Check your installed version with
pyessential --version. - Code Clarity: Utility functions for common tasks like string manipulation (e.g., casing). (Coming soon!)
- Scalability: Structured for easy addition of new utility groups (e.g.,
networking,file_io,validation).
🚀 Installation
Requires Python 3.9+
pip install pyessential
To upgrade to the latest release:
pip install --upgrade pyessential
📖 Usage
@timeit
from pyessential.decorators import timeit
@timeit
def slow_function():
sum(range(1_000_000))
slow_function()
# [slow_function] executed in 0.0123 seconds.
@retry
Retries a function when it raises, waiting longer between each attempt. After the last attempt, the original exception is re-raised.
from pyessential.decorators import retry
@retry(tries=4, delay=0.5, backoff=2, exceptions=(ConnectionError, TimeoutError))
def fetch_data():
...
This waits 0.5s, 1s, then 2s between attempts. Only the listed exceptions trigger a retry; anything else is raised immediately.
| Option | Meaning |
|---|---|
tries |
Total attempts, including the first (default 3) |
delay |
Seconds to wait after the first failure (default 1.0) |
backoff |
Multiplier applied to the wait after each failure (default 2.0; use 1 for a constant delay) |
max_delay |
Upper limit for any single wait |
jitter |
Up to this many extra random seconds added to each wait |
exceptions |
Exception class or tuple of classes that trigger a retry (default Exception) |
on_retry |
Callback on_retry(exc, attempt, wait), e.g. for logging |
Command line
pyessential --version
python -m pyessential --version # also works
🛠️ Development
git clone https://github.com/Abhi39054/PyEssential.git
cd PyEssential
pip install -e .
pytest
Releasing
- Bump the version in
pyessential/_version.py, commit, and push tomain:git commit -am "chore: bump version to 0.1.4" git push origin main
- Tag the release and push the tag:
git tag -a v0.1.4 -m "Release 0.1.4" git push origin v0.1.4
- CI runs the tests, builds the package, publishes to TestPyPI, waits for approval, publishes to PyPI, and creates the GitHub Release.
The tag must match the version in _version.py (v0.1.4 ↔ 0.1.4), or the build fails.
🤝 Contributing
Contributions are welcome. See CONTRIBUTING.md.
📄 License
Released under the MIT License.
Metadata
Release files for pyessential 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyessential-0.1.5.tar.gz | 16.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyessential-0.1.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 28.7 kB
Release files / pyessential-0.1.5.tar.gz
| Download URL | pyessential-0.1.5.tar.gz |
|---|---|
| Size | 16.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a5d7a81f8fa63fb987437c3c4bf79d7ec33a38f09649ea4d4d3284203395cb48
|
|
BLAKE2b-256 checksum How to use checksums |
0793cacd908707f1afd4fec34ceb0722c239f5a3bf288d119a937a0c328450d4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / pyessential-0.1.5-py3-none-any.whl
| Download URL | pyessential-0.1.5-py3-none-any.whl |
|---|---|
| Size | 12.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b0a25ed51b9173bb827e2f5d59414f15da220590c8f541d88fd3b7186a9e38da
|
|
BLAKE2b-256 checksum How to use checksums |
d34bb554d8e5674243bcfdb7e4891009632c75f29e8c85e64833b10804183a45
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|