Skip to main content

Extended kit and tools for pydantic, to enjoy pydantic even more!

Project description

PydKit

Release Build status codecov Commit activity License

Extended kit and tools for pydantic, to enjoy pydantic even more!

Contribution

I'll work on this library in few months, i don't have free time right now, but feel free to contribute. I'll check and test the PRs myself!

Features

Use case of CSV read/write would be:

  1. Saving to a CSV file
from pydkit import csv
from pydantic import BaseModel

class User(BaseModel):
    id: int
    name: str

users = [
    User(id=1, name="Alice"),
    User(id=2, name="Abbas"),
]
csv.save("file.csv", users)
  1. Reading from a CSV file
from pydkit.csv import read, StrNone
from pydantic import BaseModel

class User(BaseModel):
    id: int
    name: str
    last_name: None | StrNone = None
    # StrNone helps you with reading from csv files!

users = csv.read("file.csv", User) # now user is list of User
  1. Type extensions -> Auto converter types
from pydkit.timezones import UTCTime

class User(BaseModel):
    created_at: UTCTime

now if you use this model, it'll convert timezones to UTC automatically in your FastAPI application or else, you can also write custom validation

from pydkit.timezones import UTCBiggerThanNow

class User(BaseModel):
    future_ts: UTCBiggerThanNow

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

pydkit-0.0.2.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

pydkit-0.0.2-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file pydkit-0.0.2.tar.gz.

File metadata

  • Download URL: pydkit-0.0.2.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.6 Linux/6.2.0-1016-azure

File hashes

Hashes for pydkit-0.0.2.tar.gz
Algorithm Hash digest
SHA256 d27f3743dc30c4ba7add1dc3462f0096640ee874ab26921ca09a7e34ae94ff84
MD5 f69b85bf68db2eae5fce5fa62fc1476a
BLAKE2b-256 87426eff3c2cc73f6d4088369cc13d6cb558ff90d529c68728d6bd587eff36c6

See more details on using hashes here.

File details

Details for the file pydkit-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: pydkit-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.6 Linux/6.2.0-1016-azure

File hashes

Hashes for pydkit-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 73078d3de4533b02246e6268eb78c14e010157d6e0856a6e2dd1bb371d06aad2
MD5 031b7f4507fd86f4d0b9c9f86f34eba6
BLAKE2b-256 d90d1490f781f97a136bb7cf836bcc24c3f1e139e183bf12d137fe9e2459e8a7

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