Skip to main content

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, InvoiceUpdate
  • InvoiceLine, InvoiceLineCreate
  • Client, ClientCreate, ClientUpdate
  • Payment, PaymentCreate
  • Company, CompanyCreate, CompanyUpdate
  • Product, ProductCreate, ProductUpdate
  • PaymentNote, PaymentNoteCreate, PaymentNoteUpdate
  • AuditLog

Interfaces Included

  • BaseRepository - Generic CRUD operations
  • InvoiceRepository - Invoice-specific operations
  • ClientRepository - Client management
  • PaymentRepository - Payment tracking
  • CompanyRepository - Company management
  • ProductRepository - Product catalog
  • PaymentNoteRepository - 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)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pydantic_invoices-1.1.0-py3-none-any.whl (14.1 kB view details)

Uploaded Python 3

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

Hashes for pydantic_invoices-1.1.0.tar.gz
Algorithm Hash digest
SHA256 52c5243bb41e82fef073780585931e2aecd63daa8f6af256fe0047132eb069fd
MD5 21e496aaf0261bf75217d5c0d829deaf
BLAKE2b-256 9de4e2575615391ad019978c4d334d180a986800fe3ae8acc760ff74d2485ec2

See more details on using hashes here.

File details

Details for the file pydantic_invoices-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pydantic_invoices-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 13dc3ef2860d02f45a3027bbe8197237c0b1dc2225de78a63526f5ff3dc91893
MD5 a6ffe67e7074a8ec14eca650ea6b71d4
BLAKE2b-256 064dd2e83e5f4a7c3dfc12d0013469b8fd587969e050bd77100215fe8069147b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page