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.0.0.tar.gz (51.0 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.0.0-py3-none-any.whl (14.0 kB view details)

Uploaded Python 3

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

Hashes for pydantic_invoices-1.0.0.tar.gz
Algorithm Hash digest
SHA256 54fe8e5b9d72e80a10fd0802b6d1c459d20c6d244bee265222b0c652ade63131
MD5 8806b7458b8d65be066218a35775dd71
BLAKE2b-256 41c66e385d524909cb45cbb91503202d8da1741978a43ce153ff834f5bbbc5c1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pydantic_invoices-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 431db0b8f12020555eff43c624303471909adb2f3ade6c22d7413cf448a6b480
MD5 8d94ac76cf7333cb3ad76f7d0f896460
BLAKE2b-256 743441078e6cade4aa91da5ce36b3e48c2dc6d79248c862aee224272c3f0ceaa

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