redstreet / beancount_reds_importers

Simple ingesting tools for Beancount (plain text, double entry accounting software). More importantly, a framework to allow you to easily write your own importers.
GNU General Public License v3.0
111 stars 38 forks source link

bean-download got errors `unexpected keyword argument 'shell_complete'` #87

Closed yanghu closed 11 months ago

yanghu commented 11 months ago

installed via pip install.

any bean-download command fails in click's init call:

❯ bean-download config-template
Traceback (most recent call last):
  File "/home/huyang/.local/bin/bean-download", line 5, in <module>
    from beancount_reds_importers.util.bean_download import cli
  File "/home/huyang/.local/lib/python3.8/site-packages/beancount_reds_importers/util/bean_download.py", line 85, in <module>
    def download(config_file, sites, site_types, dry_run, verbose):  # noqa: C901
  File "/home/huyang/.local/lib/python3.8/site-packages/click/decorators.py", line 192, in decorator
    _param_memo(f, OptionClass(param_decls, **option_attrs))
  File "/home/huyang/.local/lib/python3.8/site-packages/click/core.py", line 1714, in __init__
    Parameter.__init__(self, param_decls, type=type, **attrs)
TypeError: __init__() got an unexpected keyword argument 'shell_complete'
redstreet commented 11 months ago

Good to know, thanks for filing. Would you mind pasting the output of the command below? I suspect it's a click version issue, since my install works perfectly fine:

$ pip freeze | grep click
click==8.1.4
click-aliases==1.0.1
yanghu commented 11 months ago
click==7.1.2
click-aliases==1.0.3

after upgrading click to 8.1.4 the issue is gone.

however I got the following warning when trying to upgrade click, which might be the root cause:

ERROR: gitlint 0.15.0 has requirement Click==7.1.2, but you'll have click 8.1.4 which is incompatible.
ERROR: click-aliases 1.0.3 has requirement click<9.0.0,>=8.1.7, but you'll have click 8.1.4 which is incompatible.

is it possible to lock the click version in your requirements?

redstreet commented 11 months ago

Good to know!

You can get rid of the gitlint error by upgrading it. Your click-aliases wouldn't have worked with click-7.1.2 if it needs at least 9.0.0, so you're best off downgrading it or uninstalling/reinstalling.

I imagine you mean opening up the version requirements. Notice that it is locked to a certain version now, which is generally a bad idea since everyone needs version flexibility for all the other (unrelated) python packages they install.

If you're able to come up with accurate constraints for any of the package dependencies, please do submit a PR of requirements.txt and I'm happy to look at it. Thanks.

yanghu commented 11 months ago

Thanks for your reply!

By "locking" I meant adding dependency to click-8.1.4 so the right version would be installed? In the requirements file the version required is 7.0. (which was the one I had but ran into errors)

I installed reds importers in a virtual env and I was expecting it would pull all required dependencies with right versions. (I had to manually install smart_import when following the README, maybe that installation could break things?)

redstreet commented 11 months ago

Ah, got it, done. smart_importer is optional, so I've left it out of requirements.txt.

Thanks for raising this issue!