Tiny ActivityPub framework written in Python, both database and server agnostic.
Go to file
Thomas Sileo 69ac8e18a7 Add isort conf 2018-06-16 00:27:09 +02:00
little_boxes More tests 2018-06-16 00:11:53 +02:00
tests More tests 2018-06-16 00:11:53 +02:00
.gitignore Cleanup the tests 2018-06-13 20:08:12 +02:00
.isort.cfg Add isort conf 2018-06-16 00:27:09 +02:00
.travis.yml More tests 2018-06-13 23:15:09 +02:00
LICENSE Initial commit 2018-06-11 22:50:02 +02:00
MANIFEST.in Cleanup 2018-06-12 19:57:40 +02:00
README.md Update the README 2018-06-13 21:54:46 +02:00
dev-requirements.txt More tests and cleanup 2018-06-15 23:53:25 +02:00
requirements.txt Cleanup 2018-06-12 19:57:40 +02:00
setup.cfg Initial commit 2018-06-11 22:50:02 +02:00
setup.py Import more stuff from microblog.pub 2018-06-13 21:42:03 +02:00

README.md

Little Boxes

Build Status License Code style: black

Tiny ActivityPub framework written in Python, both database and server agnostic.

Still in early development, and not published on PyPI yet.

Features

  • Database and server agnostic
    • You need to implement a backend that respond to activiy side-effects
    • This also need you're responsible for serving the activities/collections and receiving them
  • ActivityStreams helper classes
    • with Outbox/Inbox abstractions
  • Content helper using Mardown
    • with helpers for parsing hashtags and linkify content
  • Key (RSA) helper
  • HTTP signature helper
  • JSON-LD signature helper
  • Webfinger helper

Getting Started

from little_boxes import activitypub as ap

from mydb import db_client


class MyBackend(ap.Backend):

    def __init__(self, db_connection):
        self.db_connection = db_connection    

    def inbox_new(self, as_actor: ap.Person, activity: ap.Activity) -> None:
        # Save activity as "as_actor"
        # [...]

    def post_to_remote_inbox(self, as_actor: ap.Person, payload: ap.ObjectType, recipient: str) -> None:
        # Send the activity to the remote actor
        # [...]


db_con = db_client()
my_backend = MyBackend(db_con)

ap.use_backend(my_backend)

me = ap.Person({})  # Init an actor
outbox = ap.Outbox(me)

follow = ap.Follow(actor=me, object='http://iri-i-want-follow')
outbox.post(follow)

Projects using Little Boxes

Contributions

TODO: document Mypy, flake8 and black.

PRs are welcome, please open an issue to start a discussion before your start any work.

License

ISC, see the LICENSE file.