Skip to main content

A small web framework, just big enough for a spider.

Project description

spiderweb

PyPI release version for Spiderweb Gitmoji Code style: Black

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:

  1. Learn a lot
  2. Create an unholy blend of Django and Flask
  3. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spiderweb_framework-1.4.0.tar.gz (31.7 kB view details)

Uploaded Source

Built Distribution

spiderweb_framework-1.4.0-py3-none-any.whl (41.2 kB view details)

Uploaded Python 3

File details

Details for the file spiderweb_framework-1.4.0.tar.gz.

File metadata

  • Download URL: spiderweb_framework-1.4.0.tar.gz
  • Upload date:
  • Size: 31.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.13.0 Darwin/23.6.0

File hashes

Hashes for spiderweb_framework-1.4.0.tar.gz
Algorithm Hash digest
SHA256 cfe4c2ca6596fc8e231adf9396d33f697699010060a3a2b4d726fbdee2a3c926
MD5 564f5fab3902f7626cfb98a42de543b1
BLAKE2b-256 5e24db393201b8a5b674a27d62128ee301f8b22f35e2cc4def5d9fbd6bf13976

See more details on using hashes here.

File details

Details for the file spiderweb_framework-1.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for spiderweb_framework-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1b8b33b00653aabb7ccb060195d99dcb278be548b785e755464cf5b6b692af04
MD5 32753120e633e160931bb2412041a73e
BLAKE2b-256 5a97e7f06f76c546cf946cbb1b861d036ac42afba474d9e8d3942ca99529b0d6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page