Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3.12 Support #92

Open
2 of 3 tasks
ChristopherHammond13 opened this issue Nov 13, 2023 · 6 comments
Open
2 of 3 tasks

Python 3.12 Support #92

ChristopherHammond13 opened this issue Nov 13, 2023 · 6 comments
Assignees
Labels
🐛 bug Something isn't working dependencies Pull requests that update a dependency file

Comments

@ChristopherHammond13
Copy link
Member

ChristopherHammond13 commented Nov 13, 2023

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: aisk/pick#110).

Support Task List

  • Get gnureadline built for Python 3.12 and onto PyPI (see: Support Python 3.11 and 3.12 ludwigschwardt/python-gnureadline#71).
  • Either wait for a fix in the pick library, or migrate to Prompt Toolkit. As some of our internal tooling uses a combination of Prompt Toolkit and pick, 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.
@ChristopherHammond13 ChristopherHammond13 added 🐛 bug Something isn't working dependencies Pull requests that update a dependency file labels Nov 13, 2023
@ChristopherHammond13 ChristopherHammond13 self-assigned this Nov 13, 2023
@ChristopherHammond13 ChristopherHammond13 changed the title Python 12.0: gnureadline Build Issues on macOS Sonoma Python 3.12 Support Feb 22, 2024
@ChristopherHammond13
Copy link
Member Author

The second bullet point is being addressed by #113

@the1337beauty
Copy link

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]...

@davclark
Copy link

FYI just last week the gnureadline maintainer has created a new PR that they say they prefer: ludwigschwardt/python-gnureadline#71

(the PR linked in the OP for gnureadline appears to be open even though ludwig disprefers that approach)

@ludwigschwardt
Copy link

Thanks Dav, I forgot to close that :-) Please let me know if the new PR works for you.

@ChristopherHammond13
Copy link
Member Author

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: ludwigschwardt/python-gnureadline#71 (comment)

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!

@ChristopherHammond13
Copy link
Member Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working dependencies Pull requests that update a dependency file
Projects
None yet
Development

No branches or pull requests

4 participants