pytaxel is a Python port of the Rust eBilanz toolkit
taxel. It aims to bring the same
CSV-driven workflows to Python, reusing taxel’s templates, mappings and
test data, and adding a web UI on top of a CLI.
- Reuses templates, mappings, and test data from
taxel(vendored in this repo undertaxel/), - uses the external ERiC binding library
eric-py(eric_py) to talk to the official ERiC C API, and - exposes CLI and web entry points for CSV→eBilanz→ERiC workflows.
The Rust project taxel has already done a lot of groundwork by providing a
CSV-based workflow: users can interact with eBilanz data via relatively simple
CSV files instead of editing XBRL/XML directly. pytaxel is a Python port of
these ideas, with an additional web UI on top of the CLI. The implementation is
still under active development.
A substantial portion of this repository was created using agentic-coding
workflows with OpenAI GPT 5.1, guided by the plans in agents_plan.md and the
prompt structures in prompts.md, and then iterated with manual review.
This setup is currently tested primarily with ERiC 41.6.2.0 on Linux
(ERiC-41.6.2.0/Linux-x86_64). Other ERiC versions may work but should be
verified carefully in your own environment.
eBilanz is the electronic balance sheet format used in Germany to submit annual financial statements to the tax authorities. Technically it is a large XBRL taxonomy (with GCD and GAAP/CI parts) with strict rules about:
- which fields are required in which situations,
- how contexts (periods, instants) and units (currencies) must be modeled,
- how signs, aggregations, and consistency checks work, and
- how the XML must be packaged, validated, and transmitted via ERiC.
For most users this is complex and tedious: you need to map local charts of
accounts (e.g. SKR03) to taxonomy positions, generate valid XBRL with all
contexts/units, and then pass it through ERiC for validation and submission.
pytaxel aims to hide most of that complexity behind reusable templates,
mappings, and a small set of CLI/web commands.
- CSV export from bookkeeping → internal eBilanz domain model → populate XBRL/XML via templates/mappings (reusing
taxel/templates,taxel/mappings,taxel/test_data) → validate → optional send/print. - ERiC path: load
libericapi.soand plugins fromERiC/Linux-x86_64(configurable via env likeERIC_HOME), and use the externaleric-py(eric_py) library to callEricBearbeiteVorgangfor validate/send, with printable PDF via ERiC’s druck parameters. - Python layout:
pytaxel/ebilanz(CSV→model→XBRL logic mirroring Rust taxel),pytaxel/cli(commands matching taxel CLI for generate/validate/send/preview),pytaxel/web(web API), plus the separateeric-pyproject providing the ERiC bindings. - Workflow alignment: mirror Rust
taxelcommands and data expectations so fixtures/templates stay shared; keep raw ctypes isolated insideeric-pyand surface high-level helpers to CLI/web layers. - Security/paths: certificates and PINs supplied via CLI/env (no repo storage), manufacturer ID placeholder only for tests; logging directed to user-specified directory alongside ERiC log output.
- Extract CSV from XML:
pytaxel extract --xml-file taxel/test_data/taxonomy/v6.5/sample_expected.xml --output-file /tmp/out.csv(defaults to current dir if not given). - Generate XML:
pytaxel generate --csv-file taxel/test_data/taxonomy/v6.5/sample.csv --template-file taxel/templates/elster_v11/taxonomy_v6.5/ebilanz.xml --output-file /tmp/ebilanz.xml(--csv-fileoptional; defaults to current dir for output). - Validate XML:
pytaxel validate --xml-file /tmp/ebilanz.xml --tax-type Bilanz --tax-version 6.5 --log-dir /tmp/eric-logs [--print /tmp/preview.pdf](writesvalidation_response.xml/server_response.xmlto log dir; default log dir is CWD). - Send XML:
pytaxel send --xml-file /tmp/ebilanz.xml --tax-type Bilanz --tax-version 6.5 --certificate /path/to/cert.pfx --pin 123456 [--print /tmp/confirmation.pdf] [--log-dir /tmp/eric-logs]. - Add
--verbose/--debugto any command to log resolved paths and ERiC responses; response code is printed like the Rust CLI. You can also invoke the CLI viapython -m pytaxel.cli.main ...if you prefer.
- Start dev server (needs
fastapi+uvicorninstalled):uvicorn pytaxel.web.app:app --reload - Simple forms at
http://localhost:8000/allow manual uploads for:POST /generate(CSV upload → XML download),POST /validate(XML upload → JSON result),POST /send(XML + certificate + PIN → JSON or PDF confirmation).
Tests are organized in layers; you can run as much as your environment supports:
- eBilanz core (no ERiC required):
pytest tests/test_ebilanz_generation.py- exercises CSV→model→XML rendering against
taxel/test_datafixtures.
- ERiC error handling (requires
eric-pyimportable but no ERiC libs):PYTHONPATH=../eric-py:. pytest tests/test_eric_errors.py- checks
eric_py-based error and enum handling used by pytaxel.
- CLI e2e with ERiC (requires ERiC +
ERIC_HOME+eric-py):PYTHONPATH=../eric-py:. pytest tests/test_cli_integration.py- runs
generate,extractandvalidatethrough the CLI usingtaxelfixtures and the ERiC backend fromeric-py.
- Web API (optional, needs
fastapi,uvicorn):- install extras:
pip install -e .[web,dev] - run:
PYTHONPATH=../eric-py:. pytest tests/test_web_api.py
- install extras:
In CI or a fully provisioned dev environment, you can simply run pytest
from the repository root to execute all tests for which the dependencies
are available.