Optional `compress_dhist()` requires `pickleshare`
While changing directory I am receiving a warning:
In [1]: cd ..
/Users/matt/.venv/lib/python3.12/site-packages/IPython/core/magics/osm.py:417: UserWarning: This is now an optional IPython functionality, setting dhist requires you to install the `pickleshare` library.
self.shell.db['dhist'] = compress_dhist(dhist)[-100:]
I am not interested in having this feature simply because I teach Python. Each week, I set up a new repository with a virtual environment and a fresh IPython installation. Therefore, I would have to remember to install pickleshare every time, as well as explain why to do that to my students.
How can I turn these warnings off? I have searched all my config files for anything remotely related to dhist and found nothing.
PS. The idea of Pickleshare is quite good. It would be nice to see it in the standard library as a rewrite of shelve or something.
Same problem, any plans to fix?
Confirming that I can reproduce this in IPython 8.26.0. The warning was modified in #14321 and pickleshare was marked as an optional dependency in #14217.
Not sure what the best path forward here would be, maybe @Carreau has ideas.
At a cursory glance, %dhist seems to work the same way whether or not pickleshare is installed. The thing that makes use of the database stored dhist is only when you start ipython with ipython --StoreMagics.autorestore=True. That's the only code path I could find that actually uses the database version of the directory history, and it's not set by default.
Perhaps we should move the warning to the store magic and possibly the autorestore setting. But I haven't looked at the other keys for the pickleshare database (bookmarks, and aliases) which might have usages beyond the store magic.
I'm probably going to vendor pickleshare back in. It's annoying to have it as a speparate package if we are the only one to use it. The goal was to drop dependency/functionality if no-one uses it, so vendoring would have the same effect.
If someone want to send a PR,I woudl appreciate.