-
Notifications
You must be signed in to change notification settings - Fork 335
Extend import help #2155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Extend import help #2155
Conversation
… option help This fixes a few issues that were hampering me as a newcomer to understand the import process. The import help text is less dense now and presupposes less knowledge about importing in beancount and the detailed differences of the different generations of import mechanisms (beancount.ingest vs beangulp). There are clearer step-by-step instructions and an example that should get a user floating for a basic import-CSV case. Also, the full signature of hook function is now documented, which wasn't done anywhere in the documentations of beancount, beangulp, or fava. Additionally, this adds to the syntax overview the simple information that commoditys = currencies from the perspective of beancount. This would have helped me as a newcomer to find correct BQL functions for my needs.
yagebu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR, I've left some comments.
|
Thanks for taking the time to review this! I have updated the help page to include your changes and write unit tests. The example is now in The type checker has reported several errors. I have fixed those that I understand but for some I would need help...
Offending code:
I do not understand this message.
I tried defining the Row type as
Offending code:
I tried to put "Row" in string literals, but this is removed by the formatter. I do not know how to resolve this.
fava/tests/data/import_example_for_docs.py Line 147 in 999f94b
The type required by the tuple is is Optional[Amount] --- I do not know how to resolve this.
And finally, there is
Is this because beangulp has no typing annotations? Should we exclude beangulp from mypy checking? |
9ca3378 to
e20d8f5
Compare
57cac44 to
c3d8a2b
Compare
eed4656 to
467d9ef
Compare
467d9ef to
b02f75a
Compare
…Hub accepts as URL
2d63ab1 to
dbc8251
Compare
|
The latest released version of beangulp does not have a py.typed marker, so it doesn't typecheck. For the parts used in Fava, there's type stub files in the stubs directory. If it's possible to extend those without a huge effort, that's an option, otherwise feel free to add # type: ignore comments. |
|
I mostly included type stubs.
This is to prevent these errors: The first one stems from the fact that csvbase.CSVReader (superclass of csvbase.Importer) shadows the The second one makes no sense to me, because csv.excel is a subclass of csv.Dialect, as required by the type? fava/tests/data/import_example_for_docs.py Line 200 in cda4671
This silences It expects
I did not bother to make a type stub for
This prevents which I think is not required for a test? Unsure about what this is. |
|
Unfortunately, the The hook runs on my machine. I need the exclude statment, because mdformat wants to destroy the jinja2 syntax @yagebu, can you update |
5cdbed4 to
66ad045
Compare
66ad045 to
a2aaca5
Compare
|
I have found a workaround. All tests pass now and test coverage is also 100% again. There is only one configuration one which uses outdated dependencies, so the provided example does not run on outdated versions... I could live with that, its only documentation.... |
|
Skipping tests for beangulp < 2.0.0, all tests pass now |
I would like to suggest this expansion of the import help. It was too terse and technical to understand for me when I just discovered beancount. I figured that a GUI like fava might be a good way to learn my ways around beancount, but the import docs were too confusing for me so I ended up working around the whole import process by just generating the beancount ledgers by a self-written stand-alone script.
This is a pitty, given that fava has a nice GUI support and I find the Importer declarations of beangulp very elegant. So therefore I have extended the help page of fava in the hope that other newbie users will have an easier time to start with beancount/fava.
The import help text is less dense now and presupposes less knowledge about importing in beancount and the detailed differences of the different generations of import mechanisms (beancount.ingest vs beangulp). There are clearer step-by-step instructions and an example that should get a user floating for a basic import-CSV case. Also, the full signature of hook function is now documented, which wasn't done anywhere in the documentations of beancount, beangulp, or fava.
Additionally, this adds to the syntax overview the simple information that commoditys = currencies from the perspective of beancount. This would have helped me as a newcomer to find correct BQL functions for my needs.
There are two failing tests, but I think they are not related to this PR, as I have only edited markdown files: