With 32M forks, the old Python Template was the most popular Template at Replit. It also had some issues:
Critical programs like pip, poetry, and python, were installed in the venv directory. If you deleted the directory or uninstalled these programs, your Repl wouldn’t work.
The runtime, packager, and code intelligence were frozen in time. If you wanted the newest version of Python or the code intelligence (language server), you needed to fork the Template from scratch.
It was hard to use other languages alongside Python in the same Repl.
This new template uses Nix Modules to solve these problems. With Nix Modules, many entries in the .replit file bundled into one modules entry in the .replit file like
modules = ["python-3.10:v18-20230807-322e88b"]
Here, the module identified by python-3.10:v18-20230807-322e88b contains:
the Python 3.10 runtime
our Prybar interpreter for Python
a state of the art Python language server
a Python debugger
our UPM packager as well as poetry and pip for installing pypi packages
With modules, we can deliver updates to your Python experience. Previously, when you forked a Template, your experience did not change unless you knew how to update the .replit file yourself. With this new Template, you’ll get automatic upgrades for the code intelligence and patch updates to Python.
One difference in the new Python Template is when you install Python packages, they will be installed in a hidden directory named .pythonlibs. It does not use virtual environments as the previous Template did, but instead uses the user install feature to install into that directory.
This week we’ll be rolling it out to 50% of general users of the Python Template. Soon, we’ll roll it out to 100%.
We’d appreciate it if you take the time to try it out and report back to us below.
@replit/Python-Beta-LSP is the old Python template with the code intelligence (LSP) switched to pyright-extended. We’re also using pyright-extended in the Python-Beta template.
Reload it (just in case), and test if it works. If you want to be safe, you can backup your .replit first.
The replit.nix and venv will be unnecessary now, and you can delete them.
Thanks, I’ll try it,
but I have a small issue : it seems that the Repls with the new template don’t start when I try to access them…
Is it normal ? I can give you an example if you want to test : a small Flask Example which doesn’t start when i try to access it while it always worked before… Maybe it’s an issue not related to the new template
Well, if i don’t run it before trying to access the URL, it doesn’t start.
And it is the same for all Repls created with the new template. If I take the old template BetaLSP it works fine…
Maybe it’s just a bad coincidence but I can’t manage to have new template running when accessing the web url
I tried a few times but couldn’t reproduce the problem you are describing. Could you record a short screencast of the problem with loom or similar to show us what you are seeing? Or even a screenshot may help clarify.
If I do the exact same steps with Beta LSP template https://testbeta.fvillemin.repl.co
It works perfectly … When someone uses the Url, it is starting the Repl if it was stopped
Maybe that’s a coincidence but I can reproduce it everytime
Hello,
yes it works for my example.
I have created a new Repl with the same procedure and it works too. Excellent !
Can we have a small explanation about why it did not work ? it seems so strange that a new template would disable another different feature and strange too that not so many people complained about that
I also helps us to trust repl.it and know wthat we can now use this new tool without any risk
Thanks
Sure thing! When you click the “run” button, the Replit workspace sends a “run” command to the Repl. The Repl runs your program and starts the process. If you hit the web URL of your web server without having first started the process, our proxy web server first sends a “run” command to the Repl to “wake it up”.
Nix modules added some 2 new parameters to the “run” command, in particular, a runner ID - identifying how to run the program given it’s file extension, and a file path - the file to run. This gives us flexibility to support multiple programming languages in the same Repl. The workspace would figure out what runner ID and file path to send while you are developing, but this broke the wake up process because it did not know what parameters to send.
We fixed this by re-implementing some logic of the workspace in the backend so that even when those parameters are not provided, the Repl can infer them based on the module that’s active and the entrypoint specified in .replit.