fossasia / fossasia/pslab-python

Clarify CLI runtime behavior when migrating away from deprecated pslab.serial_handler

オープン
#271 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
Python
スター
1.6k
フォーク
242
PR マージ指標
30日以内にマージされた PR はありません

説明

Background

The pslab.serial_handler module is deprecated and emits warnings during build and runtime.
A newer API is available via pslab.connection.SerialHandler.

Migrating to the new API is necessary, but the two implementations differ in runtime behavior, particularly regarding connection states.

Current CLI behavior

In pslab/cli.py, the CLI currently:

  • Instantiates SerialHandler(port=args.port)
  • Uses the handler immediately without explicitly calling connect()
  • Relies on the deprecated module's implicit connection behavior to function.
Behavior difference with pslab.connection

The newer pslab.connection.SerialHandler:

  • Does not auto-connect on initialization.
  • Requires an explicit .connect() call to open the port.
  • Will fail at runtime if used immediately after instantiation without connection.
Proposed Resolution

To safely migrate to the new API, the CLI logic in pslab/cli.py will be updated to:

  1. Explicit Connection: Call handler.connect() immediately after instantiation.
  2. Lifecycle Management: Wrap the execution in a try...finally block to ensure handler.disconnect() is called on exit.
  3. Port Handling: Ensure args.port is passed correctly to support both specific port selection and auto-discovery.
Related work
  • PR: #267 (Implementation in progress)

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

pslab/cli.py から始め、その handler のライフサイクルを pslab.connection.SerialHandler と比較してください。CLI が明示的に接続し、選択されたポートと自動検出の場合に args.port を渡し、終了時に切断することを確認してください。関連する PR #267 は、実装がすでに進行中であることを示しています。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
cli
issue の種類
バグ
難易度
2/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。