Skip to content

Invoice pack — Reference

Every module in packs/invoice/, and where it is covered in depth.

Module Purpose Covered in
__init__.py InvoicePack — implements DocumentPack. Overview
sampler.py InvoiceSampler — the pack's DocumentSource; per-index deterministic invoice generation. Generation
record.py GoldenInvoice + parts: Party, LineItem, PricingTier, TaxBucket, InvoiceTotals, RenderProfile. Generation
context.py Golden invoice → Jinja context (build_context). Generation
catalog.py Catalogue / CompanyRoster / Company / ProductTemplate; SeedCatalogue; derive_identity. Content
procedural.py Key-free combinatorial catalogue; generate_company[_range]. Content
llm_build.py LLM overlay: prompt, parse, price-band coercion, procedural fallback. Content
build_run.py Distributed catalogue build = a run over company ranges (build_catalogue_run). Catalogue building
artifact.py Versioned artifact: per-company Parquet, decimal128, sha256, sharded read/write, manifest. Content
validation.py Quality + PII gates on catalogue content. Content
composition.py Resolve a Selection against the roster; constraint validation. Composition
enums.py BusinessType, BillingModel, LineItemKind, UsageUnit, DiscountScheme, … this page
jurisdictions.py Tax model, currency, mandatory issuer fields per jurisdiction. Composition
labels.py Printed label dictionaries per locale. Rendering
handwriting.py Handwriting params (fonts, jitter) for the handwritten pad. Rendering
logos.py Procedural key-free brand marks + watermark. Rendering
stamps.py Procedural company seals/stamps. Rendering
templates/ _base, _macros, _styles, and 7 archetypes. Rendering

Vocabularies (enums.py)

  • BusinessTyperetail, ecommerce, grocery, wholesale, auto_repair, construction, manufacturing, b2b_saas, ai_platform, telecom, accounting, legal, consulting, healthcare, logistics, utilities.
  • BillingModelflat_rate, per_unit, graduated_tier, volume_tier, metered_usage, subscription, seat_based, hourly_labour, milestone, interest.
  • LineItemKind, UsageUnit, DiscountScheme — the line-item and pricing vocabularies the sampler draws from.

The kernel vocabularies a pack shares (Jurisdiction, DocumentCondition, RunState, WorkUnitState) live in core/enums.py — see Core → Locale / render / money / logging.