Skip to content

Conversation

@basilfx
Copy link
Owner

@basilfx basilfx commented Apr 17, 2025

No description provided.

@basilfx basilfx requested a review from Copilot April 17, 2025 22:19
Copy link

Copilot AI left a 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.

@basilfx basilfx force-pushed the feature/tinylink_next branch 3 times, most recently from 7704f9c to 302456a Compare April 18, 2025 20:23
@basilfx basilfx requested a review from Copilot April 18, 2025 20:36
Copy link

Copilot AI left a 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)
Copy link

Copilot AI Apr 18, 2025

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.

Suggested change
writer.write(data)
writer.write(data)
await writer.drain()

Copilot uses AI. Check for mistakes.
value = struct.pack(link.endianness + pack, float(item))
# Assume it is an int.
value = struct.pack(link.endianness + pack, int(item, 0))
except: # noqa
Copy link

Copilot AI Apr 18, 2025

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.

Copilot uses AI. Check for mistakes.
@basilfx basilfx force-pushed the feature/tinylink_next branch from 302456a to 90777b8 Compare April 19, 2025 19:39
@basilfx basilfx requested a review from Copilot April 19, 2025 19:46
Copy link

Copilot AI left a 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).
Copy link

Copilot AI Apr 19, 2025

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'.

Suggested change
* Added: escping of the header and body (protocol).
* Added: escaping of the header and body (protocol).

Copilot uses AI. Check for mistakes.
value = struct.pack(link.endianness + pack, float(item))
# Assume it is an int.
value = struct.pack(link.endianness + pack, int(item, 0))
except: # noqa
Copy link

Copilot AI Apr 19, 2025

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.

Copilot uses AI. Check for mistakes.
basilfx added 2 commits April 19, 2025 21:47
- Add async support to library
- Add escaping of header and body
- Remove reserved flags
@basilfx basilfx force-pushed the feature/tinylink_next branch from 90777b8 to 05ba4c7 Compare April 19, 2025 19:47
@basilfx basilfx requested a review from Copilot April 19, 2025 19:57
Copy link

Copilot AI left a 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
Copy link

Copilot AI Apr 19, 2025

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.

Suggested change
except: # noqa
except (ValueError, TypeError): # noqa

Copilot uses AI. Check for mistakes.
CHANGELOG.md Outdated

Highlights:
* Added: support for asynchronous handles.
* Added: escping of the header and body (protocol).
Copy link

Copilot AI Apr 19, 2025

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'.

Suggested change
* Added: escping of the header and body (protocol).
* Added: escaping of the header and body (protocol).

Copilot uses AI. Check for mistakes.
@basilfx basilfx force-pushed the feature/tinylink_next branch from 05ba4c7 to 1c12043 Compare April 19, 2025 19:58
@basilfx basilfx merged commit 298ffdf into master Apr 19, 2025
2 checks passed
@basilfx basilfx deleted the feature/tinylink_next branch April 19, 2025 20:01
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.

2 participants