madness: a method for your madness
It is built upon WSGI and the fabulous werkzeug routing system, like Flask.
Guiding Principles
Dependency inversion principle
Goals
Installing
$ pip install -U madness
A Simple Example
from madness import application, get
def hello():
return 'Hello, world!'
if __name__ == '__main__':
application(get('/', hello)).run()
Routing
-
route and variants
-
routes and variants
-
defaults
-
url parameters
from madness import routes, route, get, post, index
def hello():
return 'world'
def bar():
return 'zing!'
# recommended style
urls = routes(
index(hello),
routes(
index(lambda: 'foo')
route(bar, methods=['GET', 'POST', 'PUT']),
path = '/foo'
)
)
# flat style
urls = routes(
route('/', hello, methods=['GET']),
route('/foo', lambda: 'foo', methods=['GET']),
route('/foo/bar', bar, methods=['GET', 'POST', 'PUT']),
)
# add GET to all routes
urls = routes(
route('/', hello),
route('/foo', lambda: 'foo'),
route('/foo/bar', bar, methods=['POST', 'PUT']),
methods = ['GET']
)
Abstractions (Dependency inversion principle)
-
g
-
extending g
-
madness.G and g_factory
Middleware (Coroutines)
as decorator
as serializer
as request-contextmanager
as response contextmanager
as request-response contextmanager
as error handler
Extensions
-
json
-
cors
Metadata
Release files for madness 0.7.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 |
|---|---|---|---|---|
| madness-0.7.0.tar.gz | 5.1 kB | Without provenance | Details for madness-0.7.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| madness-0.7.0-py3-none-any.whl | Python 3 | none | any | Details for madness-0.7.0-py3-none-any.whl |
Total release size: 12.2 kB
Release files / madness-0.7.0.tar.gz
| Download URL | madness-0.7.0.tar.gz |
|---|---|
| Size | 5.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e9ca388fe1bbebf4c8b0efc9b7535c251366957b2a591da96bbcd6ccc7d94abd
|
|
BLAKE2b-256 checksum How to use checksums |
6246e5347b3ab396e299a58f4e3359b3adad3abb9da51ef34e12675f6f2560c5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.1
|
Release files / madness-0.7.0-py3-none-any.whl
| Download URL | madness-0.7.0-py3-none-any.whl |
|---|---|
| Size | 7.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ccb1b768e3d5c1589c1de4885918a3ff82a547901893c87918c53476d181b994
|
|
BLAKE2b-256 checksum How to use checksums |
3da78df6e4a2b8e7e476179537e5f738b899e5e598553d3d3a0eaf4cbf0f50fd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.1
|
Security for madness 0.7.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.