Skip to content

Commit 0966233

Browse files
committed
chore: use vcdiff lib from central pypi
1 parent e8f05fa commit 0966233

File tree

7 files changed

+28
-33
lines changed

7 files changed

+28
-33
lines changed

ably/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from ably.types.options import Options, VCDiffDecoder
99
from ably.util.crypto import CipherParams
1010
from ably.util.exceptions import AblyException, AblyAuthException, IncompatibleClientIdException
11-
from ably.vcdiff_plugin import VCDiffPlugin
11+
from ably.vcdiff.ably_vcdiff_decoder import AblyVCDiffDecoder
1212

1313
import logging
1414

ably/types/options.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def __init__(self, client_id=None, log_level=0, tls=True, rest_host=None, realti
2222
fallback_retry_timeout=None, disconnected_retry_timeout=None, idempotent_rest_publishing=None,
2323
loop=None, auto_connect=True, suspended_retry_timeout=None, connectivity_check_url=None,
2424
channel_retry_timeout=Defaults.channel_retry_timeout, add_request_ids=False,
25-
vcdiff_decoder=None, **kwargs):
25+
vcdiff_decoder: VCDiffDecoder = None, **kwargs):
2626

2727
super().__init__(**kwargs)
2828

ably/vcdiff/__init__.py

Whitespace-only changes.

ably/vcdiff_plugin.py renamed to ably/vcdiff/ably_vcdiff_decoder.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
"""
2-
VCDiff Plugin for Ably Python SDK
2+
VCDiff Decoder for Ably Python SDK
33
4-
This module provides a production-ready VCDiff decoder plugin using the vcdiff library.
4+
This module provides a production-ready VCDiff decoder using the vcdiff-decoder library.
55
It implements the VCDiffDecoder interface.
66
77
Usage:
8-
from ably import VCDiffPlugin, AblyRealtime
8+
from ably.vcdiff import AblyVCDiffDecoder, AblyRealtime
99
10-
# Create VCDiff plugin
11-
plugin = VCDiffPlugin()
10+
# Create VCDiff decoder
11+
vcdiff_decoder = AblyVCDiffDecoder()
1212
13-
# Create client with plugin
14-
client = AblyRealtime(key="your-key", vcdiff_decoder=plugin)
13+
# Create client with decoder
14+
client = AblyRealtime(key="your-key", vcdiff_decoder=vcdiff_decoder)
1515
1616
# Get channel with delta enabled
17-
channel = client.channels.get("test", {"delta": "vcdiff"})
17+
channel = client.channels.get("test", ChannelOptions(params={"delta": "vcdiff"}))
1818
"""
1919

2020
import logging
@@ -25,9 +25,9 @@
2525
log = logging.getLogger(__name__)
2626

2727

28-
class VCDiffPlugin(VCDiffDecoder):
28+
class AblyVCDiffDecoder(VCDiffDecoder):
2929
"""
30-
Production VCDiff decoder plugin using Ably's vcdiff library.
30+
Production VCDiff decoder using Ably's vcdiff-decoder library.
3131
3232
Raises:
3333
ImportError: If vcdiff is not installed
@@ -38,10 +38,10 @@ def __init__(self):
3838
"""Initialize the VCDiff plugin.
3939
4040
Raises:
41-
ImportError: If vcdiff library is not available
41+
ImportError: If vcdiff-decoder library is not available
4242
"""
4343
try:
44-
import vcdiff
44+
import vcdiff_decoder as vcdiff
4545
self._vcdiff = vcdiff
4646
except ImportError as e:
4747
log.error("vcdiff library not found. Install with: pip install ably[vcdiff]")
@@ -79,4 +79,4 @@ def decode(self, delta: bytes, base: bytes) -> bytes:
7979

8080

8181
# Export for easy importing
82-
__all__ = ['VCDiffPlugin']
82+
__all__ = ['AblyVCDiffDecoder']

poetry.lock

Lines changed: 7 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,12 @@ pyee = [
5656
# Optional dependencies
5757
pycrypto = { version = "^2.6.1", optional = true }
5858
pycryptodome = { version = "*", optional = true }
59-
vcdiff = { version = "^0.1.0a2", source = "experimental", optional = true }
59+
vcdiff-decoder = { version = "^0.1.0a1", optional = true }
6060

6161
[tool.poetry.extras]
6262
oldcrypto = ["pycrypto"]
6363
crypto = ["pycryptodome"]
64-
vcdiff = ["vcdiff"]
64+
vcdiff = ["vcdiff-decoder"]
6565

6666
[tool.poetry.dev-dependencies]
6767
pytest = "^7.1"
@@ -82,7 +82,7 @@ pytest-rerunfailures = [
8282
]
8383
async-case = { version = "^10.1.0", python = "~3.7" }
8484
tokenize_rt = "*"
85-
vcdiff = { version = "^0.1.0a2", source = "experimental" }
85+
vcdiff-decoder = { version = "^0.1.0a1" }
8686

8787
[build-system]
8888
requires = ["poetry-core>=1.0.0"]

test/ably/realtime/realtimechannel_vcdiff_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import asyncio
22
import json
33

4-
from ably import VCDiffPlugin
4+
from ably import AblyVCDiffDecoder
55
from ably.realtime.realtime_channel import ChannelOptions
66
from test.ably.testapp import TestApp
77
from test.ably.utils import BaseAsyncTestCase, WaitableEvent
@@ -15,11 +15,11 @@ class MockVCDiffDecoder(VCDiffDecoder):
1515
def __init__(self):
1616
self.number_of_calls = 0
1717
self.last_decoded_data = None
18-
self.plugin = VCDiffPlugin()
18+
self.vcdiff_decoder = AblyVCDiffDecoder()
1919

2020
def decode(self, delta: bytes, base: bytes) -> bytes:
2121
self.number_of_calls += 1
22-
self.last_decoded_data = self.plugin.decode(delta, base)
22+
self.last_decoded_data = self.vcdiff_decoder.decode(delta, base)
2323
return self.last_decoded_data
2424

2525

0 commit comments

Comments
 (0)