Skip to content

Latest commit

 

History

History
184 lines (131 loc) · 6.46 KB

File metadata and controls

184 lines (131 loc) · 6.46 KB

Resolved Issues Summary

This document summarizes which issues were resolved in this PR and which still need work.

✅ Issues RESOLVED in This PR

Issue #6: Closed property for SourceReader

Status: ✅ RESOLVED

Added closed property to SourceReader, similar to io.IOBase.closed.

Changes:

  • Added _closed attribute that tracks open/close state
  • Added closed property
  • Updated __enter__ and __exit__ to manage the flag
  • Updated QuickSourceReader to properly set closed state
  • Added docstring examples

Issue #10: BufferReader.next() compatibility

Status: ✅ RESOLVED

Made __next__() compatible with Python's iterator protocol by raising StopIteration when the stream is stopped and no data is available.

Changes:

  • Modified __next__() to raise StopIteration when stream is stopped and no data
  • Updated __iter__() to catch StopIteration and return (prevents RuntimeError in Python 3.7+)
  • Added comprehensive tests (test_buffer_reader_stopiteration.py)
  • Now compatible with for loops and builtin next() with defaults

Issue #15: Custom Exception Classes

Status: ✅ RESOLVED (Foundation)

Created custom exception hierarchy for stream2py with more informative error messages.

Changes:

  • Created stream2py/exceptions.py with exception hierarchy:
    • Stream2PyError - Base exception
    • StreamNotStartedError - When operations require started stream
    • StreamAlreadyStoppedError - When stream has been stopped
    • BufferError - Base for buffer errors
    • BufferOverflowError - When buffer is full
    • NoDataAvailableError - When no data available
    • InvalidDataError - Invalid data format
    • ConfigurationError - Misconfiguration
  • Updated StreamBuffer.mk_reader() and attach_reader() to use StreamNotStartedError
  • Updated tests to expect new exception types
  • Exported exceptions module from main package

Next Steps: Continue replacing generic exceptions throughout codebase

Issue #18: Check if reader started before reading

Status: ✅ ADDRESSED

Documented and tested that the check already exists in StreamBuffer.mk_reader().

Changes:

  • Added comprehensive tests (test_reader_without_context.py) demonstrating:
    • mk_reader() raises clear error if buffer not started
    • Readers work without context manager
    • Context manager ensures proper cleanup
    • Recommended usage patterns
  • Improved error message with StreamNotStartedError

📋 Issues Already Resolved (Prior to This PR)

Issue #20: Blocking parameter for BufferReader

Status: ✅ ALREADY IMPLEMENTED

The blocking parameter already exists in BufferReader.read().

Evidence:

  • buffer_reader.py:348 - blocking=False parameter exists
  • When blocking=True, read waits for data
  • When blocking=False, returns immediately
  • Added tests to verify functionality works

Recommendation: Close issue

Issue #8: Add blocking and timeout parameters

Status: ⚠️ PARTIALLY RESOLVED

  • blocking parameter exists (see #20)
  • timeout parameter not yet implemented

Recommendation: Update issue to focus only on adding timeout parameter


⏳ Issues Needing More Work

Issue #9: Not skipping tests and linting

Status: ❓ NEEDS CLARIFICATION

Analysis:

  • CI configuration runs tests (line 43: pytest -s --doctest-modules -v $PROJECT_NAME)
  • CI runs linting (line 40: pylint for docstrings)
  • The --bypass-tests flag is only used for automated commits (line 96), which is appropriate

Current State: CI appears to be configured correctly

Recommendation: Need clarification from issue author on what specifically is being skipped inappropriately

Issue #13: Notebook compatibility

Status: 🔧 EXTERNAL PACKAGE

Analysis: The getch.py file referenced in the error doesn't exist in stream2py - keyboard functionality has been moved to keyboardstream2py package.

Recommendation: This issue applies to the external keyboardstream2py package, not core stream2py. Should either:

  1. Move issue to keyboardstream2py repository
  2. Close with comment directing to appropriate package

Issue #17: Revise BufferReader

Status: 🔧 PARTIALLY ADDRESSED, MORE WORK NEEDED

Progress:

  • ✅ TODO 1: "read must get its defaults from init" - Already implemented via _read_kwargs
  • ⏳ TODO 2: "range must work similarly to read" - Needs review
  • ⏳ TODO 3: "Which init args should be keyword-only?" - Design decision needed
  • ⏳ TODO 4: "Consider read_chk_step and read_chk_size" - Needs design

In-Code TODOs:

  • buffer_reader.py:95 - "should ignore_no_item_found default be True?"
  • stream_buffer.py:125 - "option to auto restart source on read exception"

Recommendation: Address remaining TODOs systematically in future PR

Issue #14: Slicing joinable data

Status: 🔧 NOT STARTED

Effort: Medium - requires design

Approach:

  1. Add optional abstract methods to SourceReader:
    • join(items) - joins multiple read data items
    • slice(item, start, stop) - slices a single data item
  2. Update BufferReader.range() to use these methods
  3. Make it optional/backwards compatible

Recommendation: Good candidate for next PR after examples are created


📊 Test Coverage Improvements

Tests Added:

  1. test_buffer_reader_stopiteration.py - 4 tests for #10
  2. test_reader_without_context.py - 5 tests for #18
  3. test_buffer_reader_blocking.py - 2 tests (from previous work)
  4. test_quick_source_reader.py - 6 tests (from previous work)

Total: 17 new tests added across both PRs

Test Results:

  • Before first PR: 11 tests (1 failing)
  • After first PR: 19 tests (all passing)
  • After this work: 28 tests (all passing)
  • Improvement: +155% test coverage, 100% passing

🎯 Summary

Resolved in This Session:

  • ✅ #6 - Closed property
  • ✅ #10 - __next__() compatibility
  • ✅ #15 - Custom exceptions (foundation)
  • ✅ #18 - Reader started checks (documented + tested)

Already Resolved:

  • ✅ #20 - Blocking parameter (already existed)
  • ⚠️ #8 - Partially (blocking exists, timeout doesn't)

Needs Clarification:

  • ❓ #9 - CI tests/linting (appears to work correctly)

Needs More Work (for future PRs):

  • 🔧 #13 - Applies to external package (keyboardstream2py)
  • 🔧 #14 - Slicing joinable data (medium effort)
  • 🔧 #17 - BufferReader revisions (partially done, more needed)

Total Issues Addressed: 4 fully resolved, 2 documented as already resolved, 3 analyzed and documented