Skip to main content

Custom types for pydantic used in SRE peipelins for validation input vars

Project description

pydantic custom types

A collection of custom types for pydantic
https://github.com/pydantic/pydantic

Useful for validation input parameters for infrastructure pipelines when building kubernetes apps/clusters

Requirements

python >= 3.10

Installation

pip install pydantic-custom-types

Examples

from pydantic import BaseModel
from pydantic_custom_types.kubernetes import NamespaceName, SecretName

class K8sNamespace(BaseModel):
    # These string types only allow: lowercase/numbers/dash, cannot start with dash/number
    # NamepaceName has linit at 63 characters
    # SecretName has linit at 63 characters
    name: NamespaceName 
    secret_name: SecretName

# will pass
K8sNamespace(
    name="my-namespace",
    secret_name="my-secret"
)

# will not pass
K8sNamespace(
    name="-0mynameSpace",
    secret_name="0mysecret"
)

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

pydantic_custom_types-0.2.2.tar.gz (4.6 kB view hashes)

Uploaded Source

Built Distribution

pydantic_custom_types-0.2.2-py3-none-any.whl (8.5 kB view hashes)

Uploaded Python 3

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