Skip to main content

A general Python ActivityPub library

Project description

This is a Python library to use with
ActivityPub. ActivityPub
is an API for an open, distributed, social network.


You can install the development version of activitypub with:

pip install git+git://

or the last packaged version with:

pip install activitypub

To use with redis:

pip install redis redis_collections

OR to use with mongodb:

pip install pymongo

OR to use with SQLAlchemy:

pip install sqlalchemy


This module is designed to be a generally useful ActivityPub library in Python. It targets three different levels of use:

  • ActivityPub object API
  • ActivityPub database API
  • Webserver API

These levels can be used independently, or together. They can best be used together using a Manager:

>>> from activitypub.manager import Manager
>>> from activitypub.database import ListDatabase
>>> db = ListDatabase()
>>> manager = Manager(database=db)
>>> p = manager.Person(id="alyssa")
>>> p.to_dict()
{'@context': '',
 'endpoints': {},
 'followers': '',
 'following': '',
 'id': '',
 'inbox': '',
 'liked': '',
 'likes': '',
 'outbox': '',
 'type': 'Person',
 'url': ''}
>>> db.actors.insert_one(p.to_dict())
>>> db.actors.find_one({"id": ''})
{'@context': '',
 'endpoints': {},
 'followers': '',
 'following': '',
 'id': '',
 'inbox': '',
 'liked': '',
 'likes': '',
 'outbox': '',
 'type': 'Person',
 'url': '',
 '_id': ObjectId('5b579aee1342a3230c18fbf7')}

activitypub supports the following databases:

  • MongoDB
  • SQL dialects — any that that sqlalchemy supports, including:
  • SQLite (including in-memory)
  • Firebird
  • Microsoft SQL Server
  • MySQL
  • Oracle
  • PostgreSQL
  • Sybase
  • … and many more!
  • An in-memory, JSON-based database for testing
  • Redis

The activitypub database API is a subset of the MongoDB.

activitypub is targeting the following web frameworks:

  • Flask
  • Tornado

Others can be supported. Please ask!

The activitypub webservice API is based on Flask’s.

Project details

Download files

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

Files for activitypub, version 0.0.3
Filename, size File type Python version Upload date Hashes
Filename, size activitypub-0.0.3-py2.py3-none-any.whl (42.5 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size activitypub-0.0.3.tar.gz (32.0 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page