Skip to main content

No project description provided

Project description

Ypy

Ypy is a Python binding for Y-CRDT. It provides distributed data types that enable real-time collaboration between devices. Ypy can sync data with any other platform that has a Y-CRDT binding, allowing for seamless cross-domain communication. The library is a thin wrapper around Yrs, taking advantage of the safety and performance of Rust.

🧪 Project is still experimental. Expect the API to change before a version 1.0 stable release.

Installation

pip install y-py

Getting Started

Ypy provides many of the same shared data types as Yjs. All objects are shared within a YDoc and get modified within a transaction block.

import y_py as Y

d1 = Y.YDoc()
# Create a new YText object in the YDoc
text = d1.get_text('test')
# Start a transaction in order to update the text
with d1.begin_transaction() as txn:
    # Add text contents
    text.push(txn, "hello world!")

# Create another document
d2 = Y.YDoc()
# Share state with the original document
state_vector = Y.encode_state_vector(d2)
diff = Y.encode_state_as_update(d1, state_vector)
Y.apply_update(d2, diff)

value = str(d2.get_text('test'))

assert value == "hello world!"

Development Setup

  1. Install Rust Nightly and Python
  2. Install maturin in order to build Ypy
pip install maturin
  1. Create a development build of the library maturin develop

Tests

All tests are located in /tests. You can run them with pytest.

pytest

Build Ypy :

Build the library as a wheel and store them in target/wheels :

maturin build

Project details


Download files

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

Source Distribution

y_py-0.4.6.tar.gz (31.4 kB view hashes)

Uploaded Source

Built Distributions

y_py-0.4.6-pp37-pypy37_pp73-manylinux_2_5_x86_64.manylinux1_x86_64.whl (1.4 MB view hashes)

Uploaded PyPy manylinux: glibc 2.5+ x86-64

y_py-0.4.6-pp37-pypy37_pp73-manylinux_2_5_i686.manylinux1_i686.whl (1.5 MB view hashes)

Uploaded PyPy manylinux: glibc 2.5+ i686

y_py-0.4.6-cp310-none-win_amd64.whl (467.3 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

y_py-0.4.6-cp310-none-win32.whl (442.6 kB view hashes)

Uploaded CPython 3.10 Windows x86

y_py-0.4.6-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.whl (1.4 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.5+ x86-64

y_py-0.4.6-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl (1.5 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.5+ i686

y_py-0.4.6-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (1.2 MB view hashes)

Uploaded CPython 3.10 macOS 10.9+ universal2 (ARM64, x86-64) macOS 10.9+ x86-64 macOS 11.0+ ARM64

y_py-0.4.6-cp310-cp310-macosx_10_7_x86_64.whl (597.3 kB view hashes)

Uploaded CPython 3.10 macOS 10.7+ x86-64

y_py-0.4.6-cp39-none-win_amd64.whl (467.5 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

y_py-0.4.6-cp39-none-win32.whl (442.7 kB view hashes)

Uploaded CPython 3.9 Windows x86

y_py-0.4.6-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl (1.4 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.5+ x86-64

y_py-0.4.6-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.whl (1.5 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.5+ i686

y_py-0.4.6-cp39-cp39-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (1.2 MB view hashes)

Uploaded CPython 3.9 macOS 10.9+ universal2 (ARM64, x86-64) macOS 10.9+ x86-64 macOS 11.0+ ARM64

y_py-0.4.6-cp39-cp39-macosx_10_7_x86_64.whl (597.3 kB view hashes)

Uploaded CPython 3.9 macOS 10.7+ x86-64

y_py-0.4.6-cp38-none-win_amd64.whl (466.8 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

y_py-0.4.6-cp38-none-win32.whl (442.2 kB view hashes)

Uploaded CPython 3.8 Windows x86

y_py-0.4.6-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl (1.4 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.5+ x86-64

y_py-0.4.6-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.whl (1.5 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.5+ i686

y_py-0.4.6-cp37-none-win_amd64.whl (466.8 kB view hashes)

Uploaded CPython 3.7 Windows x86-64

y_py-0.4.6-cp37-none-win32.whl (441.9 kB view hashes)

Uploaded CPython 3.7 Windows x86

y_py-0.4.6-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl (1.4 MB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.5+ x86-64

y_py-0.4.6-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.whl (1.5 MB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.5+ i686

y_py-0.4.6-cp37-cp37m-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (1.2 MB view hashes)

Uploaded CPython 3.7m macOS 10.9+ universal2 (ARM64, x86-64) macOS 10.9+ x86-64 macOS 11.0+ ARM64

y_py-0.4.6-cp37-cp37m-macosx_10_7_x86_64.whl (596.5 kB view hashes)

Uploaded CPython 3.7m macOS 10.7+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page