-
Notifications
You must be signed in to change notification settings - Fork 0
Add async support and improve resiliency #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
7704f9c to
302456a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds asynchronous support and improves resiliency across the TinyLink project. Key changes include:
- Introducing asynchronous APIs and data handling (AsyncTinyLink and related protocols).
- Updating the CLI and test suites to work with async I/O while standardizing terminology (payload vs. data).
- Bumping dependency versions, updating Python version requirements, and adjusting GitHub workflow configurations.
Reviewed Changes
Copilot reviewed 15 out of 17 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tinylink/utils.py | Adds async support via create_async_handle and relevant type hints. |
| tinylink/types.py | Introduces AsyncHandle protocol for asynchronous operations. |
| tinylink/consts.py | Updates comments and constant definitions for improved clarity. |
| tinylink/cli.py | Migrates CLI to async functionality using prompt_toolkit and asyncio. |
| tinylink/init.py | Updates module imports to include AsyncTinyLink. |
| tests/test_tinylink.py | Adjusts tests for synchronous operations to use standardized payload naming. |
| pyproject.toml | Upgrades Python version to 3.12 and dependency versions. |
| README.md | Updates documentation to reflect protocol and CLI changes. |
| CHANGELOG.md | Documents asynchronous support and other protocol improvements. |
| .github/workflows/* | Upgrades GitHub action versions and configuration consistency. |
Files not reviewed (2)
- .flake8: Language not supported
- docs/statechart.dot: Language not supported
| Calculate checksum of both the checksum header and the data. | ||
| """ | ||
| async def write(self, data: bytes) -> None: | ||
| writer.write(data) |
Copilot
AI
Apr 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding 'await writer.drain()' after writing data to ensure the write buffer is flushed properly.
| writer.write(data) | |
| writer.write(data) | |
| await writer.drain() |
| value = struct.pack(link.endianness + pack, float(item)) | ||
| # Assume it is an int. | ||
| value = struct.pack(link.endianness + pack, int(item, 0)) | ||
| except: # noqa |
Copilot
AI
Apr 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Avoid using bare except clauses; instead, catch specific exceptions (e.g. 'except Exception:') to prevent masking unexpected errors.
302456a to
90777b8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds asynchronous support for TinyLink and improves resiliency across the library and CLI while updating related tests and dependency configurations. Key changes include:
- Integration of async support with a new create_async_handle function and AsyncTinyLink.
- Adaptation of the CLI to handle asynchronous operations with prompt_toolkit.
- Updates to test cases and dependency configurations to support Python 3.12 and new library versions.
Reviewed Changes
Copilot reviewed 15 out of 17 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tinylink/utils.py | Added async support via create_async_handle and updated CRC32 logic. |
| tinylink/types.py | Introduced AsyncHandle protocol for asynchronous operations. |
| tinylink/consts.py | Revised comments and constants for protocol enhancements. |
| tinylink/cli.py | Migrated CLI from synchronous to asynchronous pattern. |
| tinylink/init.py | Updated exported symbols to include AsyncTinyLink. |
| tests/test_tinylink.py | Updated tests to reflect payload naming and async API changes. |
| pyproject.toml | Updated target Python version and dependency versions. |
| README.md | Revised documentation to align with protocol and async support updates. |
| CHANGELOG.md | Documented new features, improvements, and bug fixes. |
| .github/workflows/test.yml & lint.yml | Updated CI workflows to target newer GitHub actions and Python versions. |
Files not reviewed (2)
- .flake8: Language not supported
- docs/statechart.dot: Language not supported
Comments suppressed due to low confidence (1)
tests/test_tinylink.py:182
- [nitpick] Consider using 'write_frame' instead of 'write' for consistency with other tests and the updated API.
link.write(bytes([97 + i]))
CHANGELOG.md
Outdated
|
|
||
| Highlights: | ||
| * Added: support for asynchronous handles. | ||
| * Added: escping of the header and body (protocol). |
Copilot
AI
Apr 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo detected: 'escping' should be 'escaping'.
| * Added: escping of the header and body (protocol). | |
| * Added: escaping of the header and body (protocol). |
| value = struct.pack(link.endianness + pack, float(item)) | ||
| # Assume it is an int. | ||
| value = struct.pack(link.endianness + pack, int(item, 0)) | ||
| except: # noqa |
Copilot
AI
Apr 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid bare except clauses by specifying the exception type to improve error handling clarity.
- Add async support to library - Add escaping of header and body - Remove reserved flags
90777b8 to
05ba4c7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds asynchronous support across TinyLink's utilities, CLI, and tests while improving resiliency and documentation. Key changes include:
- Introducing async functions and protocols (e.g., create_async_handle, AsyncTinyLink) to support asynchronous I/O.
- Refactoring the CLI and test suites to leverage async operations and updating terminology to standardize payload naming.
- Updating dependency versions, target Python version, and workflows to support modern tooling.
Reviewed Changes
Copilot reviewed 15 out of 17 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tinylink/utils.py | Added async support in handle creation and CRC32 updates. |
| tinylink/types.py | Introduced AsyncHandle protocol. |
| tinylink/consts.py | Updated comments and constants for improved clarity. |
| tinylink/cli.py | Refactored CLI to use async operations and PromptSession. |
| tinylink/init.py | Updated imports reflecting async changes. |
| tests/test_tinylink.py | Updated tests to validate async behavior and payload logic. |
| pyproject.toml | Upgraded target Python version and dependency versions. |
| README.md | Revised documentation to reflect async and protocol changes. |
| CHANGELOG.md | Documented async support and protocol improvements. |
| .github/workflows/* | Updated GitHub Actions configurations for newer versions. |
Files not reviewed (2)
- .flake8: Language not supported
- docs/statechart.dot: Language not supported
| value = struct.pack(link.endianness + pack, float(item)) | ||
| # Assume it is an int. | ||
| value = struct.pack(link.endianness + pack, int(item, 0)) | ||
| except: # noqa |
Copilot
AI
Apr 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider catching specific exceptions instead of using a bare 'except:' to avoid unintended exception handling.
| except: # noqa | |
| except (ValueError, TypeError): # noqa |
CHANGELOG.md
Outdated
|
|
||
| Highlights: | ||
| * Added: support for asynchronous handles. | ||
| * Added: escping of the header and body (protocol). |
Copilot
AI
Apr 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo found: 'escping' should be corrected to 'escaping'.
| * Added: escping of the header and body (protocol). | |
| * Added: escaping of the header and body (protocol). |
05ba4c7 to
1c12043
Compare
No description provided.