invoicez
Tool to handle invoices. It is currently not meant to be usable directly by people finding about the package on GitHub. Please open an issue if you want more details or want to discuss this solution.
Installation
With pip:
pip install invoicez
Directory Structure
invoicez works with big assumptions on the directory structure of your presentation repository. Among those assumptions:
- your directory should be a git repository
- it should contain a jinja2 LaTeX invoice template in the
jinja2directory, with a specific name (main.tex.jinja2) - your invoice folders should be contained in an organization/company folder. This is meant to avoid repeating the company details all over the place
root (git repository)
├── global-config.yml
├── jinja2
│ ├── main.tex.jinja2
├── assets
│ ├── img
│ │ ├── logo.png
│ │ └── signature.jpg
├── company1
│ └── company-config.yml
│ ├── invoice1.yml
│ └── invoice2.yml
└── company2
└── company-config.yml
├── invoice1.yml
└── invoice2.yml
Configuration
invoicez uses two configuration files to avoid repetition, one for your details and global values, one for the details of the company you're writing the invoice for.
Configuration merging
The company config is merged into the global config, you can use that fact to override global values for a specific company.
Using the configuration values
The values obtained from the merged configurations can be used directly in Jinja2 templates, or in LaTeX after a conversion from snake case to camel case: if the configuration contains the key user_email, it will be defined as the \UserEmail command in LaTeX.
Billing trainings from Google Calendar
invoicez gcal drafts invoices from the training sessions of a Google Calendar,
and tells which sessions are billed. It only reads the calendar, through
schedz, which deckz uses too: the calendar
conventions below, the calendar_id, title_pattern and durations keys and
the Google login are schedz's.
Setup
- Install the extra:
pip install "invoicez[gcal]". - In Google Cloud, enable the Google Calendar API and create an OAuth client of
type Desktop app. Save its JSON as
client-secrets.jsonin schedz's user config directory (~/.config/schedz/on Linux). The first command opens a browser for consent; the token is cached next to it, readable by you only, and serves every tool reading the calendar through schedz. Files from an older invoicez (~/.config/invoicez/gcal-client-secrets.jsonandgcal-token.json) are moved there by the firstgcalcommand. - Add a
gcalsection tosettings.yml.invoicez migrate-config OLD --gcalprints one from an old-formatconfig.yml.
gcal:
calendar_id: someone@example.com # from `invoicez gcal calendars`
# Engagements ending before this date are never drafted.
start_date: 2020-01-01
# Verbose regex: groups continuation, company, training, place, and optionally
# extra and tentative. Titles are matched whole.
title_pattern: |
\s*
(?P<tentative> \? \s+ )?
(?P<continuation> -> \s+ )?
(?P<company> .*? ) \s+ - \s+
(?P<training> .*? ) \s+ - \s+
(?P<place> .*? )
(?: \s+ - \s+ (?P<extra> .*? ) )?
\s*
templates: # Jinja: company, training, days, start, end, n, reference
description: Facture pour {{ days }} jours de formation « {{ training.name }} ».
day_line: Journée de formation
half_day_line: Journée de formation
preparation_line: Journée de préparation
expenses_day_line: Forfait de frais de déplacement journalier
expenses_lump_sum_line: Forfait de frais de déplacement
rates:
standard: {day: 740, preparation_day: 500}
trainings: # company key of variables.yml -> training in titles -> training
orsys:
bda: {name: Big Data Analytics, rate: standard}
Optional keys: unit (DAY), output_dir (gcal-ymls/{year}) and
durations (half_day_hours: [2.5, 4], day_hours: [6, 9]). Numbers print
the French way in templates (2,5). Documents hold LaTeX, so &, %, $,
# and _ must be escaped (\&) in names and references.
Calendar conventions
- A title such as
Orsys - BDA - CV - Intra Acmeis a session; company and training are looked up insettings.ymlignoring case. -> Orsys - BDA - CV - Intra Acmecontinues the latest earlier session with the same title: together they make one engagement, billed by one invoice.? Orsys - BDA - CVis an unconfirmed booking, never billed.- All-day events count their days; timed events of 2.5 to 4 hours are half-days, of 6 to 9 hours days; others are reported, not billed.
- The description may hold YAML:
ref(the client's reference, also used in the file name),preparation_days,trainees(the number of people trained, copied to the invoice forinvoicez ledger), andinvoice(a number billed by hand).billasks for the reference and the trainees when they are missing.
Commands
invoicez gcal calendars: list your calendars and their ids.invoicez gcal status [--all]: engagements needing action (unbilled, changed since billing, billed twice, cancelled) and upcoming ones, the problems found in the calendar, and invoices whose events disappeared. Exits with 1 on an error.invoicez gcal bill [ID...] [--rebill] [--build] [--send]: drafts the unbilled engagements one at a time, after a preview and a confirmation; numbers are taken at confirmation. It asks whether there are expenses, then whether they are billed per day (aDAYline over the training days) or as a lump sum for all days (anLSline starting the day before, for the travel), and their amount.--buildalso builds the PDF and XML insendbox/,--sendsends each invoice written, asinvoicez senddoes.invoicez gcal link [--write] [--pair ID=NUMBER...]: links invoices made before by hand to their engagements, by the days they bill, so thatstart_datecan go back to the first one. Dry run without--write.
Every command takes --events FILE to read events from a JSON file instead of
Google Calendar. scripts/dump_gcal_fixture.py writes such a file, anonymised,
which is how tests/gcal/assets/events.json was made.
Building and sending invoices
Commands taking a document accept either the path of its YAML file or its
number, e.g. invoicez send 2026-10-003 or invoicez cancel 2026-10-003.
Generated files always go to the root of the repository, wherever the command
is run from:
build/: intermediate LaTeX and XML files, deleted byinvoicez clean.sendbox/: the PDFs built byinvoicez runandinvoicez gcal bill --build.archive/<company>/<year>/: the PDFs of the invoices sent, as sent.
build/ and sendbox/ are generated and can be ignored by git; archive/ is
the record of what was sent.
invoicez send DOCUMENT [--yes]: builds the invoice insendbox/, validates it with SuperPDP, previews it (buyer, electronic address, total) and sends it once confirmed. It then waits a few seconds for SuperPDP to process it and moves its PDF toarchive/, under the company of the document and the year of its date, unless SuperPDP found it invalid. It refuses an invoice whose number SuperPDP already has, unless SuperPDP found it invalid, so it is safe to run again.--yessends without asking.invoicez status [--all]: the invoices needing action, read from the repository and SuperPDP: those with a problem (invalid, rejected, refused, disputed, or failing at the administration), those the buyer's platform has not confirmed receiving two days after SuperPDP handed them over (not delivered?), those not sent yet, and those awaiting payment. Invoices dated before the first one SuperPDP has are taken as sent before it. Invoices cancelled by a credit note are left out. Exits with 1 on a problem.invoicez paid DOCUMENT... [--yes]: reports invoices sent via SuperPDP as paid in full today (fr:212, Encaissée), once confirmed. Reporting payments is the seller's job: buyers' platforms do not. Every invoice is checked before any is reported: credit notes, invoices SuperPDP does not have or found invalid, and cancelled ones are refused; those already paid are skipped.--yesreports without asking.
Expired or revoked SuperPDP tokens are renewed on the fly.
Ledger
invoicez ledger [YEAR...] [--csv] lists the invoices of the given years
(the current one by default) with their training days, trainees, amounts,
estimated social contributions and income tax, net, and sending and payment
dates: in a paid table, and a sent table for those not paid yet (credit
notes go with the invoice they cancel). A last table totals each of them and
the year. --csv writes the invoices as CSV instead.
Invoices dated before ledger.pivot_date are read from a spreadsheet kept by
hand (ledger.spreadsheet, an .ods file with one sheet per year and the
columns Facture, Entreprise, Formation, Jours, Stagiaires, HT or
Principal HT and Frais HT, TVA, Envoyée, Payée). Later ones are read
from the documents, with their sending and payment (fr:212) dates from
SuperPDP. Without a pivot date, every invoice is read from the documents.
From the documents, lines whose description matches expense_pattern
(default frais) are expenses, and lines in DAY matching
training_day_pattern (default ^Jour(née)? de (formation|certification))
count as training days. The number of trainees is the trainees key of the
document, set by invoicez gcal bill from the calendar event or by asking, or
written by hand.
Contributions take the rate in force on the invoice's date. The income tax of a year is spread over its invoices in order, each bearing what it adds at the top of the progressive scale; it assumes no other income in the household.
--forecast adds the calendar's engagements not invoiced yet (it needs a
gcal section), each priced as invoicez gcal bill would and dated when it
would be billed: once over, and not before today, so past years get none.
Below the invoices of each year, a to bill table lists those that are over,
a forecast table those to come, dimmed when tentative (booked with a ?),
and the totals table gets a row for each.
Forecasts are taxed after the invoices, from the most to the least certain.
With --csv, a forecast column tells them apart.
ledger:
pivot_date: 2026-09-01
spreadsheet: invoices.ods
contribution_rates:
2025-01-01: 0.248
2026-01-01: 0.258
income_tax:
allowance: 0.34 # micro-BNC
shares: 1
brackets: # per year of income: rate above each threshold, per share
2025: {11600: 0.11, 29579: 0.30, 84577: 0.41, 181917: 0.45}
Declarations
invoicez due shows what the payments received but not declared yet owe, in
a table per tax with a row per period: its deadline, the invoices paid during
it, what they bring excluding VAT, and what is owed. It lists every period after
the last one declared, up to the one in progress, which is dimmed.
- Social contributions (
urssaf) are owed on what was received excluding VAT, at the rate ofcontribution_ratesin force on the day of each payment. - VAT (
vat) is the VAT of the invoices paid during the period, as VAT on services is due once paid. Purchases are not deducted.
Payments are dated by the spreadsheet before the pivot date, and by their
fr:212 event after it: report them with invoicez paid the day they come in.
Credit notes have no payment date: one cancelling an invoice paid in a period
not declared yet is reported, to deduct any refund by hand.
ledger:
declarations:
urssaf:
period: monthly # or quarterly
declared_through: 2026-10-31 # move on once a period is declared
vat:
period: monthly
declared_through: 2026-10-31
due_day: 15 # of the month after the period; the last day by default
Shell completion
invoicez --install-completion installs shell completion. With zsh, it also
completes invoice numbers for run, send, cancel and paid.
Usage
See the --help flag of the invoicez command line tool.
Releasing
uv run bumpver update --minor(or--patch,--major): bumps, commits, tags and pushes.uv run doit publish: builds and uploads to PyPI with the token ofcreds.env, a gitignored file at the repository's root holding one line,export UV_PUBLISH_TOKEN=pypi-..., readable by you only (chmod 400).
Metadata
Release files for invoicez 6.1.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 |
|---|---|---|---|---|
| invoicez-6.1.0.tar.gz | 85.9 kB | Without provenance | Details for invoicez-6.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| invoicez-6.1.0-py3-none-any.whl | Python 3 | none | any | Details for invoicez-6.1.0-py3-none-any.whl |
Total release size: 187.5 kB
Release files / invoicez-6.1.0.tar.gz
| Download URL | invoicez-6.1.0.tar.gz |
|---|---|
| Size | 85.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e4c3367c47627fa200625e63651105f6757db4e69d938b30fbfa8475b7e35eb6
|
|
BLAKE2b-256 checksum How to use checksums |
4ac70817a15e9e36e7dfa6779512304f67bf8da685396445315eac05471c96f3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / invoicez-6.1.0-py3-none-any.whl
| Download URL | invoicez-6.1.0-py3-none-any.whl |
|---|---|
| Size | 101.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
75d8962747735bdc4b670f0d9dcf9cd47487447d779879f319241d74cff66795
|
|
BLAKE2b-256 checksum How to use checksums |
9a1e9348f6ee5caf30cf4b28787a22f51c60630d23b9e84595f06895ee752adb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for invoicez 6.1.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.