Skip to main content

Lightweight Python library for robustly validating decorated functions, providing a clean, structured way to ensure they comply with defined conditions.

Project description

decoguard logo

🛡️ DECOGUARD

Latest Release Pipeline Status Coverage Report Documentation AGPL v3 License Python Made with Love

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

  1. Install decoguard
    pip install decoguard
    
  2. 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 tox and pytest with coverage reporting
  • Code Formatting: Automated formatting with black and import sorting with isort
  • Code Style: Style checking with flake8 following project standards
  • Type Checking: Static type analysis using mypy for type safety
  • Security Scanning:
    • Dependency vulnerability checks with safety
    • Code security analysis with bandit (excluding test files)

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


Download files

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

Source Distribution

decoguard-0.1.1.tar.gz (27.9 kB view details)

Uploaded Source

Built Distribution

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

decoguard-0.1.1-py3-none-any.whl (21.8 kB view details)

Uploaded Python 3

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

Hashes for decoguard-0.1.1.tar.gz
Algorithm Hash digest
SHA256 4730c17b2d1f44d08242152de18332653dd6831e6d9d4c6cc9ddfe27c0ae187c
MD5 b7f76020eb1f52fd039986a0ddfc17ff
BLAKE2b-256 6a9d2f52bab475f7a90e81143b9017130c0499e431c4ac0f65fa47e17fcd022f

See more details on using hashes here.

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

Hashes for decoguard-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9d7b01c66b238027724e409ab8c77ff294e084fdbf8f41fe2c56da1f8dc41d3b
MD5 6c22dc2999ed5391bc2aae1e2f097313
BLAKE2b-256 28565a5caac191f39c96ecef9c001b4eae4dc11b93da9c1681afcad76178135e

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