Skip to main content

a python 3.6+ WSGI framework

Project description

pigwig

a pig wearing a wig is humor
a wig wearing a pig is heresy
pigwig is a python 3 WSGI framework
(blogwig is a sample app. don't put wigs on blogs)

#!/usr/bin/env python3

from pigwig import PigWig, Response

def root(request):
	return Response('hello, world!')

routes = [
	('GET', '/', root),
]

app = PigWig(routes)

if __name__ == '__main__':
	app.main()

As I went to Bonner
I met a pig
Without a wig,
Upon my word and honor.

FACs (frequent, annoying comments)

  1. tornado-style class-based views are better
    we think you're wrong (inheritance is a hammer and this problem is no nail), but it's easy enough to achieve:
    def routes():
    	views = [
    		('/', RootHandler),
    	]
    	handlers = []
    	for route, view in views:
    		for verb in ['get', 'post']:
    			if hasattr(view, verb):
    				handlers.append((verb.upper(), route, cbv_handler(view, verb)))
    	return handlers
    
    def cbv_handler(cbv, verb):
    	def handler(request):
    		return getattr(cbv(request), verb)()
    	return handler
    
    class RootHandler:
    	def __init__(self, request):
    		self.request = request
    
    	def get(self):
    		return Response('hello')
    
  2. flask-style decorator-based routing is better
    we think you're wrong (explicit is better than implicit), but it's easy enough to achieve:
    routes = []
    def route(path, method='GET'):
    	def wrapper(handler):
    		routes.append((method, path, handler))
    		return handler
    	return wrapper
    
    @route('/')
    def root(request):
    	return Response('hello')
    
  3. django-style integration with an ORM is better
    you're wrong

coverage status

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

pigwig-0.8.4.tar.gz (14.2 kB view details)

Uploaded Source

Built Distribution

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

pigwig-0.8.4-py3-none-any.whl (16.1 kB view details)

Uploaded Python 3

File details

Details for the file pigwig-0.8.4.tar.gz.

File metadata

  • Download URL: pigwig-0.8.4.tar.gz
  • Upload date:
  • Size: 14.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pigwig-0.8.4.tar.gz
Algorithm Hash digest
SHA256 d5bf59cc071f6ed7e32fd3464108ea9f44a8b1bee9251e7fc0468b4b57a70be7
MD5 ae5068d7686e4dcf2d12eca13bac560c
BLAKE2b-256 c9402187fe7eba286890856f6efc1bf0195787ecb709601191fd7261fb2a8e6b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pigwig-0.8.4.tar.gz:

Publisher: pypi.yaml on raylu/pigwig

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pigwig-0.8.4-py3-none-any.whl.

File metadata

  • Download URL: pigwig-0.8.4-py3-none-any.whl
  • Upload date:
  • Size: 16.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pigwig-0.8.4-py3-none-any.whl
Algorithm Hash digest
SHA256 1231dedbee8f6626049d20589d61f27a50c869d1169a97569747ac29ba14fc7d
MD5 53ac1a7f4905279739eae86f0b9776d8
BLAKE2b-256 3f3d4e359c821b3b27185674fb70c02f42397195db142438e28c919740690a4f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pigwig-0.8.4-py3-none-any.whl:

Publisher: pypi.yaml on raylu/pigwig

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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