Skip to main content

Get the Reddit app

Scan this QR code to download the app now
Or check it out in the app stores

PyPy

Does anyone actually use PyPy or Cython?
r/Python icon
r/Python
A banner for the subreddit

The official Python community for Reddit! Stay up to date with the latest news, packages, and meta information relating to the Python programming language. --- If you have questions or are new to Python use r/LearnPython


Members Online
Does anyone actually use PyPy or Cython?

I have been reading a lot about these tools recently and wondered if they are used in production, especially when building a backend with Python. As far as I know, PyPy is not ideal because of its lack of package support, but Cython seems pretty neat.





CPython vs PyPy vs Cython
r/Python icon
r/Python
A banner for the subreddit

The official Python community for Reddit! Stay up to date with the latest news, packages, and meta information relating to the Python programming language. --- If you have questions or are new to Python use r/LearnPython


Members Online
CPython vs PyPy vs Cython

According to Wikipedia, both PyPy and Cython are chosen when speed is critical or a requirement in the matter.

Speed/perfomance is always a positive thing. But I guess we are sacrificing something else. But since the Python code is the same, we are still having its readibility, right?

Are we losing portability when using PyPy or Cython? Or something else like security?

Thank you in advance.



PyPy or Cython for game development?
r/Python icon
r/Python
A banner for the subreddit

The official Python community for Reddit! Stay up to date with the latest news, packages, and meta information relating to the Python programming language. --- If you have questions or are new to Python use r/LearnPython


Members Online
PyPy or Cython for game development?

Standard Python with Cython has the benefit of C hooks and library support, but PyPy is pretty fast too. Doesn't PyPy get around the GIL and supports threading while Cython doesn't?

So what would you recommend for the best performance. Of course Cython will use cdef hooks whenever possible.







Socketify.py - Maybe the fastest web framework for Python and PyPy
r/Python icon
r/Python
A banner for the subreddit

The official Python community for Reddit! Stay up to date with the latest news, packages, and meta information relating to the Python programming language. --- If you have questions or are new to Python use r/LearnPython


Members Online
Socketify.py - Maybe the fastest web framework for Python and PyPy

This year i started a journey to bring a really fast framework for Http, Http2, Http3 and WebSockets to Python and PyPy.

The problems with japronto and uvloop

Japronto don't get any github updates since 2020 and don't get any src update since 2018, japronto don't support SSL, WebSockets, PyPy3, Windows or macOS Silicon. I really needed good support + performance, not only performance. Almost any solution out there have a really big performance hit when using PyPy3 or are not really fast enougth

The Solution

We discover a really fast, small, and well maintained C++ Library called uNetworking/uWebSockets, but no C API available, so we create and adapt the full C API from uNetworking/uWebSockets and will integrate libuv powered fetch and file IO, this same C API is used by Bun

Benchmarking

We got about 770k req/s with the current version vs 582k from japronto using TechEmPower plaintext benchmarks and we still can get at least 30% or more performance once fully integrated with libuv + asyncio.

Socketify.py brings:

  • WebSocket with pub/sub support

  • Fast and realiable Http/Https

  • Support for Windows, Linux and macOS Silicon & x64

  • Support for PyPy3 and CPython

This project aims to bring high performance PyPy3 web development and will bring:

  • Fetch like API powered by libuv

  • Async file IO powered by libuv

  • Full asyncio integration with libuv

  • Full Http3 support

  • HPy integration to better support CPython, PyPy and GraalPython

Install

For macOS x64 & Silicon, Linux x64, Windows

pip install git+https://github.com/cirospaciari/socketify.py.git
#or specify PyPy3
pypy3 -m pip install git+https://github.com/cirospaciari/socketify.py.git
#or in editable mode
pypy3 -m pip install -e git+https://github.com/cirospaciari/socketify.py.git@main#egg=socketify

Code Example

from socketify import App, AppOptions

app = App(AppOptions(key_file_name="./misc/key.pem", cert_file_name="./misc/cert.pem", passphrase="1234"))
app.get("/", lambda res, req: res.end("Hello World socketify from Python!"))
app.listen(3000, lambda config: print("Listening on port http://localhost:%d now\n" % config.port))
app.run()

Support

Socketify is an active project and will be maintained over time with security updates and new features and will be commercial support available

Check our github page: https://github.com/cirospaciari/socketify.py


CPython Jython IronPython Microapython PyPy RPython Cython, whats the difference what do they do?
r/learnpython icon
r/learnpython

Subreddit for posting questions and asking for general advice about your python code.


Members Online
CPython Jython IronPython Microapython PyPy RPython Cython, whats the difference what do they do?

All these different pythons but I don't understand what they are or what they do, for example Cpython's C-extensions, does that mean we can code C on a Python interpreter or something? Or like the resulting file will be able to be read by a C interpreter? As well a Jython, will Java be able to run its file? What's the resultant file... What's meant when people say Python is already compiled and can be run without the interpreter?



That's why i chose to support PyPy and Python 3.11
r/Python icon
r/Python
A banner for the subreddit

The official Python community for Reddit! Stay up to date with the latest news, packages, and meta information relating to the Python programming language. --- If you have questions or are new to Python use r/LearnPython


Members Online
That's why i chose to support PyPy and Python 3.11

In socketify.py project i chose to support PyPy to get the performance close to Go Fiber, today i implemented one optimization, to reuse requests, responses and websockets objects to avoid dynamic allocations and GC pass. PyPy is just a beast, and i have a lot to optimize yet.

TechEmPower Benchmark on old i7 7700HQ asus notebook with nvme

