Falcon-Toolkit
Falcon-Toolkit copied to clipboard
Python 3.12 Support
It appears that the gnureadline package on PyPI will not build properly on macOS Sonoma with Python 12.0, potentially due to some changes in clang.
This issue acknowledges that we are aware of this, and for now recommend sticking with Python 3.11 if you require an alternative readline implementation. Note that this will apply to most macOS/Homebrew users, as Python is built against libedit by convention on macOS.
There are also some documented issues with the pick ibrary that we use on Python 3.12 (see: https://github.com/wong2/pick/issues/110).
Support Task List
- [x] Get
gnureadlinebuilt for Python 3.12 and onto PyPI (see: https://github.com/ludwigschwardt/python-gnureadline/pull/71). - [x] Either wait for a fix in the
picklibrary, or migrate to Prompt Toolkit. As some of our internal tooling uses a combination of Prompt Toolkit andpick, I am not opposed to reducing dependencies here and fully migrating to Prompt Toolkit. - [ ] Fully test the application on 3.12, paying attention to things like command history, curses-based UIs (keyboard selection menus), etc.
The second bullet point is being addressed by #113
FYI for anyone else who stumbles on this issue when trying to install falcon-toolkit with multiple versions of python.
I have 3 versions of python installed via pyenv as well as python 3.12 installed directly on my mac.
❯ pyenv versions
system
* 3.11.9 (set by PYENV_VERSION environment variable)
3.12.2
Trying to install falcon-toolkit using the traditional command eventually gave me the readline error as described in this issue because it was defaulting to my system python version (3.12).
❯ pipx install falcon-toolkit
installed package falcon-toolkit 3.4.1, installed using Python 3.12.3
These apps are now globally available
- falcon
done! ✨ 🌟 ✨
~
❯ falcon
Readline features including tab completion have been disabled because
no supported version of readline was found. To resolve this, install
pyreadline3 on Windows or gnureadline on Linux/Mac.
There is a workaround but it requires you to have prior versions of python installed and helps to have a manager like pyenv. To get falcon-toolkit to install correctly using a prior version of python, use the --python <path/to/python> flag in the install command.
❯ pyenv shell 3.11
~
❯ python --version
Python 3.11.9
~
❯ pipx install falcon-toolkit --python $(which python)
installed package falcon-toolkit 3.4.1, installed using Python 3.11.9
These apps are now globally available
- falcon
done! ✨ 🌟 ✨
~
❯ falcon
Usage: falcon [OPTIONS] COMMAND [ARGS]...
FYI just last week the gnureadline maintainer has created a new PR that they say they prefer: https://github.com/ludwigschwardt/python-gnureadline/pull/71
(the PR linked in the OP for gnureadline appears to be open even though ludwig disprefers that approach)
Thanks Dav, I forgot to close that :-) Please let me know if the new PR works for you.
Thank you to all who have commented above! I have updated the OP to link to Ludwig's new PR which I have tested as working under 3.12.
See: https://github.com/ludwigschwardt/python-gnureadline/pull/71#issuecomment-2088466514
Once this PR has been approved and pushed to PyPI, I will close this issue as we don't have any other (known) 3.12 compatibility issues.
Thanks to all for your patience on this one, and a massive thank you to Ludwig for his work on the gnureadline library which makes a lot of the shell functionality provided by Cmd2 work on non-readline systems!
Thanks to some great work from @ludwigschwardt, we now have a working version of gnureadline for Python 3.12!! 🎉 Thank you so much again, Ludwig!
We'll get some better documentation written around this to certify Python 3.12 here.
Thanks to this PR, we should also be fully compatible with Python 3.13! 🎉 https://github.com/ludwigschwardt/python-gnureadline/pull/76
I tried to be proactive for a change 😁