Compare commits
No commits in common. "29b16b537144e46f876d27c3f16a2e2d8270daf9" and "9dc3013c406908d98e5daa8d223bc1bc7c889ad0" have entirely different histories.
29b16b5371
...
9dc3013c40
63
README.md
63
README.md
@ -1,64 +1,3 @@
|
|||||||
# spiderweb
|
# 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_.
|
A learning opportunity for a web framework.
|
||||||
|
|
||||||
So I built one.
|
|
||||||
|
|
||||||
`spiderweb` is a small web framework, just big enough to hold a spider. Getting started is easy:
|
|
||||||
|
|
||||||
```shell
|
|
||||||
poetry add spiderweb-framework
|
|
||||||
```
|
|
||||||
|
|
||||||
Create a new file and drop this in it:
|
|
||||||
|
|
||||||
```python
|
|
||||||
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()
|
|
||||||
```
|
|
||||||
|
|
||||||
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
|
|
||||||
* Gunicorn support
|
|
||||||
* Full middleware implementation
|
|
||||||
* Limit routes by HTTP verbs
|
|
||||||
* Custom error routes
|
|
||||||
* Built-in dev server
|
|
||||||
* HTML templates with Jinja2
|
|
||||||
* Static files support
|
|
||||||
* Cookies (reading and setting)
|
|
||||||
* Optional append_slash (with automatic redirects!)
|
|
||||||
* ~~CSRF middleware implementation~~ (it's there, but it's crappy and unsafe. I'm working on it.)
|
|
||||||
* Optional POST data validation middleware with Pydantic
|
|
||||||
|
|
||||||
The TODO list:
|
|
||||||
|
|
||||||
* Tests (important)
|
|
||||||
* Database support
|
|
||||||
* Session middleware
|
|
||||||
* Fix CSRF middleware once database support is included
|
|
||||||
|
|
||||||
Once tests are in and proven to work, then I'll release as version 1.0.
|
|
||||||
|
|
||||||
More documentation to follow!
|
|
||||||
|
|
||||||
If you're reading this on GitHub, this repository is a public mirror of https://git.joekaufeld.com/jkaufeld/spiderweb.
|
|
@ -1,31 +1,9 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "spiderweb-framework"
|
name = "spiderweb"
|
||||||
version = "0.10.0"
|
version = "0.10.0"
|
||||||
description = "A small web framework, just big enough for a spider."
|
description = "A small web framework, just big enough to hold your average spider."
|
||||||
authors = ["Joe Kaufeld <opensource@joekaufeld.com>"]
|
authors = ["Joe Kaufeld <opensource@joekaufeld.com>"]
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
packages = [{include = "spiderweb"}]
|
|
||||||
exclude = [
|
|
||||||
"tests/*",
|
|
||||||
"example.py",
|
|
||||||
"example2.py",
|
|
||||||
"static_files/*",
|
|
||||||
"templates/*",
|
|
||||||
"example_middleware.py",
|
|
||||||
]
|
|
||||||
classifiers = [
|
|
||||||
"Development Status :: 4 - Beta",
|
|
||||||
"Environment :: Web Environment",
|
|
||||||
"Intended Audience :: Developers",
|
|
||||||
"Programming Language :: Python :: 3 :: Only",
|
|
||||||
"Programming Language :: Python :: 3.11",
|
|
||||||
"Programming Language :: Python :: 3.12",
|
|
||||||
"Programming Language :: Python :: 3.13",
|
|
||||||
"Topic :: Internet :: WWW/HTTP :: HTTP Servers",
|
|
||||||
"Topic :: Internet :: WWW/HTTP :: WSGI",
|
|
||||||
"Topic :: Internet :: WWW/HTTP :: WSGI :: Application",
|
|
||||||
"Topic :: Software Development :: Libraries :: Application Frameworks",
|
|
||||||
]
|
|
||||||
|
|
||||||
[tool.poetry.dependencies]
|
[tool.poetry.dependencies]
|
||||||
python = "^3.11"
|
python = "^3.11"
|
||||||
@ -46,9 +24,3 @@ requires = ["poetry-core"]
|
|||||||
build-backend = "poetry.core.masonry.api"
|
build-backend = "poetry.core.masonry.api"
|
||||||
|
|
||||||
[tool.poetry_bumpversion.file."spiderweb/constants.py"]
|
[tool.poetry_bumpversion.file."spiderweb/constants.py"]
|
||||||
|
|
||||||
[project.urls]
|
|
||||||
Homepage = "https://github.com/itsthejoker/spiderweb"
|
|
||||||
Documentation = "https://github.com/itsthejoker/spiderweb"
|
|
||||||
Repository = "https://git.joekaufeld.com/jkaufeld/spiderweb"
|
|
||||||
"Bug Tracker" = "https://github.com/itsthejoker/spiderweb/issues"
|
|
||||||
|
Loading…
Reference in New Issue
Block a user