Skip to main content

Validate Python objects with schema definitions. Perfect for API validation.

Project description

pyvalidator

Validate Python objects

Installation

pip install pyvalidator

💡 Usage Examples

Basic Operations

from pylib_validator import Schema, validate

# Define validation schema
schema = Schema({
    "name": lambda x: isinstance(x, str) and len(x) > 0,
    "age": lambda x: isinstance(x, int) and 0 < x < 150,
    "email": lambda x: "@" in str(x)
})

# Validate data
data = {"name": "John", "age": 30, "email": "john@example.com"}
is_valid, errors = validate(data, schema)
# (True, [])

AI/ML Use Cases

from pylib_validator import Schema, validate

# Validate ML model inputs
input_schema = Schema({
    "features": lambda x: isinstance(x, list) and len(x) > 0,
    "model_type": lambda x: x in ["classification", "regression"]
})
is_valid, errors = validate(model_input, input_schema)

📚 API Reference

See package documentation for complete API reference.

🤖 AI Agent Friendly

This package is optimized for AI agents and code generation tools:

  • Clear function names and signatures
  • Comprehensive docstrings with examples
  • Type hints for better IDE support
  • Common use cases documented
  • Zero dependencies for reliability

License

MIT

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

pylib_validator-0.1.0.tar.gz (2.3 kB view details)

Uploaded Source

Built Distribution

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

pylib_validator-0.1.0-py3-none-any.whl (2.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pylib_validator-0.1.0.tar.gz
  • Upload date:
  • Size: 2.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for pylib_validator-0.1.0.tar.gz
Algorithm Hash digest
SHA256 badc867077975fa1e8ec8212e9403b284055563c8471ed75567c7d61ffe4540d
MD5 ccaad547f8cf82eaf9db92254be26b5f
BLAKE2b-256 644023849296ddcc91f8c64687a0b4dbadf6261a20b03574d75202d6c4eec43c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pylib_validator-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4fddd3e798062e08adca39b650b4ac72565e9371d765c1218388dd70b2fd4c58
MD5 222487ab3c1b4b48d270c7b98f4cf4d1
BLAKE2b-256 5f34b828dac8a81287c2f9d3c43f0c26437713d8aacdbcfa04f00fe8c00fd702

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