Skip to main content

lintvoice checks your e-invoices against official rules and standards

Lire en français

It starts with the European standard, then adds each country's own rules. It works offline: your invoices are never sent anywhere. Today it runs:

  • EN 16931 (the European e-invoicing standard), for CII and UBL;
  • Factur-X 1.09.2 profile rules, for Factur-X PDFs;
  • BR-FR, the French reform rules published by FNFE-MPE (France_RFE), when the seller is in France.

lintvoice reads CII XML, UBL XML (invoices and credit notes) and Factur-X / ZUGFeRD PDFs. Results are grouped by rule (e.g. one missing VAT number shows up once, not for every faulty invoice line).

Status: 0.2.0. Options and the JSON output may still change before 1.0.

Quick start

uvx lintvoice rules install      # once: downloads the pinned rule packs
uvx lintvoice check invoice.pdf
uvx lintvoice check invoices/ --format json

Or pip install lintvoice (Python 3.10 or later). Each release also ships its wheel and sdist on GitHub Releases, if PyPI is out of reach: pip install lintvoice-<version>-py3-none-any.whl.

In a container, with the rule packs inside the image:

docker build -t lintvoice .      # after `uv build`, from a checkout
docker run --rm -v "$PWD:/work" lintvoice check invoices/

The image runs as an unprivileged user (UID 10001).

✗ demo.pdf
  Factur-X EN 16931 · CII · PDF (factur-x.xml)
  BR-FR rules applied: the seller's country is FR.
  7 errors in 6 rules.

  error   BR-FR-16_BT-152  ×2
    BT-152: Le taux de TVA (BT-152) doit être exprimé en pourcentage … Taux fourni : "21".
    at /CrossIndustryInvoice/SupplyChainTradeTransaction/IncludedSupplyChainTradeLineItem/… (+1 more)

The values behind an error

For the totals and VAT rules (BR-CO-10 to 17, BR-S-08 and BR-S-09), lintvoice shows the computation with the invoice's own values:

  error   BR-CO-15  ×1
    1025.00 (BT-109) + 205.00 (BT-110) = 1230.00; the invoice states 1231.00 (BT-112), a gap of 1.00

A rule checked for each VAT rate shows the rate that fails:

  error   BR-CO-17  ×1
    At the rate 20 % (S): 1025.00 (BT-116) × 20 % (BT-119) = 205.00; the invoice states 207.00
    (BT-117), a gap of 2.00

In JSON, each file carries values: the business terms read from the invoice (terms, with the identifier schemes given), its lines, its notes, its vat_breakdown and its document level allowances and charges. A failing totals or VAT rule carries computation: its parts, the expected and stated amounts, the gap and, for a rule checked for each VAT rate, the VAT breakdown that fails (group). Where each business term is read, in CII and UBL, is data: src/lintvoice/terms.json.

One rule

--rule ID answers for one business rule (several --rule may be given): the rule fails, finds no error, does not apply to the invoice (and why), or could not be checked. The full rule sets run as usual; the answer reads that rule only, and the other rules' errors are summed up in one line:

lintvoice check --rule BR-CO-15 invoice.pdf
  BR-CO-15: fails
  ...
  Other rules: no errors.

Whether a rule applies comes from the official files: each one reports the rule contexts that fired on the invoice, and each rule sits in one context. A rule does not apply when the French rules do not run (the seller is not in France), when it exists only for the other syntax (CII or UBL) or for another invoice profile, or when the invoice does not hold what it checks. In JSON, each file carries rules: for each rule asked, its answer (fails, warns, no-error, does-not-apply, not-checked) and, when it does not apply, the reason (seller-not-in-france, other-syntax, other-profile, not-in-invoice).

Rule packs: what lintvoice downloads, and why

lintvoice ships no rule files. lintvoice rules install downloads each pack once, from its upstream source, at a pinned version:

  • What: the official validation artefacts: Schematron sources, the XSLT compiled from them, and the XML schemas.
  • Why: you get the exact official rules, under their own licences. lintvoice follows the official releases instead of rewriting rules.
  • When:
    • only when you run lintvoice rules install;
    • never when the package is installed or imported, and never during a check;
    • after that, every check runs offline.
  • How it is checked:
    • over https only;
    • the EN 16931 archives against their SHA-256;
    • France_RFE, which GitHub archives on the fly, against a SHA-256 of the 207 files kept;
    • a changed file, or an archive entry outside the pack folder, stops the install.
  • Not downloaded into the packs: France_RFE's folders that hold AFNOR documents (Z.notes_&_docs/, Z.example/) are never extracted.
  • No other network use: a checked file cannot make lintvoice fetch anything, since a file that declares a DOCTYPE is refused.
