Skip to content
Lka edited this page Feb 6, 2025 · 5 revisions

Entwicklung

Erstellt eine Virtual-Env Umgebung: Ctrl+Shift+P -> Python: Create Environment -> Venv (einmalig zur Initialisierung des Projektes)

Zum aktivieren der Umgebung: .\.venv\scripts\activate aufrufen. (jedes mal)

von mir geändertes fpdf2 von github installieren

pip install --upgrade git+https://github.com/lka/fpdf2.git@master

Using commit messages

In case you are not familiar with conventional commits (as mentioned above), here is a short summary. Basically, you should prefix your commit messages with one of the following keywords:

  • chore – used for maintenance, does not result in a new version
  • fix – used for bug fixes, results in a new patch version (e.g. from 1.2.3 to 1.2.4)
  • feat – used for introducing new features, results in a new minor version (e.g. from 1.2.3 to 1.3.0)
  • feat! – used for breaking changes, results in a new major version (e.g. from 1.2.3 to 2.0.0)

Some examples for commit messages are shown below:

  • chore: Initial commit
  • fix: Correct typo
  • feat: Add support for Node.js 18
  • feat!: Change API from v1 to v2

Please note that ! indicates breaking changes, and will always result in a new major version, independent of the type of change.

..\get-next-version-windows-amd64.exe -p 'v' --target json > .\_internal\version.json schreibt die nächste Versionnummer nach _internal\version.json, wenn das Programm von https://github.com/thenativeweb/get-next-version installiert ist.

Tests

Die tkinter Umgebung zur Ein- / Ausgabe kann nicht mit Unittests getestet werden. (Todo: mit Selenium testen?)

Alle anderen Klassen werden mit Unittests versehen und getestet.

Test-Status

Python application

Verbesserung der Codequalität

Mit radon die Metriken testen:

  • radon cc . Cyclomatic Complexity: sollte nichts > A anzeigen, sonst refactoring
  • radon mi . Maintainability Index: sollte nichts > A anzeigen, sonst refactoring

Mit flake 8 prüfen

  • flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude .venv,.tox

Implementation

  • Die Klasse IniFile behandelt die Vorgaben für das Programm in Form von einem JSON Konstrukt.
  • Die Klasse ExcelContent liest eine Excel-Datei und liefert deren Inhalt als DataFrame.
  • Die Klasse Pdf (in handlePDF.py) erstellt die PDF-Datei.
  • Die Klasse ZugFeRD erstellt die XML Rechnungsdaten nach ZugFeRD 2.2 Spezifikation mit Hilfe der Bibliothek drafthorse.

Benutzter Font

Free Font Pack

For your convenience, the author of the original PyFPDF has collected 96 TTF files in an optional "Free Unicode TrueType Font Pack for FPDF", with useful fonts commonly distributed with GNU/Linux operating systems. Note that this collection is from 2015, so it will not contain any newer fonts or possible updates.

Ich habe daraus den Font DejaVuSansCondensed gewählt und in allen Ausprägungenen eingebettet.

Erstellen einer Windows exe

mit Hilfe des pyinstallers

pyinstaller .\excel2zugferd.py --noconsole --add-data _internal/Fonts:Fonts --add-data ./.venv/Lib/site-packages/drafthorse/schema:drafthorse/schema --add-data _internal/version.json:. --add-data _internal/sRGB2014.icc:. --noconfirm

danach mit dem wix toolset v5.0.2 ein Setupfile erstellen

wix build .\excel2zugferd.wxs -d ProductVersion="0.21.2.0" -o excel2zugferd_setup_x6432_0.21.2.0.msi

Credits and License

pandas

pandas is an open source, BSD-licensed library providing high-performance, easy-to-use data structures and data analysis tools for the Python programming language.

License

fpdf2

It is a fork and the successor of PyFPDF

License: LGPL v3

Drafthorse

Maintainer: Raphael Michel michel@rami.io

License of the Python code: Apache License 2.0

License

The PDF handling (drafthorse/pdf.py) is based on the code of factur-x, Copyright 2016-2018, Alexis de Lattre alexis.delattre@akretion.com, released under a BSD license.

The packages includes schemas and samples of the ZUGFeRD specification (.xsd and .xml files) which are owned by the Forum für elektronische Rechnungen bei der AWV e.V („FeRD“) and are released under a proprietary license that allows bundling them together with other software for free.