Skip to content

Commit

Permalink
⚡ migrate Buffer to Rust instead of pure Python (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ousret authored Apr 24, 2024
1 parent befa8b3 commit 4492d16
Show file tree
Hide file tree
Showing 11 changed files with 356 additions and 166 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest, macos-13, windows-latest]
python_version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', 'pypy-3.9', 'pypy-3.10']
exclude:
# circumvent wierd issue with qh3.asyncio+windows+proactor loop...
Expand Down Expand Up @@ -342,11 +342,11 @@ jobs:
needs:
- test
- lint
runs-on: macos-latest
runs-on: macos-13
strategy:
fail-fast: false
matrix:
target: [ x86_64, aarch64 ]
target: [ x86_64, aarch64, universal2 ]
python_version: [ '3.10', 'pypy-3.7', 'pypy-3.8', 'pypy-3.9', 'pypy-3.10' ]
steps:
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
1.0.4 (2024-04-23)
=====================

**Changed**
- Buffer management has been migrated over to Rust in order to improve the overall performance.

1.0.3 (2024-04-20)
=====================

Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "qh3"
version = "1.0.3"
version = "1.0.4"
edition = "2021"
rust-version = "1.75"
license = "BSD-3"
Expand Down
2 changes: 1 addition & 1 deletion qh3/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from .quic.packet import QuicProtocolVersion
from .tls import CipherSuite, SessionTicket

__version__ = "1.0.3"
__version__ = "1.0.4"

__all__ = (
"connect",
Expand Down
156 changes: 0 additions & 156 deletions qh3/_buffer.py

This file was deleted.

26 changes: 26 additions & 0 deletions qh3/_hazmat.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -207,3 +207,29 @@ class OCSPResponse:
class OCSPRequest:
def __init__(self, peer_certificate: bytes, issuer_certificate: bytes) -> None: ...
def public_bytes(self) -> bytes: ...

class BufferReadError(ValueError): ...
class BufferWriteError(ValueError): ...

class Buffer:
def __init__(self, capacity: int = 0, data: bytes | None = None) -> None: ...
@property
def capacity(self) -> int: ...
@property
def data(self) -> bytes: ...
def data_slice(self, start: int, end: int) -> bytes: ...
def eof(self) -> bool: ...
def seek(self, pos: int) -> None: ...
def tell(self) -> int: ...
def pull_bytes(self, length: int) -> bytes: ...
def pull_uint8(self) -> int: ...
def pull_uint16(self) -> int: ...
def pull_uint32(self) -> int: ...
def pull_uint64(self) -> int: ...
def pull_uint_var(self) -> int: ...
def push_bytes(self, value: bytes) -> None: ...
def push_uint8(self, value: int) -> None: ...
def push_uint16(self, value: int) -> None: ...
def push_uint32(self, value: int) -> None: ...
def push_uint64(self, value: int) -> None: ...
def push_uint_var(self, value: int) -> None: ...
2 changes: 1 addition & 1 deletion qh3/buffer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from ._buffer import Buffer, BufferReadError, BufferWriteError # noqa
from ._hazmat import Buffer, BufferReadError, BufferWriteError # noqa

UINT_VAR_MAX = 0x3FFFFFFFFFFFFFFF
UINT_VAR_MAX_SIZE = 8
Expand Down
Loading

0 comments on commit 4492d16

Please sign in to comment.