Skip to main content
Warning: You are using the test version of PyPI. This is a pre-production deployment of Warehouse. Changes made here affect the production instance of TestPyPI (
Help us improve Python packaging - Donate today!

A python framework for building matrix application services

Project Description


Copyright 2016 Adam Beckmeyer

This file is part of Gyr.

Gyr is free software: you can redistribute it and/or modify it under the terms
of the GNU General Public License as published by the Free Software Foundation,
either version 3 of the License, or (at your option) any later version.

Gyr is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with
Gyr. If not, see <>.


# Gyr

Gyr is a framework for quickly developing [matrix](
services]( in
python3. It provides a WSGI application and several other utilities for working
with matrix.

Gyr is designed to be a fairly thin layer of abstraction over application
service api--just enough to make things easy without pushing you so far from the
spec that you get confused.

# Installation

Please install gyr with pip (in a virtualenv if you prefer):

pip install gyr

# Usage

I'll try to show a bunch of functionality here, but see examples directory for
further usage examples.

from gyr import server, matrix_objects

application = server.Application("http://localhost:8008", "foobar")

as_user = matrix_objects.MatrixUser("",
room = as_user.create_room(alias="", is_public=True)

def rm_hndlr(room_id):
# Gyr will create a user for you if this returns true!
return False

def user_hndlr(user_id):
# Gyr will create the room for you if this returns true!
return False

def txn_hndlr(events):
for event in events:
"Received event type {} in room {} from user {}".format(event.type,,
return True

application.add_handlers(room_handler=rm_hndlr, transaction_handler=txn_hndlr,

Save as Then from the commandline:

gunicorn example:application

# Status

Very alpha! Most of the main functionality I'd envisioned is present, however
there's poor to non-existent documentation and no unit tests. Contributions are

# Projects Using Gyr

None for now! Check back later.

# Modules

## gyr.server

`server` provides the WSGI application class. An instance of
gyr.server.Application functions as the WSGI app and will automatically
parse the request and call any handlers provided to the Application

## gyr.api

`api` provides a helpful wrapper for
api, changing the parts of the api that are different for application
services until such time as similiar changes are merged upstream. Pull
requests for these changes have been submitted, and some changes already
merged into master.

For working with the api, I recommend using the wrappers built around
specific objects which are available in gyr.matrix_objects.

## gyr.matrix_objects

`matrix_objects` provides helpful wrapper classes around matrix users,
events and rooms. It is not designed to be easily used for the normal
client-server api but should provide most necessary functionality for
the manipulation of users and rooms that an application service might
need to do.

Pull requests enriching the functionality of these classes are very

# Gyr Internals

Gyr builds on [falcon]( to create its WSGI
application class. For sending http requests, Gyr uses

Release History

History Node


History Node


This version
History Node


History Node


History Node


History Node


History Node


History Node


Download Files

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

File Name & Hash SHA256 Hash Help Version File Type Upload Date
(7.3 kB) Copy SHA256 Hash SHA256
Source Apr 22, 2017

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