Pack Version Source Licence
EN 16931 validation artefacts 1.3.17 ConnectingEurope/eInvoicing-EN16931 (SHA-256 pinned) EUPL-1.2
France_RFE (BR-FR, Factur-X 1.09.2) 1.4.0.04 fnfempe/France_RFE @ 97ba0f3 (content SHA-256 pinned) Apache-2.0 (repository), EUPL (file headers)

Packs go to ~/.cache/lintvoice/rules (or $XDG_CACHE_HOME, $LINTVOICE_RULES_DIR, --rules-dir). lintvoice rules list shows what is installed.

What runs on which file

File Schema Rules
Factur-X PDF, or CII with a Factur-X profile id Factur-X 1.09.2 (BASIC WL, EN 16931, EXTENDED) EN 16931 (except MINIMUM, BASIC WL), Factur-X profile rules, BR-FR (except MINIMUM)
CII XML with urn:cen.eu:en16931:2017 CII D22B EN 16931, BR-FR
UBL invoice or credit note UBL 2.1 EN 16931, BR-FR
  • BR-FR runs when the seller's country (BT-40) is FR. --rules en16931,factur-x,br-fr forces it, --rules en16931 limits the check to EN 16931.
  • A bare CII XML gets the Factur-X profile rules only when asked (--rules …,factur-x), since urn:cen.eu:en16931:2017 is also plain CII.

Exit codes

Code Meaning
0 No errors (warnings do not change the exit code)
1 At least one file has errors
2 A file could not be read as an invoice, or no file was found
3 Rule packs are not installed
4 No errors found, but a rule set could not run on a file: its official rule file stopped with an error. The check is incomplete, so lintvoice does not say "no errors"

With --rule, the codes speak of the rules asked: 1 when one of them fails, 4 when one of them could not be checked.

Not checked yet

  • PDF/A-3 validation of Factur-X PDFs (needs veraPDF).
  • XRechnung and Peppol BIS rules: those invoices get EN 16931 only, and the report says so.
  • Factur-X MINIMUM and BASIC profile rules: France_RFE 1.4.0.04 does not ship them.
  • Chorus Pro's own rules for its historic channels.
  • BR-FR messages are in French, as FNFE-MPE writes them.

Development

uv sync
uv run pytest            # functional tests; the first run downloads the packs into .rules-cache/
uv run pytest -m corpus  # only the official EN 16931 examples

The tests drive the command line on generated invoices (tests/invoices.py) and on the official examples. They check that:

  • checks never touch the network;
  • France_RFE's AFNOR documents are never installed.

Licence

The code is under the MIT licence. The rule packs keep their own licences (table above) and are not part of this package. The Docker image bundles third-party components: see THIRD_PARTY_NOTICES.md.

Metadata

Release files for lintvoice 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lintvoice 0.4.0
File Size Uploaded Provenance Actions
lintvoice-0.4.0.tar.gz 56.8 kB With provenance Details for lintvoice-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for lintvoice 0.4.0
File Interpreter ABI Platform Actions
lintvoice-0.4.0-py3-none-any.whl Python 3 none any Details for lintvoice-0.4.0-py3-none-any.whl

Total release size: 87.1 kB

Release files / lintvoice-0.4.0.tar.gz

Download URL lintvoice-0.4.0.tar.gz
Size 56.8 kB
Tags Source
SHA-256 checksum
How to use checksums
b9d1bab83854d593a7d1e9bd7c3723926feade8be22c3707da4a08d1eaed0971
BLAKE2b-256 checksum
How to use checksums
29c90456a251a2718edf43812f96253f7afc77ae29a47de07c87d68221bd8218
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Release files / lintvoice-0.4.0-py3-none-any.whl

Download URL lintvoice-0.4.0-py3-none-any.whl
Size 30.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
10c6566a98bb574e684c00c74d3c306783c65ff7cdaa9e613d097a35c69eef14
BLAKE2b-256 checksum
How to use checksums
eddcb67f4a7021ae90b96d7ff03b8d177320568384b2f469f8a7d94ccb4b9162
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Security for lintvoice 0.4.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for lintvoice-0.4.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page