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 pydantic_invoices.schemas import InvoiceStatus, InvoiceType
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=InvoiceStatus.DRAFT,
type=InvoiceType.STANDARD,
payment_terms="Net 30",
lines=[],
)
# Validate and use
invoice = Invoice(id=1, **invoice_data.model_dump())
Invoice Statuses & Types
The library supports a strict state machine workflow:
- Statuses:
DRAFT,SENT,PAID,PARTIALLY_PAID,CANCELLED,REFUNDED,CREDITED. - Types:
STANDARD,CREDIT_NOTE. - Linking:
Credit Notescan be linked to original invoices viaoriginal_invoice_id.
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
Architecture
See System Diagram for a visual overview of the entities and their relationships.
Features
- ✅ Type-safe Pydantic v2 schemas
- ✅ Repository pattern interfaces
- ✅ No implementation dependencies
- ✅ Fully typed with mypy support
- ✅ Clean separation of concerns
- ✅ Support for Credit Notes and Strict Lifecycle
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
Metadata
Release files for pydantic-invoices 1.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pydantic_invoices-1.5.0.tar.gz | 18.8 kB | Without provenance | Details for pydantic_invoices-1.5.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pydantic_invoices-1.5.0-py3-none-any.whl | Python 3 | none | any | Details for pydantic_invoices-1.5.0-py3-none-any.whl |
Total release size: 38.5 kB
Release files / pydantic_invoices-1.5.0.tar.gz
| Download URL | pydantic_invoices-1.5.0.tar.gz |
|---|---|
| Size | 18.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2ef8ebf2505e38652fb28b91b41fa2754e3cbb83d8738e3b4a71a5303017581a
|
|
BLAKE2b-256 checksum How to use checksums |
a2613b178fe658e7b45f1e9b1a4cbff0a02a615c90434ea35e9e00c477205cfd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.20 {"installer":{"name":"uv","version":"0.12.20","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / pydantic_invoices-1.5.0-py3-none-any.whl
| Download URL | pydantic_invoices-1.5.0-py3-none-any.whl |
|---|---|
| Size | 19.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
71ff54374def5bdf9f1f9a944754724a1cf780f799a4063341cec0e53f1d9cff
|
|
BLAKE2b-256 checksum How to use checksums |
f14adde94b43aa8aff31285a35ced30ed39dcd16420ce8c2ee148735ca39d667
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.20 {"installer":{"name":"uv","version":"0.12.20","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for pydantic-invoices 1.5.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.