pycrdt-sticky-xml
A fork of pycrdt that adds sticky_index support for XML types (XmlElement and XmlText).
What's New
This fork extends the original pycrdt library by adding sticky_index functionality to XML types:
- XmlElement.sticky_index(): Create sticky indices for XML element children
- XmlText.sticky_index(): Create sticky indices within XML text content
Installation
From PyPI (when published)
pip install pycrdt-sticky-xml
Development Installation
For development, you need Rust installed (via rustup):
# Clone the repository
git clone https://github.com/yourusername/pycrdt-sticky-xml.git
cd pycrdt-sticky-xml
# Install with uv (recommended)
uv pip install -e .
# Or build with maturin
source "$HOME/.cargo/env" # If Rust installed via rustup
uv run maturin develop
Note: The Python module is imported as pycrdt_sticky_xml (with underscores), even though the package name uses hyphens.
Usage
from pycrdt_sticky_xml import Doc, XmlFragment, XmlElement, XmlText, Assoc
# Create a document with XML content
doc = Doc()
frag = doc.get("content", type=XmlFragment)
# Add XML text
text = XmlText("Hello World")
frag.children.append(text)
# Create a sticky index at position 5
idx = text.sticky_index(5, Assoc.AFTER)
# Insert text before the sticky position
text.insert(0, "Say ")
# The sticky index maintains its semantic position
print(idx.get_index()) # Now points to position 9 (after "Say Hello")
Features
- All features from the original pycrdt
- Sticky indices for XmlElement children
- Sticky indices for XmlText content
- Full compatibility with Yrs collaborative editing
Running Tests
# Install test dependencies
uv pip install pydantic pytest-mypy-testing trio
# Run tests
uv run pytest
# Run specific test file
uv run pytest tests/test_xml.py -v
Original Project
This is a fork of pycrdt. All credit for the core functionality goes to the original authors.
License
MIT License (same as original pycrdt)
Metadata
Release files for pycrdt-sticky-xml 0.12.29
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pycrdt_sticky_xml-0.12.29.tar.gz | 153.6 kB | Without provenance | Details for pycrdt_sticky_xml-0.12.29.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pycrdt_sticky_xml-0.12.29-cp312-cp312-macosx_11_0_arm64.whl | CPython 3.12 | CPython 3.12 | macOS 11.0+ ARM64 | Details for pycrdt_sticky_xml-0.12.29-cp312-cp312-macosx_11_0_arm64.whl |
Total release size: 876.7 kB
Release files / pycrdt_sticky_xml-0.12.29.tar.gz
| Download URL | pycrdt_sticky_xml-0.12.29.tar.gz |
|---|---|
| Size | 153.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
44d86551daf13c9af9a2b1e7bf75974f40772f5796575ed062e988280ce80ff8
|
|
BLAKE2b-256 checksum How to use checksums |
6ffc21347873096368251a0a10902ad2e819af136dd126520407cd15aae54315
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.9.4
|
Release files / pycrdt_sticky_xml-0.12.29-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | pycrdt_sticky_xml-0.12.29-cp312-cp312-macosx_11_0_arm64.whl |
|---|---|
| Size | 723.1 kB |
| Tags | CPython 3.12 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
e5e73133d30849ec3c63eb3646306cf0438cb1d6dd91dadd4c3141dd101b5da0
|
|
BLAKE2b-256 checksum How to use checksums |
d7ea39972aec9c98e74ede5b822233647fec1b0a5e7d8f3f1f270cc26fc67c25
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.9.4
|
Security for pycrdt-sticky-xml 0.12.29
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.