Skip to content
/ mahitahi Public

Python-based (sequence) CRDT library for collaborative text editing (only, for now)

License

Notifications You must be signed in to change notification settings

0ip/mahitahi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MahiTahi

a Python-based (sequence) CRDT library for collaborative text editing

WARNING: this repo is not maintained anymore

Status: WIP/Proof of concept

This library relies on the ideas presentend in Logoot and LSEQ.

See examples/mqtt_gui.py for an Etherpad-like clone realized with PyQt's QPlainTextEdit widget, MQTT as broadcast channel and Fernet for encryption.

Table of Contents

Installation

Download or clone the repository using git:

$ git clone https://github.com/0ip/mahitahi.git

Usage

from mahitahi import Doc

init_doc = Doc()
init_doc.insert(0, "A")
init_doc.insert(1, "B")
init_doc.insert(2, "C")
init_doc.insert(3, "\n")

a_doc = deepcopy(init_doc)
a_doc.site = 1
patch_from_a = a_doc.insert(1, "x")

b_doc = deepcopy(init_doc)
b_doc.site = 2
patch_from_b = b_doc.delete(2)

a_doc.apply_patch(patch_from_b)

assert a_doc.text == "AxB\n"

b_doc.apply_patch(patch_from_a)

assert b_doc.text == "AxB\n"

Example

Screenshot

Starting examples/mqtt_gui.py prompts the user for a "Portal ID". This ID contains the MQTT host, the pad name and the encryption token. It is intented to share this ID with someone you want to edit this pad with, without the need to manually enter these connection details.

Running tests

In order to run tests, make sure to have PyTests installed, then run

$ PYTHONPATH=. pytest

License

This repository has been released under the MIT License.

About

Python-based (sequence) CRDT library for collaborative text editing (only, for now)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages