core-extensions
This project contains common elements for different projects. Unlike core-mixins, this project requires external dependencies…
Installation
Install from PyPI using pip:
pip install core-extensions
uv pip install core-extensions # Or using UV...
Features
This library provides a collection of utilities and extensions for projects:
Retry Decorator Advanced retry mechanism based on the tenacity library with exponential backoff, custom exception handling, and detailed logging.
from core_extensions.decorators.retry import SimpleRetry
retry_handler = SimpleRetry(max_attempts=3, base_delay=1.0)
@retry_handler.create_decorator((ConnectionError, TimeoutError))
def fetch_data():
return api.get_data()
Aliased CLI Group Click extension that allows defining command aliases for better user experience and backward compatibility in CLI applications.
from core_extensions.cli import AliasedGroup
cli = AliasedGroup()
@cli.command("deploy", aliases=["release", "publish"])
def deploy_command():
"""Deploy the application"""
print("Deploying...")
@cli.group("infra", aliases=["i", "infrastructure"])
def infra_group():
"""Infrastructure commands"""
Aliases are shown automatically in --help output:
Commands:
deploy Deploy the application (aliases: release, publish)
infra Infrastructure commands (aliases: i, infrastructure)
Registering the same alias on two different commands raises ValueError immediately at decoration time, preventing silent routing bugs.
By default a subgroup is a plain click.Group, so its commands do not support aliases. Pass cls=AliasedGroup to enable full alias support at every level:
@cli.group("db", aliases=["database"], cls=AliasedGroup)
def db_group():
"""Database commands"""
@db_group.command("migrate", aliases=["m"])
def db_migrate():
"""Run pending migrations"""
Quick Start
Installation
Install the package:
pip install core-extensions
uv pip install core-extensions # Or using UV...
pip install -e ".[dev]" # For development...
Setting Up Environment
Install required libraries:
pip install --upgrade pip
pip install virtualenv
Create Python virtual environment:
virtualenv --python=python3.12 .venv
Activate the virtual environment:
source .venv/bin/activate
Install packages
pip install .
pip install -e ".[dev]"
Testing
The project ships two complementary test suites:
Unit tests — isolated, mocked, deterministic; one file per module.
Integration tests — end-to-end scenarios using Click’s CliRunner and live tenacity retry machinery; no mocking of internal collaborators.
tests/
├── unit/
│ ├── cli/tests_aliased_group.py
│ └── decorators/tests_retry.py
└── integration/
├── test_cli_integration.py
└── test_retry_integration.py
Run unit tests only:
pytest tests/unit/
Run integration tests only:
pytest tests/integration/
Run both suites with branch coverage:
pytest tests/ --cov=core_extensions --cov-branch --cov-report=term-missing
Or use the helper script:
python manager.py run-tests
python manager.py run-coverage
Contributing
Contributions are welcome! Please:
Fork the repository
Create a feature branch
Write tests for new functionality
Ensure all tests pass: pytest -n auto
Run linting: pylint core_extensions
Run security checks: bandit -r core_extensions
Submit a pull request
License
This project is licensed under the MIT License. See the LICENSE file for details.
Links
Documentation: https://core-extensions.readthedocs.io/en/latest/
Repository: https://gitlab.com/bytecode-solutions/core/core-extensions
Issues: https://gitlab.com/bytecode-solutions/core/core-extensions/-/issues
Changelog: https://gitlab.com/bytecode-solutions/core/core-extensions/-/blob/master/CHANGELOG.md
Support
For questions or support, please open an issue on GitLab or contact the maintainers.
Metadata
Release files for core-extensions 2.1.1
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 | |
|---|---|---|---|---|
| core_extensions-2.1.1.tar.gz | 10.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| core_extensions-2.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.8 kB
Release files / core_extensions-2.1.1.tar.gz
| Download URL | core_extensions-2.1.1.tar.gz |
|---|---|
| Size | 10.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ec91645fa033238f0d61b2a79f3dffc2050bf01507c297693c048f134c559418
|
|
BLAKE2b-256 checksum How to use checksums |
1a07cc6cf3e7c6c242b93ab265b3420044f782f85263c9c278e51f1b901cbd20
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / core_extensions-2.1.1-py3-none-any.whl
| Download URL | core_extensions-2.1.1-py3-none-any.whl |
|---|---|
| Size | 9.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
09cfffda9cbc1e91f8da2007773d9f9718e59483b14eb08897fc8e8ca34cdcf1
|
|
BLAKE2b-256 checksum How to use checksums |
478ecb352506e82bfaba63c09af9cafc285a5655b6740710cd1d7c6ad27deea9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Security for core-extensions 2.1.1
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.