A small web framework, just big enough for a spider.
Project description
spiderweb
As a professional web developer focusing on arcane uses of Django for arcane purposes, it occurred to me a little while ago that I didn't actually know how a web framework worked.
So I built one.
spiderweb
is a small web framework, just big enough to hold a spider. Getting started is easy:
poetry add spiderweb-framework
Create a new file and drop this in it:
from spiderweb import SpiderwebRouter
from spiderweb.response import HttpResponse
app = SpiderwebRouter()
@app.route("/")
def index(request):
return HttpResponse("HELLO, WORLD!")
if __name__ == "__main__":
app.start()
View the docs here!
My goal with this framework was to do three things:
- Learn a lot
- Create an unholy blend of Django and Flask
- Not look at any existing code. Go off of vibes alone and try to solve all the problems I could think of in my own way
And, honestly, I think I got there. Here's a non-exhaustive list of things this can do:
- Function-based views
- Optional Flask-style URL routing
- Optional Django-style URL routing
- URLs with variables in them a lá Django
- Full middleware implementation
- Limit routes by HTTP verbs
- Custom error routes
- Built-in dev server
- Gunicorn support
- HTML templates with Jinja2
- Static files support
- Cookies (reading and setting)
- Optional append_slash (with automatic redirects!)
- CSRF middleware
- CORS middleware
- Optional POST data validation middleware with Pydantic
- Session middleware with built-in session store
- Database support (using Peewee, but you can use whatever you want as long as there's a Peewee driver for it)
- Tests (currently roughly 89% coverage)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file spiderweb_framework-1.3.0.tar.gz
.
File metadata
- Download URL: spiderweb_framework-1.3.0.tar.gz
- Upload date:
- Size: 30.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.3 Darwin/23.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fac9ff7477162842b588da1488929a91a56066e4efac1c27fe62ad90347333f4 |
|
MD5 | 83d40e5c276185359f46ef86610df45d |
|
BLAKE2b-256 | d93303022ae9445a24da81cc12ce08fba1b3fa9365e98c12dfadec6ba5118f74 |
File details
Details for the file spiderweb_framework-1.3.0-py3-none-any.whl
.
File metadata
- Download URL: spiderweb_framework-1.3.0-py3-none-any.whl
- Upload date:
- Size: 39.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.3 Darwin/23.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1092cf4267983120cd465e7d85579ce7e28f869ed83296af2d4179adfe224598 |
|
MD5 | 182e439f2aad24bdf2176486ec0c9efc |
|
BLAKE2b-256 | 22d0bdbb6fdd5a6a7490057a0e2150f72a73b3d895e4d4def530fe6ed6af6f27 |