Lightweight Python library for robustly validating decorated functions, providing a clean, structured way to ensure they comply with defined conditions.
Project description
🛡️ DECOGUARD
Lightweight Python library for robustly validating decorated functions, providing a clean, structured way to ensure they comply with defined conditions.
📚 The complete documentation is available here.
✨ Features
- Meta-Decorators: Easily add validation logic to your decorators and decorator factories.
- Validator Functions: Fine-grained validation rules for function signatures and usage.
- Assertion Utilities: Reusable assertion helpers for standalone validation.
- Centralized Validation: Keep your validation logic clean and maintainable.
- Clear Error Reporting: Developer-friendly exceptions for invalid decorator usage.
- Drop-In Simplicity: Integrate with existing Python code with minimal changes.
🚀 Getting Started
- Install decoguard
pip install decoguard
- Import and use meta-decorators
from decoguard.decorators import validate_decorated from decoguard.validators import require_params @validate_decorated(require_params("x", "y")) def my_decorator(func): return func @my_decorator def correct_usage(x, y): pass @my_decorator def bad_usage(x): pass # Will raise DecoratorUsageValidationError
💚 CI/CD Pipeline
This project maintains high code quality through automated GitLab CI/CD pipelines that run on every merge request and main branch commit:
Quality Assurance
- Code Testing: Comprehensive test suite using
toxandpytestwith coverage reporting - Code Formatting: Automated formatting with
blackand import sorting withisort - Code Style: Style checking with
flake8following project standards - Type Checking: Static type analysis using
mypyfor type safety - Security Scanning:
- Dependency vulnerability checks with
safety - Code security analysis with
bandit(excluding test files)
- Dependency vulnerability checks with
Deployment
- Automated Building: Package building and integrity validation
- PyPI Deployment: Automatic deployment to PyPI on tagged releases
- Manual Release: Production deployments require manual approval for safety
The same quality checks can be run locally using the included format_and_check.py script.
📄 License
This project is licensed under the GNU Affero General Public License v3.0. See LICENSE 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 decoguard-0.1.1.tar.gz.
File metadata
- Download URL: decoguard-0.1.1.tar.gz
- Upload date:
- Size: 27.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4730c17b2d1f44d08242152de18332653dd6831e6d9d4c6cc9ddfe27c0ae187c
|
|
| MD5 |
b7f76020eb1f52fd039986a0ddfc17ff
|
|
| BLAKE2b-256 |
6a9d2f52bab475f7a90e81143b9017130c0499e431c4ac0f65fa47e17fcd022f
|
File details
Details for the file decoguard-0.1.1-py3-none-any.whl.
File metadata
- Download URL: decoguard-0.1.1-py3-none-any.whl
- Upload date:
- Size: 21.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d7b01c66b238027724e409ab8c77ff294e084fdbf8f41fe2c56da1f8dc41d3b
|
|
| MD5 |
6c22dc2999ed5391bc2aae1e2f097313
|
|
| BLAKE2b-256 |
28565a5caac191f39c96ecef9c001b4eae4dc11b93da9c1681afcad76178135e
|