Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tsileo/little-boxes
Tiny ActivityPub framework written in Python, both database and server agnostic.
https://github.com/tsileo/little-boxes
activitypub microblogpub python
Last synced: about 1 month ago
JSON representation
Tiny ActivityPub framework written in Python, both database and server agnostic.
- Host: GitHub
- URL: https://github.com/tsileo/little-boxes
- Owner: tsileo
- License: isc
- Archived: true
- Created: 2018-06-11T18:57:45.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-01-26T11:38:39.000Z (almost 5 years ago)
- Last Synced: 2024-05-23T04:01:02.465Z (5 months ago)
- Topics: activitypub, microblogpub, python
- Language: Python
- Homepage: https://little-boxes.a4.io
- Size: 332 KB
- Stars: 80
- Watchers: 12
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Little Boxes
Tiny [ActivityPub](https://activitypub.rocks/) 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](http://github.com/tsileo/microblog.pub).
## 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
```python
from little_boxes import activitypub as apfrom mydb import db_client
class MyBackend(ap.Backend):
def __init__(self, db_connection):
self.db_connection = db_connectiondef 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
- [microblog.pub](http://github.com/tsileo/microblog.pub) (using MongoDB as a backend)
- [pubgate](https://github.com/autogestion/pubgate)## 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.