Ledger python package?

75 views
Skip to first unread message

Philogy

unread,
Apr 25, 2022, 12:47:07 PM4/25/22
to Ledger
Hello everyone, I'm just starting to get into ledger and other PTA tools but I'm wondering where and how I can use the `ledger` Python package. I see on github that there's a python folder with an example but I can't seem to find the referenced package / module anywhere in the documentation or online. I'm very interested in using ledger as my accounting system but I'd need to extend with a couple features.

Any help would be appreciated!

David Bremner

unread,
Apr 27, 2022, 8:35:38 AM4/27/22
to Philogy, Ledger
It might depend a bit on your OS. On Linux it suffices to add
"-DUSE_PYTHON=ON" to the cmake arguments. This generates an
appropriately named shared library, which is the extension [1]. I agree it would be cool if
this was documented somewhere.

d

[1]: for me currently this ends up as
/usr/lib/python3/dist-packages/ledger.cpython-310-x86_64-linux-gnu.so

o1bigtenor

unread,
Apr 28, 2022, 7:46:37 AM4/28/22
to Ledger, Philogy
On Wed, Apr 27, 2022 at 7:35 AM David Bremner <da...@tethera.net> wrote:
>
> Philogy <phild...@gmail.com> writes:
>
> > Hello everyone, I'm just starting to get into ledger and other PTA tools
> > but I'm wondering where and how I can use the `ledger` Python package. I
> > see on github that there's a python folder with an example but I can't seem
> > to find the referenced package / module anywhere in the documentation or
> > online. I'm very interested in using ledger as my accounting system but I'd
> > need to extend with a couple features.
>
> It might depend a bit on your OS. On Linux it suffices to add
> "-DUSE_PYTHON=ON" to the cmake arguments. This generates an
> appropriately named shared library, which is the extension [1]. I agree it would be cool if
> this was documented somewhere.
>
>
Hmmmmm - - - curious - - - - what does using this 'python' folder give
you that is not in the 'regular' version?

TIA

Ryan Nowakowski

unread,
May 31, 2022, 9:14:28 AM5/31/22
to ledge...@googlegroups.com, o1bigtenor, Philogy
It parses your ledger transactions into Python objects. I use it to build tools to automatically edit my ledger file:

https://gist.github.com/tubaman/0e80cec388d3d5d61e3f300e2477a9ae

Reply all
Reply to author
Forward
0 new messages