Hump
Hump (a defining part of grizzly's neck) is a zero-dependency simple async web server framework for registering request handlers
Why
- Because dataclasses have smaller overhead than Pydantic models.
- "I understand how something works only if i know how to create it myself"
- Making software from scratch is something that is inherently fun and challenging
How
- Python
socketpackage provides the means to connect/accept withAF_INET(TCP/IP) protocol - Create a socket, set it up as non-blocking, bind to
host, portpair - Listen for incoming connections on socket
- When client connects, accept, create an asyncio task to handle this request further, main return to 3 to accept other clients
- Parse incoming request into dataclass
Requestmodel, pass it into registered async handler byurl, methodpair - Gather response data/
Responseobject, encode to bytes and send it back - Close socket and finish task
Usage example
import asyncio
from hump import Hump, Request
app = Hump("", 8342)
@app.get("/")
async def index(request: Request):
return "Hello, world!"
asyncio.run(app.serve())
And that's it, you can run this example, go to your browser and perform http request to localhost:8342 to get Hello, world! answer.
You can also return another HTTP status code with data attached like this
from hump import Response, statuses
# ... As defined in example usage before
@app.get("/")
async def index(request: Request)
return Response("Howdy!", statuses.IM_A_TEAPOT)
Limitations
- HTTP/1.1 only, no HTTPS
- No automatic headers handling
- No automatic json response handling, only
strtoResponsewrapping
Metadata
Release files for hump 1.1.0
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 | Actions |
|---|---|---|---|---|
| hump-1.1.0.tar.gz | 8.4 kB | Without provenance | Details for hump-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| hump-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for hump-1.1.0-py3-none-any.whl |
Total release size: 17.1 kB
Release files / hump-1.1.0.tar.gz
| Download URL | hump-1.1.0.tar.gz |
|---|---|
| Size | 8.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
981666e85487445c8f1ccfacdb2f6cd1d766989b41902c8699d33f36ea338fcc
|
|
BLAKE2b-256 checksum How to use checksums |
6d782adf77028b81e09850683d04296ad3a6a9e911bdcc392fbc57f7ddcb95df
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.7
|
Release files / hump-1.1.0-py3-none-any.whl
| Download URL | hump-1.1.0-py3-none-any.whl |
|---|---|
| Size | 8.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6b49d74215443951909fb01a9ab3f771faa83f15c34ca19683787ee4a8e8e055
|
|
BLAKE2b-256 checksum How to use checksums |
95c76a7b2b242f9e1aee9bbdd08a6f7dd03d0542f0a2a1ce9f90baa2e56bdc73
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.7
|
Security for hump 1.1.0
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.