My Python importers are getting messy. I’ve copy-pasted the same pad-and-balance check into every script for a year now. Everything lives in git with bean-check running in a pre-commit hook, which helps, but it’s still duplication. Last week I looked at turning it into a real plugin and bounced off the docs, just one example and nothing clear on how errors surface. Has anyone here shipped a plugin they still use, and what gap did it fill that a script couldn’t?
How do you test a plugin without risking your real client ledgers breaking?
How do you test a plugin without risking your real client ledgers breaking?
I test against a copy. Full ledger duplicated each run. Plugin reads the copy only. Production file stays untouched until checks pass. bean-check runs early. Then my plugin runs. Failures halt the import. I have run unrealized gains checks in production for 14 months. It caught unbalanced lots my scripts missed. Scripts duplicated logic across files. Plugin centralizes it. Docs were thin. Example code plus source reading filled gaps. Errors surface as validation failures. Still unclear how others isolate client data at scale. How do you segregate test fixtures when ledgers share common includes?
Fred, stop letting fixtures share includes with client ledgers. “Beancount stitches the files together with include directives in main.bean.” See multi-file doc - point tests at a separate test main file using tiny fixture files only, so real ledgers never load. I keep one test.bean including two tiny files. No client data loads. Tests stay fast.