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:

uv add spiderweb-framework
# or
pip install 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!

Development (using uv)

This repository uses uv for local development and testing.

  • Create a virtual environment: uv venv
  • Activate it (Windows): .venv\Scripts\activate
  • Activate it (POSIX): source .venv/bin/activate
  • Install deps (editable + dev): uv pip install -e .[dev]
  • Run tests: uv run python -m pytest
  • Lint/format: uv run ruff check . and uv run black .

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 SQLAlchemy, but you can use whatever you want as long as there's a SQLAlchemy 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-2.5.1.tar.gz (639.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

spiderweb_framework-2.5.1-py3-none-any.whl (91.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: spiderweb_framework-2.5.1.tar.gz
  • Upload date:
  • Size: 639.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for spiderweb_framework-2.5.1.tar.gz
Algorithm Hash digest
SHA256 aeb292259da9ed0522182ee4a3fb44f1a5c663cbc9931d2c5d7fd926928c4466
MD5 1db947a66edd07dae289b67c23c50e14
BLAKE2b-256 01f8c3f637e677c3c5c81bb6bf64644465fd562fac0f0ccf1a7dabc070845872

See more details on using hashes here.

File details

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

File metadata

  • Download URL: spiderweb_framework-2.5.1-py3-none-any.whl
  • Upload date:
  • Size: 91.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for spiderweb_framework-2.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 606d732df25f1d9f3321a6613ad14ce757f90bad24fd29313c2f8cca31c7e275
MD5 3b2fe07e3a40fb8e96c38bd595815bd7
BLAKE2b-256 0eecf0a856e3730a8248d6a6d23409a6da1ad01875647478da6af64472a78634

See more details on using hashes here.

Supported by

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