This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!
Project Description


An asynchronous, event driver web framework for the Python programming language.

Pyjoyment provides own reactor which handles I/O and timer events in its own main event loop but it supports other loops, ie. libev, asyncio.

Pyjoyment uses intensively own event emmiter which should be familiar for Node.JS programmers.

It provides tool set for parsing and creating HTTP messages and HTML documents. It also supports WSGI interface.

Pyjoyment is compatible with Python 2.7+, Python 3.3+ and PyPy 2.4+. It doesn’t require any external libraries or compilers.


Pyjoyment is based on Mojolicious: a next generation web framework for the Perl programming language.


Early developement stage. Implemented already:

  • WSGI adapter
  • HTTP standalone async-io server
  • WebSockets client and server
  • HTTP user agent with TLS/SSL support
  • JSON pointers implementation based on RFC6901
  • Embedded files loader
  • HTML/XML DOM parser with CSS selectors
  • URL parser with container classes for URL, path and querystring
  • Non-blocking TCP client and server
  • Simple logging object
  • Synchronizer and sequentializer of multiple events
  • Main event loop which handle IO and timer events
  • Event emitter with subscriptions
  • Low level event reactor based on select(2) and poll(2)
  • Convenient functions and classed for unicode and byte strings and lists
  • Lazy properties for objects
  • Test units with API based on Perl’s Test::More and TAP protocol


Web scraping

import Pyjo.UserAgent
from Pyjo.String.Unicode import u

tx ='')
for n in tx.res.dom('#named-character-references-table tbody > tr').each():
    u('td > code').text + ' ' + n.children('td')[1].text).trim().say()

URL manipulation

import Pyjo.URL
from Pyjo.String.Unicode import u

# 'ssh+git://'
url ='')
print(url.set(scheme='ssh+git', userinfo='git', path=u(url.path) + '.git'))

# ''
      .set(query={'q': 'Mojo::URL', 'size': 20}))

Non-blocking TCP client/server

import Pyjo.IOLoop

# Listen on port 3000
def server(loop, stream, cid):

    def read(stream, chunk):
        # Process input chunk
        print("Server: {0}".format(chunk.decode('utf-8')))

        # Write response
        stream.write(b"HTTP/1.1 200 OK\x0d\x0a\x0d\x0a")

        # Disconnect client

# Connect to port 3000
def client(loop, err, stream):

    def read(stream, chunk):
        # Process input
        print("Client: {0}".format(chunk.decode('utf-8')))

    # Write request
    stream.write(b"GET / HTTP/1.1\x0d\x0a\x0d\x0a")

# Add a timer
def timeouter(loop):
    # Shutdown server

# Start event loop

Standalone HTTP server serving embedded template file

# -*- coding: utf-8 -*-

import Pyjo.Server.Daemon
import Pyjo.URL

from Pyjo.Loader import embedded_file
from Pyjo.Util import b, u

import sys

opts = dict([['address', ''], ['port', 3000]] + list(map(lambda a: a.split('='), sys.argv[1:])))
listen = str('http', host=opts['address'], port=opts['port']))

daemon =[listen])

# Embedded template file
DATA = u(r'''
@@ index.html.tpl
<!DOCTYPE html>
<meta charset="UTF-8">
<h1>♥ Pyjoyment ♥</h1>
<h2>This page is served by Pyjoyment framework.</h2>
<p>{method} request for {path}</p>

def request(daemon, tx):
    # Request
    method = tx.req.method
    path = tx.req.url.path

    # Template
    template = embedded_file(sys.modules[__name__], 'index.html.tpl')

    # Response
    tx.res.code = 200
    tx.res.headers.content_type = 'text/html; charset=utf-8'
    tx.res.body = b(template.format(**locals()))

    # Resume transaction
Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
Pyjoyment-0.0.1-py2.py3-none-any.whl (163.6 kB) Copy SHA256 Checksum SHA256 py2.py3 Wheel Mar 27, 2016
Pyjoyment-0.0.1.tar.gz (127.7 kB) Copy SHA256 Checksum SHA256 Source Mar 27, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting