Skip to content

Read packet bytes incrementally from blocking streams - #166

Merged
ddasilva merged 1 commit into
CCSDSPy:mainfrom
giovannicozzolongo:issue-92-streaming
Oct 27, 2026
Merged

ddasilva merged 1 commit into
CCSDSPy:mainfrom
giovannicozzolongo:issue-92-streaming

Conversation

@giovannicozzolongo

Copy link
Copy Markdown
Contributor

Closes #92.

iter_packet_bytes() now reads packets from blocking streams without waiting for EOF. Packet alignment is left to the caller, as discussed in the issue. Added tests for partial reads and delivery while the socket is still open. The test suite passes with Python 3.12.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused implementation preserves truncation handling and has regression coverage for partial reads and packet delivery before EOF.

No open issues 🎉

What changed in this PR

Updates iter_packet_bytes() to decode packets incrementally from blocking binary streams, addressing #92 without waiting for EOF.

Changes:

  • Combines partial reads and yields each complete packet while leaving caller-owned streams open.
  • Adds tests for short reads, delivery over an open socket, and truncated input.
  • Documents stream requirements and provides a TCP socket example.
File Description
docs/​user-guide/​utils.rst Documents blocking streams, packet alignment, and socket usage.
ccsdspy/​utils.py Replaces whole-input loading with incremental header and payload reads.
ccsdspy/​tests/​test_utils.py Adds streaming and truncation regression coverage.

Review effort: Balanced

@ddasilva
ddasilva merged commit 0d2ce3f into CCSDSPy:main Oct 27, 2026
5 checks passed
@ddasilva

Copy link
Copy Markdown
Collaborator

Thanks @giovannicozzolongo ! I'll make a release shortly with this and a couple bug fixes.

@ddasilva

Copy link
Copy Markdown
Collaborator

@giovannicozzolongo a release has been made and pushed to PyPI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

iter_packet_bytes incrementally read from stream, blocking for wait

3 participants