macxred / pyledger

Python package to streamline the implementation and management of accounting systems.
MIT License
0 stars 0 forks source link

Feat: complete text ledger #44

Closed AlexTheWizardL closed 3 weeks ago

AlexTheWizardL commented 1 month ago

This PR finalizes the TextLedger implementation by adding support for the following entities:

In addition, a new file, decorators.py, has been introduced, containing the timed_cache() decorator. This decorator enhances the architecture by providing a more efficient caching mechanism with entity-specific cache timeouts.

Note: It is recommended to review this pull request commit by commit for better clarity.

codecov-commenter commented 1 month ago

Codecov Report

Attention: Patch coverage is 98.60140% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pyledger/text_ledger.py 98.18% 2 Missing :warning:
Flag Coverage Δ
unittests 77.55% <98.60%> (+2.86%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
pyledger/constants.py 100.00% <100.00%> (ø)
pyledger/decorators.py 100.00% <100.00%> (ø)
pyledger/standalone_ledger.py 70.04% <100.00%> (+0.85%) :arrow_up:
pyledger/text_ledger.py 95.21% <98.18%> (+7.33%) :arrow_up:
lasuk commented 3 weeks ago

As a minor point, I suggest to reduce the cache timeout for TextLedger to 10, 15 or 30 seconds (pick your preference).

-> Reading information from file takes a tiny fraction of a second. Fresh file read every 10-30 seconds is absolutely acceptable. -> Reduces the time, during which a potential external change (i.e. file modification) is undetected.