Skip to content

Commit

Permalink
chore: Make it easier to switch Singer reader and writer IO implement…
Browse files Browse the repository at this point in the history
…ations in plugin classes (#2565)
  • Loading branch information
edgarrmondragon authored Jul 25, 2024
1 parent 078cffd commit 433b7fe
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 7 deletions.
6 changes: 3 additions & 3 deletions singer_sdk/_singerlib/encoding/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from __future__ import annotations

from ._base import GenericSingerReader, GenericSingerWriter, SingerMessageType
from ._simple import SingerReader, SingerWriter
from ._simple import SimpleSingerReader, SimpleSingerWriter

__all__ = [
"GenericSingerReader",
"GenericSingerWriter",
"SimpleSingerReader",
"SimpleSingerWriter",
"SingerMessageType",
"SingerReader",
"SingerWriter",
]
4 changes: 2 additions & 2 deletions singer_sdk/_singerlib/encoding/_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def __post_init__(self) -> None:
self.type = SingerMessageType.ACTIVATE_VERSION


class SingerReader(GenericSingerReader[str]):
class SimpleSingerReader(GenericSingerReader[str]):
"""Base class for all plugins reading Singer messages as strings from stdin."""

default_input = sys.stdin
Expand All @@ -219,7 +219,7 @@ def deserialize_json(self, line: str) -> dict: # noqa: PLR6301
raise InvalidInputLine(msg) from exc


class SingerWriter(GenericSingerWriter[str, Message]):
class SimpleSingerWriter(GenericSingerWriter[str, Message]):
"""Interface for all plugins writing Singer messages to stdout."""

def serialize_message(self, message: Message) -> str: # noqa: PLR6301
Expand Down
2 changes: 1 addition & 1 deletion singer_sdk/_singerlib/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from __future__ import annotations

from .encoding import SingerWriter
from .encoding import SimpleSingerWriter as SingerWriter
from .encoding._base import SingerMessageType
from .encoding._simple import (
ActivateVersionMessage,
Expand Down
16 changes: 15 additions & 1 deletion singer_sdk/io_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,18 @@

from __future__ import annotations

from singer_sdk._singerlib.encoding import * # noqa: F403
from singer_sdk._singerlib.encoding import (
GenericSingerReader,
GenericSingerWriter,
SingerMessageType,
)
from singer_sdk._singerlib.encoding import SimpleSingerReader as SingerReader
from singer_sdk._singerlib.encoding import SimpleSingerWriter as SingerWriter

__all__ = [
"GenericSingerReader",
"GenericSingerWriter",
"SingerMessageType",
"SingerReader",
"SingerWriter",
]

0 comments on commit 433b7fe

Please sign in to comment.