Skip to main content

Library to validate localized data with pydantic

Project description

LocalizedPydantic - UNDER CONSTRUCTION

LocalizedPydantic is a Python library for validating localized data, such as Brazilian CEPs and CPFs. The library is designed to be extensible, so that other developers can contribute validation rules for their own countries.

Installation

Install with pip:

    pip install localizedpydantic

Usage

Here's an example of how to use LocalizedPydantic to validate a Brazilian CEP:

from localizedpydantic.models.brazil import CPF
from pydantic import ValidationError

try:
    cpf = CPF(cpf='123.456.789-00')
    print(cpf.cpf)  # '123.456.789-00'
except ValidationError as e:
    print(e)

try:
    cpf = CPF(cpf='12345678900')
    print(cpf.cpf)  # raises ValidationError
except ValidationError as e:
    print(e)

Contributing

Contributions are welcome! To contribute, please submit a pull request.

License

LocalizedPydantic is licensed under the MIT license

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

localizedpydantic-0.3.0.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

localizedpydantic-0.3.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file localizedpydantic-0.3.0.tar.gz.

File metadata

  • Download URL: localizedpydantic-0.3.0.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for localizedpydantic-0.3.0.tar.gz
Algorithm Hash digest
SHA256 135aa7bd8b03ed3720d493b87eeba729e43923a9b60d096277494ab8f7e6d3e9
MD5 cad5a15d4f2aa1e324eea5e13af22183
BLAKE2b-256 98a87c7a834acff19893fd876efcb8211e826fb53894b3b7e800c5602bedeb79

See more details on using hashes here.

File details

Details for the file localizedpydantic-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for localizedpydantic-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 efe6c34b57720a368de3178c7337c8af5aca352e1dc5dbfd762074f46abbe61b
MD5 d32fc6c6fe0ac7e8ef42f4cec84b26bc
BLAKE2b-256 0e03342b2e82732c30bf2f2d3c1d11f49a6d34bbe7482e26c6d75d83ebc7edb8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page