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

Documentation AGPL v3 License Python Validation 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. It includes more examples and use cases, so be sure to take a look. 📚

✨ 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
    

📄 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.0.tar.gz (22.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.0-py3-none-any.whl (21.3 kB view details)

Uploaded Python 3

File details

Details for the file decoguard-0.1.0.tar.gz.

File metadata

  • Download URL: decoguard-0.1.0.tar.gz
  • Upload date:
  • Size: 22.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for decoguard-0.1.0.tar.gz
Algorithm Hash digest
SHA256 aab57dbb086421243aecbe55f61b28321d54f37d6c765f928b489915b5c208b1
MD5 4f6222988d66b9c765a7b036723f7db6
BLAKE2b-256 544f29a9d8af069aea1aa09cdf7fee9402dcbc1a13df7fb02bcc3911b1dddc83

See more details on using hashes here.

File details

Details for the file decoguard-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: decoguard-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 21.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for decoguard-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 867db164fe2b72e57784d395eb2a7b3cdbf18352b241fadb3e1ad816e80943c6
MD5 093e58457f5e9a10c07abc5754991409
BLAKE2b-256 57187036007230eb314cec71cd0644da81809b1a2b57c864fb62a90792b4e83a

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