Skip to main content

madness: a method for your madness

It is built upon WSGI and the fabulous werkzeug routing system, like Flask.

Guiding Principles

Don't repeat yourself

Dependency inversion principle

Do One Thing and Do It Well.

The Zen of Python

Goals

Cohesion

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)

Source distribution for madness 0.7.0
File Size Uploaded
madness-0.7.0.tar.gz 5.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for madness 0.7.0
File Interpreter ABI Platform
madness-0.7.0-py3-none-any.whl Python 3 none any Details

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

Release history Release notifications | RSS feed

This release

0.7.0 This release

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page