Pydantic schemas and repository interfaces for invoice management
Project description
Pydantic Invoices
Type-safe Pydantic schemas and repository interfaces for invoice management systems.
Installation
pip install pydantic-invoices
# or
uv add pydantic-invoices
Usage
Using Schemas
from pydantic_invoices import Invoice, InvoiceCreate, Client, ClientCreate
from datetime import datetime
# Create invoice data
invoice_data = InvoiceCreate(
number="INV-001",
client_id=1,
company_id=1,
issue_date=datetime.now(),
due_date=datetime.now(),
status="UNPAID",
payment_terms="Net 30",
lines=[],
)
# Validate and use
invoice = Invoice(id=1, **invoice_data.model_dump())
Implementing Repository Interfaces
from pydantic_invoices.interfaces import InvoiceRepository, ClientRepository
from pydantic_invoices import Invoice, InvoiceCreate, Client
class MyInvoiceRepo(InvoiceRepository):
def create(self, entity: InvoiceCreate) -> Invoice:
# Your implementation
pass
def get_by_id(self, id: int) -> Invoice | None:
# Your implementation
pass
# ... implement other methods
Features
- ✅ Type-safe Pydantic v2 schemas
- ✅ Repository pattern interfaces
- ✅ No implementation dependencies
- ✅ Fully typed with mypy support
- ✅ Clean separation of concerns
Schemas Included
Invoice,InvoiceCreate,InvoiceUpdateInvoiceLine,InvoiceLineCreateClient,ClientCreate,ClientUpdatePayment,PaymentCreateCompany,CompanyCreate,CompanyUpdateProduct,ProductCreate,ProductUpdatePaymentNote,PaymentNoteCreate,PaymentNoteUpdateAuditLog
Interfaces Included
BaseRepository- Generic CRUD operationsInvoiceRepository- Invoice-specific operationsClientRepository- Client managementPaymentRepository- Payment trackingCompanyRepository- Company managementProductRepository- Product catalogPaymentNoteRepository- Payment instructions
License
MIT
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_invoices-1.1.0.tar.gz
(51.1 kB
view details)
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_invoices-1.1.0.tar.gz.
File metadata
- Download URL: pydantic_invoices-1.1.0.tar.gz
- Upload date:
- Size: 51.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
52c5243bb41e82fef073780585931e2aecd63daa8f6af256fe0047132eb069fd
|
|
| MD5 |
21e496aaf0261bf75217d5c0d829deaf
|
|
| BLAKE2b-256 |
9de4e2575615391ad019978c4d334d180a986800fe3ae8acc760ff74d2485ec2
|
File details
Details for the file pydantic_invoices-1.1.0-py3-none-any.whl.
File metadata
- Download URL: pydantic_invoices-1.1.0-py3-none-any.whl
- Upload date:
- Size: 14.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
13dc3ef2860d02f45a3027bbe8197237c0b1dc2225de78a63526f5ff3dc91893
|
|
| MD5 |
a6ffe67e7074a8ec14eca650ea6b71d4
|
|
| BLAKE2b-256 |
064dd2e83e5f4a7c3dfc12d0013469b8fd587969e050bd77100215fe8069147b
|