PyPy Python template

Describe your feature request

I’d love to have a template for a Python repl based on the PyPy implementation of Python.

What problem(s) would this feature solve?

Python is a great language, but usually lacks performance. The PyPy implementation fixes this issue in a lot of circumstances.

Explain what you were trying to do when you came across the problem leading to this feature request

Image generation or running high complexity algorithms.

Here you go: https://replit.com/@NuclearPasta0/PyPy?v=1
This template uses PyPy 3.10.

It’s very easy to run pypy on your own repls. Open the System dependencies tool and install pypy3, then show hidden files and change or add the run command in .replit file. (This will probably be PyPy 3.9.)

A more difficult alternative to PyPy for performance is Cython.

5 Likes

Thanks a lot, that looks nice!

May I ask what this exactly means:

When I open the Systems Dependencies Tool there’s no option to actually install anything. I could just create the Nix file and add the pkgs.pypy310 dependency - is that what you mean?

Edit: I’ve just tried adding the Nix file with the PyPy-dependency and it worked.

I’ve used Cython quite a bit, but for my use cases PyPy turned out to be the better (faster) option :open_mouth:, and I found it much easier to handle.

3 Likes

The System Dependencies tool is not guaranteed to the search and install functionality.
I believe the specific nix channel that the repl uses (which can be viewed and edited in .replit file) determines this, 23.05 has it while 23.11 doesn’t. (But 23.05 does not have pypy 3.10)

It certainly depends on the use case. For example, I was almost required to use Cython for my brute force algorithm rather than python or pypy, and it has indeed given me the performance of C. However, the code has to be adapted more to gain the full performance and it has all the drawbacks of coding in C.

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.