I am so excited about the new Python REPL that will likely land in Python 3.13. I’ve been following this CPython pull request since I heard Pablo and Łukasz announce their work on the new Python REPL in episode 1 of their new core.py podcast.
Github notifications? 🤔
That pull request was quiet for many months, but in the last couple weeks, I started seeing email notifications in my inbox about it. I’ve never fancied myself a competent C developer and I try to steer clear from understanding TTY magic, so I have no idea what most of the commits do. But seeing activity on this pull request rejuvenated my excitement about this upcoming feature!
I also remember reading that the Python 3.13 feature freeze is coming up soon, so I’ve been silently cheering for that PR to make the cut before the deadline.
In the last few days, I decided that I should try committing to use this new REPL locally as my default Python environment.
When I type python
on my machine, I want to live in this new shiny REPL.
I figure this will make it easier to spot bugs that might not have been noticed yet… though honestly it’ll mostly just allow me to try out this fancy new REPL first-hand.
Installing a custom CPython build in pyenv
I use pyenv to manage the many Python versions I have installed on my machine. I wondered whether it was possible to install a custom build of CPython with pyenv.
Instead of going to the pyenv documentation to figure out an answer, I argued with an AI until it gave me a working answer. I tried a few AI systems at first, but Claude seemed to give me the most promising-looking answer so it was the one I argued with for 5-10 minutes until I got a working solution.
First, I created this ~/.pyenv/plugins/python-build/share/python-build/3.13.0-pyrepl
file:
1 2 3 |
|
Then I ran this command, which took a couple minutes:
1
|
|
After that, pyenv versions
showed a new 3.13.0-pyrepl
version:
1 2 3 4 5 6 7 8 |
|
I then added 3.13.0-pyrepl
to the top of my ~/.pyenv/version
file to make this my default Python:
1 2 3 4 5 6 |
|
And it worked!
Tying python
showed the new colorful prompt.
Is is a bad idea to make this not-even-beta version of CPython the default Python on my machine? I have no idea. Everything’s been fine for the last 10 hours at least… 🤷
If you ever need to try installing a custom CPython build with pyenv, maybe the above instructions will work. They’re mostly generated by a large language model that didn’t give me a working answer until the third response… so feel free to let me know if it’s all wrong (or all right?).
After this adventure, I checked my podcast feed this evening only to realize that there’s a new core.py episode all about exactly this feature! If you’d like to hear some core developers nerd out about CPython development, give core.py a listen. You don’t need to understand how CPython development works to enjoy their enthusiasm. 💖