Готовые модели pydantic для частых задач
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-sqlitepath- путь до БД
AnyDB
type-anystr- строка подключения для sqlalchemy
Mysql
type-mysqlилиmariadbhost- хостport- порт (по умолчанию: 3306)login/password- данные для авторизацииencoding- кодировка (по умолчанию:utf8mb4)database- имя БД
DB
connect_str()- возвращает строку подключения для sqlalchemy или sqlalchemy.URLsetup()- настраивает 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pydantic_extra-1.0.2.tar.gz.
File metadata
- Download URL: pydantic_extra-1.0.2.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a79afa8ed84f5ef751e5f9b578ce6e66cbd1cc7df2bc8b53c7b4fdb80b3377a
|
|
| MD5 |
5883727d07108f1564c91c1f24cb74c2
|
|
| BLAKE2b-256 |
6c6f56475dfc86cfd0be746f5fc27e08059c207564174e8a1eee18b1bb610d30
|
Provenance
The following attestation bundles were made for pydantic_extra-1.0.2.tar.gz:
Publisher:
release.yml on zedzhen/pydantic-extra
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pydantic_extra-1.0.2.tar.gz -
Subject digest:
1a79afa8ed84f5ef751e5f9b578ce6e66cbd1cc7df2bc8b53c7b4fdb80b3377a - Sigstore transparency entry: 1640954842
- Sigstore integration time:
-
Permalink:
zedzhen/pydantic-extra@a4e74a2f1cd8c59c6c5390e4a604bc22cb2396cd -
Branch / Tag:
refs/tags/v1.0.2 - Owner: https://github.com/zedzhen
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a4e74a2f1cd8c59c6c5390e4a604bc22cb2396cd -
Trigger Event:
release
-
Statement type:
File details
Details for the file pydantic_extra-1.0.2-py3-none-any.whl.
File metadata
- Download URL: pydantic_extra-1.0.2-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b46d2815c1bee90cc1b8fbf9fba9a290e9cfad25b68bf13607f1eb8217edd4d
|
|
| MD5 |
0900dcb1c0081984597241d70c24e373
|
|
| BLAKE2b-256 |
aceeb0f21610be6c27c8fb7c1dd83757e7c1faf6baa7e6bc601a19d4d00aba7d
|
Provenance
The following attestation bundles were made for pydantic_extra-1.0.2-py3-none-any.whl:
Publisher:
release.yml on zedzhen/pydantic-extra
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pydantic_extra-1.0.2-py3-none-any.whl -
Subject digest:
4b46d2815c1bee90cc1b8fbf9fba9a290e9cfad25b68bf13607f1eb8217edd4d - Sigstore transparency entry: 1640955065
- Sigstore integration time:
-
Permalink:
zedzhen/pydantic-extra@a4e74a2f1cd8c59c6c5390e4a604bc22cb2396cd -
Branch / Tag:
refs/tags/v1.0.2 - Owner: https://github.com/zedzhen
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a4e74a2f1cd8c59c6c5390e4a604bc22cb2396cd -
Trigger Event:
release
-
Statement type: