Hello all,
I've been using Ledger's Python API extensively for many years now
and have worked around some of its quirks and limitations in odd ways.
In my mind Ledger's Python API (and Ledger itself) has a lot of
unused potential.
I believe one next step towards unlocking that potential is converting
Ledger's Python module to a Python package.
"What's the difference?" someone might ask.
A Python module is a single shared library compiled from Ledger's
C++ code that can be used by Python. The bridging from C++ to Python
code (and vice versa) is done via Boost.Python¹.
A Python package on the other hand is a bundle of Python modules and
pure Python files which in combination offer a richer and more
versatile API.
A Python package allows to extend the functionality of C++ native types
by adding new functions to them or provide entirely new classes written
only in Python. This would allow for easier exploration for
new features. And if a new feature proves useful but is slow in Python
it would likely be less tedious to port it to C++ than develop it in
C++ from the beginning.
The PR #2196² is a draft that introduces Ledger Python package.
While the PR breaks existing scripts the fix is as simple as changing
`import ledger` to `import ledger.core as ledger`.
I kindly ask people relying on or using Ledger's Python API to provide
feedback on how the Ledger Python is used.
How do you invoke Ledger Python?
(ledger python, python script, in-line journal python, other)
Which parts of the Ledger API do you use most?
(Examples would be helpful)
What features are missing from Ledger Python?
Which existing Ledger Python bugs are limiting?
Getting answers to these questions would help drive development
in a direction that is most useful for API users.
Best
Alexis
¹
https://www.boost.org/doc/libs/1_81_0/libs/python/doc/html/index.html
²
https://github.com/ledger/ledger/pull/2196