FastHttpPy
Python implementation of Golang FastHttp
63k requests/second (for comparisons the fastest Python server (uvicorn) does 8k/s without multiprocess)
Benchmark made on MacBook Pro M2 Pro
pip install fasthttppy
Example:
from fasthttppy import FastHttp, MakeResponse, Request
app = FastHttp()
app.Static("/static","static")
def my_callback(req:Request):
print(req.contents.GetURI())
print(req.contents.GetHeaders())
print(req.contents.GetData())
return MakeResponse(200,"Hello world")
app.Get("/py",my_callback)
app.Post("/py",my_callback)
app.Run()
Methods:
class FastHttp:
def Static(self,path:str,dir:str)
#=-=-=Serve static folder=-=-=
#path: url path
#dir: folder
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
def Get(self,path:str,function:Callable)
#=-=-Bind path to function-=-=
#path: url path
#function: function
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
def Post(self,path:str,function:Callable)
#=-=-Bind path to function-=-=
#path: url path
#function: function
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
def SetErrorPage(self,content:str)
#=-=-=-=Set error page-=-=-=-=
#content: html content
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
def SetNotFoundPage(self,path:str,dir:str)
#=-=-=-=-Set 404 page=-=-=-=-=
#content: html content
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
def Run(self,host:str,port:int)
#=-=-=-=Start Go server=-=-=-=
#host: server host
#port: server port
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
It is still possible to improve performance a lot, the golang/py communication is done through a *C.char Json that can be replaced by structs (removing the json encode decode step)
Metadata
Release files for fasthttppy 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| fasthttppy-0.0.2.tar.gz | 6.0 kB | Without provenance | Details |
Release files / fasthttppy-0.0.2.tar.gz
| Download URL | fasthttppy-0.0.2.tar.gz |
|---|---|
| Size | 6.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
db95a970ced204c7579174de51e7e2187f55e80e4a5a4378a78237592d8b9dbe
|
|
BLAKE2b-256 checksum How to use checksums |
353686f1cdbc863f79f40b09e2d9ddc015c896b6a6ab6a3fc0ed359454c7ead7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.5
|
Security for fasthttppy 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.