Nagasaki45 / bibo

Command line reference manager with a single source of truth: the .bib file. Inspired by beets.
MIT License
32 stars 4 forks source link

Cannot run with Python 3.12 #83

Closed harisont closed 5 months ago

harisont commented 5 months ago

Hi and thanks for a piece of software that really makes my life simpler :smiley:

After upgrading to Python 3.12, I can no longer run the latest bibo 0.1.7 (installed with pipx). It fails with:

Traceback (most recent call last):
  File "/home/harisont/.local/bin/bibo", line 5, in <module>
    from bibo.bibo import cli
  File "/home/harisont/.local/pipx/venvs/bibo/lib/python3.12/site-packages/bibo/bibo.py", line 6, in <module>
    import pkg_resources
ModuleNotFoundError: No module named 'pkg_resources'

It seems that pkg_resources is now deprecated, and that the solution is to replace it with importlib.metadata in bibo.py.

However, to make things work on my computer, I also had to change

@click_plugins.with_plugins(pkg_resources.iter_entry_points("bibo.plugins"))

into

@click_plugins.with_plugins(pkg_resources.entry_points())

(note that my current import statement is import importlib.metadata as pkg_resources)

where function entry_points (replacing iter_entry_points?) takes no arguments. I suspect this might break something package-related (I don't have any plugins installed, so I personally don't know), and for this reason I'm not opening a pull request just yet.

Nagasaki45 commented 5 months ago

Thank you for using bibo and for reporting this issue!

The last commit is from 2 years ago, so I need to do some work to get the project maintainable again. I will try to get to it done in the next few days.

Until then, a workaround is to install setuptools into the virtual env. I understand you use pipx, so it should be easy to do with pipx inject bibo setuptools. Obviously this is just a temporary solution, but I hope it will help you get up and running again with bibo until the issue is fixed properly.

harisont commented 5 months ago

Take your time! I already have a workaround, so my bibliography management (and sanity) is safe for the moment :smile:

Nagasaki45 commented 5 months ago

Hi @harisont! This should now be fixed. Mind upgrading to v0.1.9 and trying again?

harisont commented 5 months ago

Yep, it works! Thank you for the quick fix