https://bitbucket.org/blais/beancount/issues/214/add-top-level-directory-to-syspath
On Sun, Jan 7, 2018 at 1:36 AM, Zhuoyun Wei <[email protected]> wrote: > 2018-01-06 03:38:19 Martin Blais <[email protected]>: > > You need to adjust your PYTHONPATH, or put the code somewhere on the > PYTHONPATH. > > You could improve on what you're doing by appending the absolute path to > the current PYTHONPATH value. > > I see the problem with PYTHONPATH has been brought up a few times by new > users of Beancount. I have two possible suggestions: > > 1. There could be an option for defining search paths, in which custom > plugins and importers are searched for. > > 2. The directory where root beancount file resides could be searched > implicitly. > > The idea is inspired by Ansible. By default, Ansible searches the > current directory for an ansible.cfg file, in which search paths for > hosts and roles could be defined. This way, the entire Ansible repo is > self-contained. You could clone it on any machine (with Ansible > installed, of course) and run the playbooks right away, without setting > up additional config files or environment variables. > > Currently I use a few custom importers. I use a little trick in the > importer config file (which is a Python file) to make Beancount search > the same directory of the config file for importers: > > here = os.path.dirname(os.path.abspath(__file__)) > sys.path.insert(0, here) > > By doing this, I do not have to modify PYTHONPATH every time I run > bean-identify / bean-extract / bean-file. But for bean-report, > bean-check, and fava, I do not have a chance to inject additional search > paths for custom plugins without modifying PYTHONPATH. > > > -- > Zhuoyun Wei > > -- > You received this message because you are subscribed to the Google Groups > "Beancount" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/beancount/20180107063557.GA3283%40xenien.wzyboy.org. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Beancount" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/CAK21%2BhOGv%3DWbR%2Bx-hSd3vu8XNPXvjW8gSXDTeZa3_gdEDSvBRA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
