Nagasaki45/bibo

Cannot run with Python 3.12

harisont opened this issue ยท 4 comments

Hi and thanks for a piece of software that really makes my life simpler ๐Ÿ˜ƒ

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.

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.

Take your time! I already have a workaround, so my bibliography management (and sanity) is safe for the moment ๐Ÿ˜„

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

Yep, it works! Thank you for the quick fix