python-gnureadline icon indicating copy to clipboard operation
python-gnureadline copied to clipboard

Support Python 3.12

Open ludwigschwardt opened this issue 10 months ago • 2 comments

Disable the WITH_EDITLINE macro to avoid picking up libedit on macOS. And remove distutils which has left Python 3.12 (thanks @markmentovai and @srmainwaring!).

While I'm at it, update the Python module to the latest one in 3.12 (for 3.11 and 3.12), and add the latest 3.10 module as well (for 3.9 and 3.10, which is not compatible with the 3.12 one).

I also discovered that the compilation process on macOS somehow picks the system libedit above the local readline. It did not use to be like this, so I'm not sure what changed. Force the includes to be local (as Wikipedia states, the previous arrangement was "poor form" 😂 ).

Finally, rework the GitHub actions to take advantage of the new Apple Silicon runners. We should now have nice wheels from 3.6 to 3.12 for the main platforms.

This subsumes PRs #64 and #67 and closes issues #65 and #69.

Thanks for your patience!

ludwigschwardt avatar Apr 19 '24 12:04 ludwigschwardt

I would have liked to add some reviewers (like @srmainwaring and @ChristopherHammond13) but can't seem to do that 😅

Let me know in the comments if this PR works for you.

For the record, I attempted to add support for Python 3.13 as well (based on 3.13.0a5) but it's just too rough around the edges. The readline module internals have also changed quite a bit, so I'll wait for the dust to settle.

This should be released as 8.1.2.1. After that, I'll return to the user/site customize work, which is a quite exciting chapter for gnureadline 🙂 That should be released as 8.2.10 (new readline lib too, and maybe 3.13 support by then!).

ludwigschwardt avatar Apr 19 '24 17:04 ludwigschwardt

This is absolutely awesome, thanks so much again @ludwigschwardt!

I'm travelling today but we'll give this a test next week and let you know if it plays nicely with Cmd2. Many of us are extremely grateful!

ChristopherHammond13 avatar Apr 19 '24 17:04 ChristopherHammond13

Sorry this has taken a while to test! I moved over to a new laptop for work this week so I didn't have a development environment up and running. I haven't tested this on x86-64 yet, but it works great on Sonoma with an Apple Silicon CPU! I did the following to test

git clone ssh://[email protected]:/ludwigschwardt/python-gnureadline.git
cd python-gnureadline
git checkout support-python-3.12
# I installed Python 3.12 through Homebrew, so this is the best way to get setuptools under 3.12 now that it has been removed from the base distribution of Python
brew install python-setuptools
python3 setup.py build

# Get into my project's folder
cd ../Falcon-Toolkit

# Install gnureadline in editable/development mode from the built code on disk
poetry run pip install -e ../python-gnureadline

# Test my application
poetry run falcon [other args here for my tooling to drop to a Cmd2 shell]

This worked great! Tab complete worked perfectly in Cmd2, all under Python 3.12. Thank you so much again for your support with this!

ChristopherHammond13 avatar May 01 '24 13:05 ChristopherHammond13

Excellent, thanks for the report!

Homebrew's Python 3.12 has become harder to use as a general-purpose user Python installation after implementing PEP 668 (long discussion here). You are discouraged from pip-installing whatever you want without first creating a virtualenv. Luckily Poetry makes one for you, so you are sorted. However, this suggests that one might as well install another Python (I like pyenv) which then comes with GNU readline out of the box.

Homebrew Python has been a funny place for the past few years... First 3.11 dropped GNU readline, making this package more useful, and then 3.12 "dropped" pip install, which makes this package obsolete again for me 😂

ludwigschwardt avatar May 02 '24 13:05 ludwigschwardt

My plan is to bump readline to 8.2.10 and add my funky new readline overrider and release by the end of the week 🙂

ludwigschwardt avatar May 02 '24 13:05 ludwigschwardt

@ludwigschwardt - I have just installed python-gnureadline from master to run MAVProxy under Python 3.12. All working perfectly. Thank you for the update.

srmainwaring avatar May 11 '24 20:05 srmainwaring

Great stuff! Thanks so much @ludwigschwardt!

ChristopherHammond13 avatar Jul 01 '24 19:07 ChristopherHammond13