Skip to main content

Готовые модели pydantic для частых задач

Reason this release was yanked:

incorrect dependencies version

Project description

pydantic-extra

Данный модуль содержит готовые модели pydantic для частых задач.

установка pip install pydantic-extra

pydantic-extra.smtp

модель MailServer

  • smtp_host - хост
  • smtp_port - порт (по умолчанию: 465)
  • smtp_ssl - использовать ssl (по умолчанию: True)
  • smtp_login/smtp_password - данные для авторизации
  • from_addr - имя отправителя (по умолчанию: smtp_login)

pydantic-extra.db

Требует дополнительные зависимости db (sqlalchemy)
pip install pydantic-extra[db]

модели DB(базовая модель), SQLite, Mysql(в т.ч. для MariaDB), AnyDB

SQLite

  • type - sqlite
  • path - путь до БД

AnyDB

  • type - any
  • str - строка подключения для sqlalchemy

Mysql

  • type - mysql или mariadb
  • host - хост
  • port - порт (по умолчанию: 3306)
  • login/password - данные для авторизации
  • encoding - кодировка (по умолчанию: utf8mb4)
  • database - имя БД

DB

  • connect_str() - возвращает строку подключения для sqlalchemy или sqlalchemy.URL
  • setup() - настраивает sqlalchemy для работы с данным диалектом

использование

from pydantic import BaseModel, Field
from pydantic_extra.db import T_DB


class ExampleConfig(BaseModel):
    db: T_DB = Field(discriminator='type')

С базой данной SQLite по умолчанию

from pathlib import Path

from pydantic import BaseModel, Field
from pydantic_extra.db import T_DB, SQLite


class ExampleConfig(BaseModel):
    db: T_DB = Field(SQLite(type="sqlite", path=Path('example.sqlite')), discriminator='type')

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_extra-1.0.1.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

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

pydantic_extra-1.0.1-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file pydantic_extra-1.0.1.tar.gz.

File metadata

  • Download URL: pydantic_extra-1.0.1.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pydantic_extra-1.0.1.tar.gz
Algorithm Hash digest
SHA256 70da769ae601cc1b439bb4a90c584a6397cbbcf5d2895ba86a14986dd1a7800e
MD5 87d3df77dd23ed8e8680b85f87b5c916
BLAKE2b-256 bd77997cb97b187afe9d40c1f474e735555019e61dc9f873b8c6b7aa3209723b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydantic_extra-1.0.1.tar.gz:

Publisher: release.yml on zedzhen/pydantic-extra

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pydantic_extra-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: pydantic_extra-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pydantic_extra-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 112a1e1dd3c569e48f33aaf1321c4a18f83c1def7e5fbd5f9bc6736538b8f342
MD5 23148d2a50a52f0a2c2e7bcb47418559
BLAKE2b-256 4ff82b23705a666041e2c5734bdc85619745380e170eb58304c5bc6ffb8ec01c

See more details on using hashes here.

Provenance

The following attestation bundles were made for pydantic_extra-1.0.1-py3-none-any.whl:

Publisher: release.yml on zedzhen/pydantic-extra

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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