Skip to content

Commit

Permalink
Switch to pyserial-asyncio-fast to fix event loop being blocked (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco authored Jun 22, 2024
1 parent 9f51048 commit e980b52
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions aioraven/serial.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from aioraven.streams import RAVEnStreamDevice
from aioraven.streams import RAVEnWriter
from serial import SerialException
from serial_asyncio import create_serial_connection
from serial_asyncio_fast import create_serial_connection


async def open_serial_connection(
Expand All @@ -25,7 +25,7 @@ async def open_serial_connection(
Establish a serial connection to a RAVEn device.
Positional and keyword arguments are passed to
`serial_asyncio.create_serial_connection()`.
`serial_asyncio_fast.create_serial_connection()`.
:param loop: The event loop instance to use.
"""
Expand Down Expand Up @@ -57,7 +57,7 @@ def __init__(
Construct a RAVEnSerialDevice.
Additional positional and keyword arguments are passed to
`serial_asyncio.create_serial_connection()`.
`serial_asyncio_fast.create_serial_connection()`.
:param url: The pyserial URL of the device to connect to.
:param loop: The event loop instance to use.
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ classifiers = [
dependencies = [
"iso4217",
"pyserial>=2.5",
"pyserial-asyncio",
"pyserial-asyncio-fast",
]
dynamic = ["version"]

Expand Down
4 changes: 2 additions & 2 deletions test/mock_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from typing import TypeVar
from typing import Union

import serial_asyncio
import serial_asyncio_fast


_T = TypeVar('_T')
Expand Down Expand Up @@ -278,7 +278,7 @@ async def main(argv: list[str] = sys.argv) -> Optional[int]:
sys.stdin.buffer, sys.stdout.buffer)
elif len(argv) == 2:
read_transport = None
reader, writer = await serial_asyncio.open_serial_connection(
reader, writer = await serial_asyncio_fast.open_serial_connection(
url=argv[1])
else:
print(f'Usage: {argv[0]} [DEVICE_PATH]', file=sys.stderr)
Expand Down

0 comments on commit e980b52

Please sign in to comment.