I have created a custom price source that seems to work fine, however I would like to be able to create a package for it so it can be easily distributed and maintained without messing with beancount source code.
Currently I have the following package skeleton (I used cookicutter)
When I run a python shell and import beancount_cryptocompare.cryptocompareusd it doesn't complain, however when I use the namespace on the price attribute it doesn't work, example:
(.env3) > $ bean-price -e USD:cryptocompareusd/ETH --no-cache
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/beancount/prices/find_prices.py", line 147, in import_source
__import__(default_name)
ModuleNotFoundError: No module named 'beancount.prices.sources.cryptocompareusd'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/beancount/prices/find_prices.py", line 151, in import_source
__import__(module_name)
File "/home/av/repos/crypto/beancount_cryptocompare/beancount_cryptocompare/cryptocompareusd.py", line 10, in <module>
import cryptocompare
ModuleNotFoundError: No module named 'cryptocompare'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/bin/bean-price", line 2, in <module>
from beancount.prices.price import main; main()
File "/usr/lib/python3.6/site-packages/beancount/prices/price.py", line 310, in main
args, jobs, entries = process_args()
File "/usr/lib/python3.6/site-packages/beancount/prices/price.py", line 281, in process_args
psource_map = find_prices.parse_source_map(source_str)
File "/usr/lib/python3.6/site-packages/beancount/prices/find_prices.py", line 99, in parse_source_map
for source_str in source_strs.split(','))
File "/usr/lib/python3.6/site-packages/beancount/prices/find_prices.py", line 99, in <genexpr>
for source_str in source_strs.split(','))
File "/usr/lib/python3.6/site-packages/beancount/prices/find_prices.py", line 124, in parse_single_source
module = import_source(short_module_name)
File "/usr/lib/python3.6/site-packages/beancount/prices/find_prices.py", line 155, in import_source
module_name, exc))
ImportError: Could not find price source module "cryptocompareusd": No module named 'cryptocompare'
If I try with the full namespace, it doesn't work either, example:
Original report by vonpupp (Bitbucket: vonpupp, GitHub: vonpupp).
Hi,
I have created a custom price source that seems to work fine, however I would like to be able to create a package for it so it can be easily distributed and maintained without messing with beancount source code.
Currently I have the following package skeleton (I used cookicutter)
When I run a python shell and
import beancount_cryptocompare.cryptocompareusd
it doesn't complain, however when I use the namespace on the price attribute it doesn't work, example:If I try with the full namespace, it doesn't work either, example:
From what I understood the
find_prices
works as some sort of plugin importer or similar, is that right?IMHO it would be very desirable not to mess with PYTHONPATH nor beancount source. Would that be possible?
Could you please help me?
Thank you very much.