Skip to content
Tiny ActivityPub framework written in Python, both database and server agnostic.
Branch: master
Clone or download
Latest commit 9724059 Apr 24, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs
little_boxes
tests Fix tests Apr 23, 2019
.drone.yml Tweak CI pipeline Apr 13, 2019
.gitignore Start documention Jun 15, 2018
.isort.cfg Add isort conf Jun 15, 2018
.readthedocs.yml
LICENSE Initial commit Jun 11, 2018
MANIFEST.in
README.md Also remove codecov Apr 11, 2019
dev-requirements.txt More tests and cleanup Jun 15, 2018
requirements.txt
setup.cfg Initial commit Jun 11, 2018
setup.py fix unicode hashtag Feb 24, 2019

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.

Until a first version is released, the main goal of this framework is to power the microblog.pub microblog engine.

Features

  • Database and server agnostic
    • You need to implement a backend that respond to activity side-effects
    • This also mean you're responsible for serving the activities/collections and receiving them
  • ActivityStreams helper classes
    • with Outbox/Inbox abstractions
  • Content helper using Markdown
    • 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.id, 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.

You can’t perform that action at this time.