Skip to content
Sign upLog in
← Back to Community

Python 3.10 on replit

Profile icon
19ecal

Basically put this in your .replit file:

run = "(python3.10 --version || install-pkg python3.10) && clear && python3.10 main.py"

Explanation:
(python3.10 --version || install-pkg python3.10): check the version of python3.10, if it exited non-zero install it
clear && python3.10 main.py: clear the screen and run main.py

Python 3.10 is not the full release until October (currently beta), and I doubt very much that replit will add it then, so use this .replit file if you want to run the new features.

https://docs.python.org/3.10/whatsnew/3.10.html

Voters
Profile icon
priyanshusing43
Profile icon
Guilhermeda42
Profile icon
jangwongKim
Profile icon
2B11-Huang-Chi
Profile icon
ScottSchool
Profile icon
Huseein-Master
Profile icon
danilotallaric2
Profile icon
LuizSergio5
Profile icon
juliencantau
Profile icon
plasmium
Comments
hotnewtop
Profile icon
19ecal

UPDATED (using nix):
make a new nix repl: https://replit.com/new/nix
put this into replit.nix:

{ pkgs }: { deps = [ pkgs.python310 ]; }

put this in .replit

run = "python3.10 main.py"
Profile icon
UMARismyname

@19ecal
only problem with nix repls is that pip doesn't work with 3.10. I've tried ensurepip and get-pip.py as well and it doesn't work. Only 3.8-3.9 packages are available.

Profile icon
prajwal0

Does this work with external packages from PyPI (pip install ____ or Replit's packaging manager)?

Profile icon
UMARismyname

just saying for anyone who came here from google, this won't work anymore. You could fork this to get a nix-based python 3.10 repl with all features you'd usually expect included, or this for 3.11

Profile icon
ch1ck3n

why do you need python 3.10

Profile icon
IMayBeMe

@ch1ck3n
idk, I guess it’s for people to feel like they use the latest tech hence making them a better programmer somehow. Tbh every python version is practically the same.

Profile icon
FlickerDroid

@IMayBeMe
bru..., please see the python 3.10 changelogs, its got better error predictions and all

Profile icon
rejevichb

@ch1ck3n
to me, the most notable item in the changelog in the OP, the language now supports pattern matching (match/case)

Profile icon
CarpalEnderman

@rejevichb
This is pretty much the only reason why i want to update lol

Profile icon
TheNerd21

@CarpalEnderman
same + the error matching

Profile icon
ch1ck3n

@TheNerd21
fart: a reflex that expels intestinal gas through the anus

Profile icon
teacherniels2

@ch1ck3n
It has a bunch of useful features that 3.8.12 (current REPLit default) doesn't have.

Profile icon
ArshamShayan

MATCH CASE that's [email protected]