https://github.com/cirospaciari/socketify.py

If you want to try run on your machine you can clone https://github.com/cirospaciari/FrameworkBenchmarks

Commands used to run on Debian GNU/Linux bookworm/sid x86_64 - kernel 6.0.0-2

sudo ./tfb --mode benchmark --test socketify.py --type plaintext 
sudo ./tfb --mode benchmark --test socketify.py-python3 --type plaintext 
sudo ./tfb --mode benchmark --test fiber --type plaintext



Interesting post: The Python condition. Why PyPy is the future of Python
r/Python icon
r/Python
A banner for the subreddit

The official Python community for Reddit! Stay up to date with the latest news, packages, and meta information relating to the Python programming language. --- If you have questions or are new to Python use r/LearnPython


Members Online




Deciding what to use among Cython / Pypy / Numba
r/Python icon
r/Python
A banner for the subreddit

The official Python community for Reddit! Stay up to date with the latest news, packages, and meta information relating to the Python programming language. --- If you have questions or are new to Python use r/LearnPython


Members Online
Deciding what to use among Cython / Pypy / Numba

So I want to experiment and speed up my code. I have studied the basics of Cython and Numba but Pypy only has 10 year onld videos.

What I have found:

  • Cython converts Python into C and makes the code useable in both Python and C

  • Numba directly converts Python into Machine code and is useful for Math operations (numpy)

  • Numba is JIT compiler

  • Both Cython and Numba don't support 3rd party libraries like Pandas and spacy..

  • Pypy is an implementation of Python. Normally the Python we use when we write python abc.exe in cmd is Cpython(not Cython).

  • Numba and Cython speed up the code a lot if the code is compatible... things like list don't work with Numba...

Would be super helpful if someone can please explain the difference between Numba, Cython and Pypy and when to use which.

Even pointing me to the resources would be great!

Thanks in advance.



Cython, Numba, PyPy - latest comparison (2015)
r/Python icon
r/Python
A banner for the subreddit

The official Python community for Reddit! Stay up to date with the latest news, packages, and meta information relating to the Python programming language. --- If you have questions or are new to Python use r/LearnPython


Members Online
Cython, Numba, PyPy - latest comparison (2015)

I'm curious to find out what people now think about these 3 tools. If I haven't used any of them, and I'm ready to dive into optimizing my code after profiling and identifying bottle necks.

Any suggestions would be appreciated! Thanks!



  • A place for discussion about the Ren'Py visual novel engine and related topics and technologies. members
  • The official Python community for Reddit! Stay up to date with the latest news, packages, and meta information relating to the Python programming language. --- If you have questions or are new to Python use r/LearnPython members
  • For all your baking needs! Recipes, pictures, ideas, questions and all things baking related. Cakes, cookies, pies, tarts, muffins, scones, breads, rolls, biscuits, cheesecakes, snack bars, etc are all welcome! members
  • Comunidad Paraguaya de Gaming, para compartir todo el contenido que este relacionado con videojuegos y Paraguay members
  • The home of pizza on reddit. An educational community devoted to the art of pizza making. members
  • Welcome to /r/CollingwoodFC! The subreddit for all Collingwood Football Club related topics, news and discussion. Feel free to share your opinion and join the sub Discord server (link below). members
  • members
  • The internets number one place for original food images and more! members
  • Subreddit for posting questions and asking for general advice about your python code. members
  • The subreddit for PyScript, the new Python framework that allows users to create rich Python apps in the browser with Python and HTML members
  • AFL: The home of Australian rules football on Reddit, including the Australian Football League and all other aspects of the game. To assign a user flair to yourself on desktop, expand the community options menu below and click the pencil icon by your username. On mobile, tap the 3 dots beside your profile picture and select "change user flair" members
  • ml. Beginners please see learnmachinelearning members
  • A community dedicated to those who use PyMOL. A place to learn, get help, and share what you are doing. Now with actual PyMol Devs on the Mod team! members
  • Computer Programming members
  • A subreddit for tips, queries and all things PsychoPy. members
  • Consider joining our [Discord server](https://discord.gg/7TH6vrF) if you need help. members
  • Welcome to 52 weeks of theme-based baking! This is a great way for beginners to learn, and for experienced bakers to expand their skill set and explore their creativity. members
  • InstaPy members
  • an unofficial place to discuss, and learn about the discord.py library for python. members
  • Community-run subreddit for the game Factorio made by Wube Software. members
  • members
  • You can only whinge if it makes us chuckle members
  • A subreddit dedicated to learning machine learning members
  • Subreddit for development and discussion of /u/Jamee999 's cricket simulator, written in python. members
  • members
  • Each week, we give you an ingredient, technique, cuisine, or inspiration. Each week, you cook a dish in that theme and share the results. Each week, your culinary repertoire gets a little bigger. members
  • For questions and comments about the Plex Media Server. The Plex Media Server is smart software that makes playing Movies, TV Shows and other media on your computer simple. This page is community-driven and not run by or affiliated with Plex, Inc. members
  • El subreddit sobre la nación bilingüe del Paraguay. Lea las reglas antes de postear y comentar (ES) The subreddit about the Bilingual nation of Paraguay. Read the rules before posting and comment. (EN) members
  • RocketPy is the next-generation trajectory simulation solution for High-Power Rocketry. The code is written as a Python library and allows for a complete 6 degrees of freedom simulation of a rocket's flight trajectory, including high fidelity variable mass effects as well as descent under parachutes. Repository: https://github.com/Projeto-Jupiter/RocketPy members
  • The Rochester Python Users Group of Rochester, NY members