Socketify.py is a reliable, high-performance Python web framework for building large-scale app backends and microservices.
 
 
 
 
 
 
Go to file
Ciro a1134dc914 add graph 2022-11-08 10:07:18 -03:00
.github/workflows Update linux.yml 2022-11-05 13:27:02 -03:00
bench add graph 2022-11-08 10:07:18 -03:00
examples add graph 2022-11-08 10:07:18 -03:00
misc add png logo 2022-11-08 08:10:10 -03:00
src Merge branch 'main' of https://github.com/cirospaciari/socketify.py 2022-11-08 07:44:22 -03:00
.gitignore new Makefile for shared libraries 2022-11-01 17:09:56 -03:00
.gitmodules fix modules?? 2022-05-28 20:18:31 -03:00
CODE_OF_CONDUCT.md add CODE_OF_CONDUCT and get_headers 2022-10-28 17:27:34 -03:00
LICENSE Initial commit 2022-05-24 16:29:51 -03:00
README.md add graph 2022-11-08 10:07:18 -03:00
setup.py rollback perf tests 2022-11-06 07:25:07 -03:00

README.md

socketify.py

Logo

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

We created and adapt the full C API from uNetworking/uWebSockets and integrate libuv powered fetch and file IO, this same C API is used by Bun

Benchmark

HTTP requests per second (Linux x64)

124,943
socketify PyPy3
70,877
socketify Python3
30,173
gunicorn Python3
17,580
gunicorn PyPy3

Runtime versions: PyPy3 7.3.9 and Python 3.10.7
Framework versions: gunicorn 20.1.0 + uvicorn 0.19.0, socketify alpha
Tested with ./http_load_test 40 127.0.0.1 8000 from [uSockets](https://github.com/uNetworking/uSockets) Source code in [bench](https://github.com/cirospaciari/socketify.py/tree/main/bench)

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

Using install via requirements.txt

git+https://github.com/cirospaciari/socketify.py.git@main#socketify
pip install -r ./requirements.txt 
#or specify PyPy3
pypy3 -m pip install -r ./requirements.txt 

Examples

Hello world app

from socketify import App

app = App()
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()

SSL version sample

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()

We have more than 20 examples click here for more

Build local from source

#clone and update submodules
git clone https://github.com/cirospaciari/socketify.py.git
cd ./socketify.py
git submodule update --init --recursive --remote
#you can use make linux, make macos or call Make.bat from Visual Studio Development Prompt to build
cd ./src/socketify/native/ && make linux && cd ../../../
#install local pip
pypy3 -m pip install .
#install in editable mode
pypy3 -m pip install -e .
#if you want to remove
pypy3 -m pip uninstall socketify