fava icon indicating copy to clipboard operation
fava copied to clipboard

Beancount v3 compatiblity

Open yagebu opened this issue 1 year ago • 1 comments

Tracking issue. See #1859 for ongoing work.

A version of Fava that supports both v2 and v3 seems feasible. This would use the beanquery package on both version, introducing some changes to which queries work.

See also:

  • [ ] #1831
  • [ ] #1824

yagebu avatar Sep 15 '24 08:09 yagebu

I look forward to the day when fava and beancount fully support v3. When it enters a stable state, I will immediately migrate from v2 to v3.

Does anyone know the time node?

jack9603301 avatar Sep 22 '24 07:09 jack9603301

Merged #1859 just now so Beancount v3 support is now on the main branch :)

I think we're good on the beanquery-front, importing still probably needs more work (no support yet for new-style beangulp importers)

yagebu avatar Nov 09 '24 16:11 yagebu

With #1917 we now also have support for importers inheriting from beangulp.Importer, so I'd consider this mostly complete. Testing and feedback welcome, will probably create a release in one or two weeks.

yagebu avatar Dec 15 '24 13:12 yagebu

I just released 1.30 (very happy about the fitting version number) with these changes :)

I'll leave this issue open for a bit for feedback on this topic.

yagebu avatar Dec 29 '24 12:12 yagebu

Is there a difference how the hooks are called in fava vs plain beangulp? When I call the import script directly, my hooks are receiving 4 values (filename, entries, account and importer), if I use the same script through fava, I only get 2 (filename and entries).

tarioch avatar Dec 30 '24 18:12 tarioch

I'm using the latest Docker image, and it says:

Welcome to the help pages for Fava! You are running Beancount version 2.3.6 and Fava 1.30 (changelog). There are help pages for the following topics:

Shouldn't it read Beancount v3 or something? :)

abourget avatar Dec 31 '24 22:12 abourget

Is there a difference how the hooks are called in fava vs plain beangulp?

It seems there is - I didn't change anything compared to v2, so they're still called the "old" way. A PR to fix that would be welcome (I guess we should inspect the hook signature to be compatible with both) - edit: nevermind, AFAICT Fava and beangulp both call hooks with just two arguments, the imported and the existing entries.

I'm using the latest Docker image

We don't provide a Docker image so you'll need to raise this with whomever you got this from.

yagebu avatar Jan 03 '25 09:01 yagebu

I'm getting this when I try to run the fava I just installed, with beancount v3 installed from source.

PS C:\Users\marvhen> fava .\tst.bean
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\marvhen\scoop\apps\python\current\Scripts\fava.exe\__main__.py", line 4, in <module>
    from fava.cli import main
  File "C:\Users\marvhen\scoop\apps\python\current\Lib\site-packages\fava\cli.py", line 16, in <module>
    from fava.application import create_app
  File "C:\Users\marvhen\scoop\apps\python\current\Lib\site-packages\fava\application.py", line 49, in <module>
    from fava._ctx_globals_class import Context
  File "C:\Users\marvhen\scoop\apps\python\current\Lib\site-packages\fava\_ctx_globals_class.py", line 10, in <module>
    from fava.core.conversion import conversion_from_str
  File "C:\Users\marvhen\scoop\apps\python\current\Lib\site-packages\fava\core\__init__.py", line 41, in <module>
    from fava.core.ingest import IngestModule
  File "C:\Users\marvhen\scoop\apps\python\current\Lib\site-packages\fava\core\ingest.py", line 16, in <module>
    from beangulp import Importer
  File "C:\Users\marvhen\scoop\apps\python\current\Lib\site-packages\beangulp\__init__.py", line 21, in <module>
    from beangulp import cache  # noqa: F401
    ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\marvhen\scoop\apps\python\current\Lib\site-packages\beangulp\cache.py", line 158, in <module>
    _CACHE = defdict.DefaultDictWithKey(_FileMemo)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'beancount.utils.defdict' has no attribute 'DefaultDictWithKey'

Here are the versions of what I have:

PS C:\Users\marvhen> pip list
Package            Version     Editable project location
------------------ ----------- ---------------------------------
anyio              4.7.0
babel              2.16.0
beancount          3.1.0.dev0  C:\Users\marvhen\source\beancount
beangulp           0.1.1
beanquery          0.1.0
beautifulsoup4     4.12.3
blinker            1.9.0
chardet            5.2.0
cheroot            10.0.1
click              8.1.8
colorama           0.4.6
fava               1.30
Flask              3.1.0
flask-babel        4.0.0
idna               3.10
itsdangerous       2.2.0
jaraco.functools   4.1.0
Jinja2             3.1.5
lxml               5.3.0
markdown2          2.5.2
MarkupSafe         3.0.2
meson              1.6.1
meson-python       0.17.1
more-itertools     10.5.0
ninja              1.11.1.3
packaging          24.2
pip                24.3.1
ply                3.11
pyproject-metadata 0.9.0
python-dateutil    2.9.0.post0
pytz               2024.2
regex              2024.11.6
simplejson         3.19.3
six                1.17.0
sniffio            1.3.1
soupsieve          2.6
TatSu              5.7.4
watchfiles         1.0.3
Werkzeug           3.1.3

marvhen avatar Jan 03 '25 09:01 marvhen

The latest development version of Beancount is currently not compatible with the latest released version of beangulp. You'll need to either install both from source or both from released versions.

yagebu avatar Jan 03 '25 15:01 yagebu