Extended kit and tools for pydantic, to enjoy pydantic even more!
Project description
PydKit
Extended kit and tools for pydantic, to enjoy pydantic even more!
- Github repository: https://github.com/manimozaffar/pydkit/
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:
- 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)
- 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
- 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
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
pydkit-0.0.2.tar.gz
(4.1 kB
view details)
Built Distribution
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | d27f3743dc30c4ba7add1dc3462f0096640ee874ab26921ca09a7e34ae94ff84 |
|
MD5 | f69b85bf68db2eae5fce5fa62fc1476a |
|
BLAKE2b-256 | 87426eff3c2cc73f6d4088369cc13d6cb558ff90d529c68728d6bd587eff36c6 |
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 73078d3de4533b02246e6268eb78c14e010157d6e0856a6e2dd1bb371d06aad2 |
|
MD5 | 031b7f4507fd86f4d0b9c9f86f34eba6 |
|
BLAKE2b-256 | d90d1490f781f97a136bb7cf836bcc24c3f1e139e183bf12d137fe9e2459e8a7 |