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.0.0.tar.gz
(51.0 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.0.0.tar.gz.
File metadata
- Download URL: pydantic_invoices-1.0.0.tar.gz
- Upload date:
- Size: 51.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
54fe8e5b9d72e80a10fd0802b6d1c459d20c6d244bee265222b0c652ade63131
|
|
| MD5 |
8806b7458b8d65be066218a35775dd71
|
|
| BLAKE2b-256 |
41c66e385d524909cb45cbb91503202d8da1741978a43ce153ff834f5bbbc5c1
|
File details
Details for the file pydantic_invoices-1.0.0-py3-none-any.whl.
File metadata
- Download URL: pydantic_invoices-1.0.0-py3-none-any.whl
- Upload date:
- Size: 14.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
431db0b8f12020555eff43c624303471909adb2f3ade6c22d7413cf448a6b480
|
|
| MD5 |
8d94ac76cf7333cb3ad76f7d0f896460
|
|
| BLAKE2b-256 |
743441078e6cade4aa91da5ce36b3e48c2dc6d79248c862aee224272c3f0ceaa
|