Pants

Pants is a lightweight framework for writing asynchronous network applications in Python. Pants is simple, fast and elegant.

Pants is available under the Apache License, Version 2.0

An incomplete feature list:
  • Single-threaded, asynchronous, callback-oriented.
  • TCP networking - clients and servers!
  • IPv4, IPv6 and UNIX socket families.
  • SSL/TLS support for all that security stuff.
  • Basic scheduling and timers.
  • A speedy HTTP server with a handy WebSockets implementation.
  • A simple web framework and support for WSGI.

And it’s all so, so easy to use. Check it out:

from pants import Engine, Server, Stream

class Echo(Stream):
    def on_read(self, data):
        self.write(data)

Server(Echo).listen(4040)
Engine.instance().start()

Here’s a web example for good measure:

from pants.web import Application

app = Application()

@app.route('/')
def hello(request):
    return "Hello, World!"

app.run()

And here’s how you get Pants:

pip install pants
Want to get started? There’s plenty to do:
Read the Docs v: latest
Versions
latest
Downloads
PDF
HTML
Epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.