juart-cli 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- juart_cli-0.1.0/.gitignore +54 -0
- juart_cli-0.1.0/.python-version +1 -0
- juart_cli-0.1.0/PKG-INFO +183 -0
- juart_cli-0.1.0/README.ja.md +175 -0
- juart_cli-0.1.0/README.ko.md +175 -0
- juart_cli-0.1.0/README.md +175 -0
- juart_cli-0.1.0/docs/user-guide.en.md +365 -0
- juart_cli-0.1.0/docs/user-guide.ja.md +365 -0
- juart_cli-0.1.0/docs/user-guide.ko.md +365 -0
- juart_cli-0.1.0/pyproject.toml +48 -0
- juart_cli-0.1.0/src/juart/__init__.py +3 -0
- juart_cli-0.1.0/src/juart/__main__.py +3 -0
- juart_cli-0.1.0/src/juart/_log_worker.py +52 -0
- juart_cli-0.1.0/src/juart/backends/__init__.py +1 -0
- juart_cli-0.1.0/src/juart/backends/_quartus_worker.py +254 -0
- juart_cli-0.1.0/src/juart/backends/base.py +37 -0
- juart_cli-0.1.0/src/juart/backends/quartus.py +561 -0
- juart_cli-0.1.0/src/juart/cli.py +102 -0
- juart_cli-0.1.0/src/juart/commands.py +127 -0
- juart_cli-0.1.0/src/juart/logging.py +314 -0
- juart_cli-0.1.0/src/juart/session.py +822 -0
- juart_cli-0.1.0/src/juart/shell.py +96 -0
- juart_cli-0.1.0/src/juart/terminal.py +369 -0
- juart_cli-0.1.0/tests/test_cli.py +85 -0
- juart_cli-0.1.0/tests/test_commands.py +106 -0
- juart_cli-0.1.0/tests/test_hardware.py +131 -0
- juart_cli-0.1.0/tests/test_logging.py +323 -0
- juart_cli-0.1.0/tests/test_native_integration.py +178 -0
- juart_cli-0.1.0/tests/test_pty.py +92 -0
- juart_cli-0.1.0/tests/test_quartus.py +705 -0
- juart_cli-0.1.0/tests/test_quartus_worker.py +233 -0
- juart_cli-0.1.0/tests/test_session.py +734 -0
- juart_cli-0.1.0/tests/test_shell.py +231 -0
- juart_cli-0.1.0/tests/test_terminal.py +517 -0
- juart_cli-0.1.0/uv.lock +184 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Local agent state and hardware evidence
|
|
2
|
+
.gjc/
|
|
3
|
+
artifacts/
|
|
4
|
+
|
|
5
|
+
# Python / uv environments and caches (keep uv.lock tracked)
|
|
6
|
+
.venv/
|
|
7
|
+
venv/
|
|
8
|
+
__pycache__/
|
|
9
|
+
*.py[cod]
|
|
10
|
+
.uv-cache/
|
|
11
|
+
*.egg-info/
|
|
12
|
+
.eggs/
|
|
13
|
+
build/
|
|
14
|
+
dist/
|
|
15
|
+
|
|
16
|
+
# Tests, coverage and static analysis
|
|
17
|
+
.pytest_cache/
|
|
18
|
+
.ruff_cache/
|
|
19
|
+
.mypy_cache/
|
|
20
|
+
.pyright/
|
|
21
|
+
.tox/
|
|
22
|
+
.nox/
|
|
23
|
+
.coverage
|
|
24
|
+
.coverage.*
|
|
25
|
+
htmlcov/
|
|
26
|
+
coverage.xml
|
|
27
|
+
junit.xml
|
|
28
|
+
|
|
29
|
+
# Local secrets; sanitized examples may be committed
|
|
30
|
+
.env
|
|
31
|
+
.env.*
|
|
32
|
+
!.env.example
|
|
33
|
+
!.env.*.example
|
|
34
|
+
|
|
35
|
+
# Editor and operating-system state
|
|
36
|
+
.DS_Store
|
|
37
|
+
Thumbs.db
|
|
38
|
+
.idea/
|
|
39
|
+
.vscode/
|
|
40
|
+
*.swp
|
|
41
|
+
*.swo
|
|
42
|
+
*~
|
|
43
|
+
|
|
44
|
+
# Generated FPGA programming/build artifacts; keep RTL and project settings
|
|
45
|
+
*.sof
|
|
46
|
+
*.pof
|
|
47
|
+
*.jic
|
|
48
|
+
*.rbf
|
|
49
|
+
*.svf
|
|
50
|
+
*.qws
|
|
51
|
+
*.qdb
|
|
52
|
+
*.qdf
|
|
53
|
+
incremental_db/
|
|
54
|
+
output_files/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.12
|
juart_cli-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: juart-cli
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Interactive JTAG UART terminal with direct and buffered transmission
|
|
5
|
+
Requires-Python: >=3.12
|
|
6
|
+
Requires-Dist: prompt-toolkit<4,>=3.0.48
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
|
|
9
|
+
[English](README.md) | [日本語](README.ja.md) | [한국어](README.ko.md)
|
|
10
|
+
|
|
11
|
+
# juart-cli
|
|
12
|
+
|
|
13
|
+
An interactive JTAG UART terminal for Intel/Altera Quartus FPGA setups, featuring both immediate (`direct`) and line-edited (`buffer`) transmission, exact binary HEX transmission, safe shell handoff, and opt-in JSONL session logging.
|
|
14
|
+
|
|
15
|
+
## Key Features
|
|
16
|
+
|
|
17
|
+
- **Dual Transmission Modes**
|
|
18
|
+
- `[direct]` (default): transmits each printable ASCII key immediately (`Enter` sends `0x0D`, `Tab` sends `0x09`, `Backspace` sends `0x08`, `Ctrl+D` sends `0x04`). Local TX echo is off.
|
|
19
|
+
- `[buffer]`: edit up to 4096 ASCII/Tab bytes locally before sending. Pressing `Enter` transmits **only** the edited bytes with no implicit CR/LF; empty idle `Enter` sends nothing.
|
|
20
|
+
- **Exact Binary TX & Safe RX Rendering**
|
|
21
|
+
- Send arbitrary binary payloads (1–4096 bytes) via `:hex <pairs>` without implicit line endings.
|
|
22
|
+
- Switch receive formatting between `:view text` (control bytes safely escaped as `\xNN`, blocking terminal escape injection) and `:view hex`.
|
|
23
|
+
- **Subprocess-Isolated Quartus Backend**
|
|
24
|
+
- Vendor native libraries (`jtag_client` / `jtag_atlantic`) are never loaded in the UI process.
|
|
25
|
+
- All vendor I/O runs inside an isolated worker process with bounded timeouts; stalled operations terminate and reap the worker cleanly and track accepted bytes separately from flush completion.
|
|
26
|
+
- **Safe External Tool & Shell Handoff**
|
|
27
|
+
- Release the JTAG UART cleanly with `:d` (`:disconnect`) while keeping the CLI open and preserving pending buffer input.
|
|
28
|
+
- Run external commands (such as an FPGA programmer) or an interactive shell with `:! [command]` only while disconnected, then resume with `:c` (`:connect`).
|
|
29
|
+
- **Opt-In Structured JSONL Logging**
|
|
30
|
+
- Record accepted TX bytes, raw RX bytes, lifecycle transitions, and delivery results to a brand-new JSONL file via `:log start <path>` / `:log stop`.
|
|
31
|
+
- Disk I/O is isolated in a bounded worker subprocess so filesystem errors or queue overflows never block or terminate the UART session.
|
|
32
|
+
- **Honest Delivery Accounting**
|
|
33
|
+
- Confirmed zero-byte failures retain the text buffer for explicit retry.
|
|
34
|
+
- Partial or uncertain writes clear the editor, report accepted byte counts, and print a recoverable snapshot—never silently replaying potentially duplicated commands.
|
|
35
|
+
|
|
36
|
+
## Requirements
|
|
37
|
+
|
|
38
|
+
- **Python**: 3.12 or newer (64-bit)
|
|
39
|
+
- **Package manager**: [`uv`](https://docs.astral.sh/uv/) (recommended) or standard `pip` + `venv`
|
|
40
|
+
- **Vendor stack**: Intel/Altera Quartus (or Quartus Programmer) matching the Python runtime architecture:
|
|
41
|
+
- Native Windows x64 Python + Quartus `bin64` (`jtag_client.dll`, `jtag_atlantic.dll`, `jtagconfig.exe`)
|
|
42
|
+
- Linux x64 Python + Quartus `linux64` (`libjtag_client.so`, `libjtag_atlantic.so`, `jtagconfig`)
|
|
43
|
+
- **Hardware**: Matching JTAG cable OS driver, running JTAG server, and an FPGA already configured with a JTAG UART design.
|
|
44
|
+
- `juart-cli` does **not** bundle vendor libraries, OS drivers, or bitstreams, and never programs or flashes the FPGA automatically.
|
|
45
|
+
|
|
46
|
+
## Quick Start
|
|
47
|
+
|
|
48
|
+
### Install with `uv` (recommended)
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
uv sync --dev
|
|
52
|
+
uv run juart --help
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Install with `pip` (without `uv`)
|
|
56
|
+
|
|
57
|
+
```powershell
|
|
58
|
+
# PowerShell (Windows)
|
|
59
|
+
python -m venv .venv
|
|
60
|
+
.venv\Scripts\python.exe -m pip install -e .
|
|
61
|
+
.venv\Scripts\juart.exe --help
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
# Linux (bash)
|
|
66
|
+
python3 -m venv .venv
|
|
67
|
+
.venv/bin/python -m pip install -e .
|
|
68
|
+
.venv/bin/juart --help
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
> With `pip`, run `.venv\Scripts\juart.exe` (or `python -m juart` with the venv active) instead of `uv run juart`.
|
|
72
|
+
|
|
73
|
+
### Connect to Hardware
|
|
74
|
+
|
|
75
|
+
Set your Quartus installation root and verify cable visibility before connecting:
|
|
76
|
+
|
|
77
|
+
```powershell
|
|
78
|
+
# PowerShell (Windows) — adjust path to your Quartus installation
|
|
79
|
+
$env:QUARTUS_ROOTDIR = 'C:\altera_lite\25.1std\quartus'
|
|
80
|
+
uv run juart --list-drivers
|
|
81
|
+
uv run juart --list-cables
|
|
82
|
+
|
|
83
|
+
# Launch interactive terminal (auto-connects if target is unique)
|
|
84
|
+
uv run juart --quartus-root $env:QUARTUS_ROOTDIR
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
# Cygwin (Bash / Mintty) — use the native Windows Python venv with Cygwin Bash for :!
|
|
89
|
+
export QUARTUS_ROOTDIR='C:\altera_lite\25.1std\quartus'
|
|
90
|
+
/cygdrive/c/path/to/juart-cli/.venv/Scripts/python.exe -m juart --shell "$(cygpath -w /bin/bash)"
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
# Linux (bash) — adjust path to your Quartus installation
|
|
95
|
+
export QUARTUS_ROOTDIR=/opt/intelFPGA/quartus
|
|
96
|
+
uv run juart --list-drivers
|
|
97
|
+
uv run juart --list-cables
|
|
98
|
+
|
|
99
|
+
# Launch with an explicit cable, device, and UART instance
|
|
100
|
+
uv run juart --cable "USB-Blaster [USB-0]" --device 1 --instance 0
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
You can invoke the CLI either as `juart` or via `python -m juart`. See the [User Guide & Operations Runbook](docs/user-guide.en.md) for CMD, Git Bash, Cygwin `PATH`, and WSL details.
|
|
104
|
+
|
|
105
|
+
## CLI Options
|
|
106
|
+
|
|
107
|
+
| Option | Description |
|
|
108
|
+
| --- | --- |
|
|
109
|
+
| `--version` | Print version and exit. |
|
|
110
|
+
| `--driver {quartus}` | Transport driver backend (default: `quartus`). |
|
|
111
|
+
| `--list-drivers` | Check whether Quartus x64 files are present at `--quartus-root` / `QUARTUS_ROOTDIR`. |
|
|
112
|
+
| `--list-cables` | Enumerate local JTAG cables via `jtagconfig --listhardware`. |
|
|
113
|
+
| `--cable CABLE` | Exact cable identifier reported by `--list-cables`. |
|
|
114
|
+
| `--device N` | 1-based JTAG chain device index. |
|
|
115
|
+
| `--instance N` | JTAG UART instance index (`0`–`255`). |
|
|
116
|
+
| `--quartus-root PATH` | Quartus installation directory (overrides `QUARTUS_ROOTDIR`). |
|
|
117
|
+
| `--shell PATH` | Shell executable for `:!` (`cmd`, `powershell`, `pwsh`, `sh`, `bash`, `zsh`, `dash`, `ksh`, `fish`). |
|
|
118
|
+
|
|
119
|
+
> `--list-drivers` and `--list-cables` are mutually exclusive and run non-interactively. Starting an interactive session requires a TTY.
|
|
120
|
+
|
|
121
|
+
## Interactive Commands & Keys
|
|
122
|
+
|
|
123
|
+
Press `:` in either transmission mode to enter command mode (`::` sends/inserts a literal colon).
|
|
124
|
+
|
|
125
|
+
| Command / Key | Action |
|
|
126
|
+
| --- | --- |
|
|
127
|
+
| `:direct`, `:buffer` | Switch transmission mode (clear or submit pending buffer before returning to direct). |
|
|
128
|
+
| `:c` / `:connect` | Connect to the configured JTAG UART target. |
|
|
129
|
+
| `:d` / `:disconnect` | Release JTAG UART ownership while keeping the CLI and pending buffer intact. |
|
|
130
|
+
| `:r` / `:reconnect` | Disconnect and reconnect to the target. |
|
|
131
|
+
| `:s` / `:status` | Show connection state, mode, pending byte count, view, log, shell, and last error. |
|
|
132
|
+
| `:i` / `:info` | Show driver, resolved target (`cable`, `device`, `instance`), state, and worker metadata. |
|
|
133
|
+
| `:h` / `:help` | Display the in-terminal help summary. |
|
|
134
|
+
| `:q` / `:quit`, `Ctrl+C` | Release resources, flush/stop any active log, and exit. |
|
|
135
|
+
| `:hex <pairs>` | Send 1–4096 space-separated two-digit hex bytes (requires empty buffer and idle connection). |
|
|
136
|
+
| `:view text\|hex` | Toggle RX display between sanitized ASCII text and uppercase hex bytes. |
|
|
137
|
+
| `:log start <path>` | Create a new JSONL log file exclusively (quote paths containing spaces). |
|
|
138
|
+
| `:log stop` | Flush and close the active JSONL log file. |
|
|
139
|
+
| `:! [command]` | Run a shell command or open an interactive shell (requires `DISCONNECTED` state via `:d`). |
|
|
140
|
+
| `::` | Send (`direct`) or insert (`buffer`) a literal `:`. |
|
|
141
|
+
| `Esc` | Cancel command input, or clear the pending buffer in `buffer` mode. |
|
|
142
|
+
| `Tab`, `Up` / `Down` | Command completion and session-local command history (in command mode). |
|
|
143
|
+
|
|
144
|
+
## Development & Testing
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
# Run hardware-independent unit and integration tests
|
|
148
|
+
uv run pytest
|
|
149
|
+
|
|
150
|
+
# Lint with Ruff
|
|
151
|
+
uv run ruff check .
|
|
152
|
+
|
|
153
|
+
# Build wheel and sdist packages
|
|
154
|
+
uv build
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Hardware acceptance tests in [`tests/test_hardware.py`](tests/test_hardware.py) are skipped by default and require explicit opt-in (`JUART_RUN_HARDWARE=1`) against a board loaded with any JTAG UART byte-echo (loopback) design. `juart-cli` itself works with any FPGA design that exposes a standard Intel/Altera JTAG UART IP core.
|
|
158
|
+
|
|
159
|
+
## Releases (maintainers)
|
|
160
|
+
|
|
161
|
+
CI checks frozen dependencies, Ruff, Windows/Linux/macOS tests, and pip/uv installation of the built packages. Hosted CI never runs physical FPGA tests.
|
|
162
|
+
|
|
163
|
+
One-time setup:
|
|
164
|
+
|
|
165
|
+
1. Push the workflows to `main`. Create the GitHub environment **`pypi`** under repository Settings → Environments; configure approval protection where available.
|
|
166
|
+
2. On [PyPI Publishing](https://pypi.org/manage/account/publishing/), add a **pending publisher**: project `juart-cli`, owner `snowykr`, repository `juart-cli`, workflow filename **`publish.yml`**, environment **`pypi`**. For an existing PyPI project, configure its trusted publisher instead. No API-token secret is required.
|
|
167
|
+
|
|
168
|
+
For each release:
|
|
169
|
+
|
|
170
|
+
1. Set the same version in `pyproject.toml` and `src/juart/__init__.py`, run `uv lock`, then commit and push to `main`. Use `X.Y.Z` or a prerelease such as `X.Y.Zrc1`.
|
|
171
|
+
2. Run **Actions → Prepare release → Run workflow** on `main`. After validation, it creates a draft `v<version>` release with generated notes for that exact commit. Existing tags are not reused.
|
|
172
|
+
3. Review the draft and click **Publish release** yourself. The **Publish release** workflow validates the tag/version and main ancestry, reruns CI, publishes the tested wheel/sdist to PyPI through OIDC, then attaches those files and `SHA256SUMS` to GitHub.
|
|
173
|
+
|
|
174
|
+
Draft creation does not publish to PyPI. The manual publication is intentional: a release published by another workflow using `GITHUB_TOKEN` would not trigger the publishing workflow. PyPI packages are public even when this repository is private, and uploaded versions cannot be overwritten. On a partial upload failure, inspect which files reached PyPI before retrying; the workflow does not silently skip existing files. If only GitHub asset attachment fails, rerun that failed job rather than the successful PyPI job.
|
|
175
|
+
|
|
176
|
+
After the first successful publication, users can run `pip install juart-cli` or `uv tool install juart-cli`, then `juart`. Quartus and cable drivers remain separate prerequisites.
|
|
177
|
+
|
|
178
|
+
## Documentation
|
|
179
|
+
|
|
180
|
+
- **User Guide & Operations Runbook**
|
|
181
|
+
- [English (`docs/user-guide.en.md`)](docs/user-guide.en.md)
|
|
182
|
+
- [日本語 (`docs/user-guide.ja.md`)](docs/user-guide.ja.md)
|
|
183
|
+
- [한국어 (`docs/user-guide.ko.md`)](docs/user-guide.ko.md)
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
[English](README.md) | [日本語](README.ja.md) | [한국어](README.ko.md)
|
|
2
|
+
|
|
3
|
+
# juart-cli
|
|
4
|
+
|
|
5
|
+
Intel/Altera Quartus FPGA 環境向けの対話型 JTAG UART ターミナルです。即時送信(`direct`)と行編集後の送信(`buffer`)、厳密なバイナリ HEX 送信、安全なシェル切り替え、およびオプトイン形式の JSONL セッションログ記録を備えています。
|
|
6
|
+
|
|
7
|
+
## 主な機能
|
|
8
|
+
|
|
9
|
+
- **2 つの送信モード**
|
|
10
|
+
- `[direct]`(初期モード): 印字可能な ASCII 文字をキー入力と同時に送信します(`Enter` は `0x0D`、`Tab` は `0x09`、`Backspace` は `0x08`、`Ctrl+D` は `0x04`)。ローカル TX エコーは無効です。
|
|
11
|
+
- `[buffer]`: 最大 4096 バイトの ASCII/Tab 入力をローカルで編集してから送信します。`Enter` は編集済みバイト**のみ**を送信し、暗黙の CR/LF は付与しません。空バッファかつアイドル時の `Enter` は何も送信しません。
|
|
12
|
+
- **厳密なバイナリ送信と安全な受信表示**
|
|
13
|
+
- `:hex <pairs>` により、改行コードを自動付加せず任意のバイナリ列(1〜4096 バイト)を送信できます。
|
|
14
|
+
- `:view text`(制御文字を `\xNN` としてエスケープし、端末エスケープシーケンス注入を防止)と `:view hex` を切り替えられます。
|
|
15
|
+
- **サブプロセス分離された Quartus バックエンド**
|
|
16
|
+
- ベンダーのネイティブライブラリ(`jtag_client` / `jtag_atlantic`)は UI プロセスに一切ロードしません。
|
|
17
|
+
- すべてのベンダー I/O はタイムアウト付きの独立ワーカープロセスで実行され、ハング時はプロセスを確実に終了・回収します。また、ベンダー側が受理したバイト数と flush 完了を分離して記録します。
|
|
18
|
+
- **安全な外部コマンド・シェル連携**
|
|
19
|
+
- `:d`(`:disconnect`)で JTAG UART の占有を解放しつつ、CLI と未送信バッファを保持したまま待機できます。
|
|
20
|
+
- 切断状態(`DISCONNECTED`)でのみ `:! [command]` から外部コマンド(FPGA プログラマ等)や対話シェルを実行でき、終了後は元の編集状態に戻って `:c`(`:connect`)で再接続できます。
|
|
21
|
+
- **オプトインの構造化 JSONL ログ**
|
|
22
|
+
- `:log start <path>` / `:log stop` により、受理済み TX・生 RX バイト列・状態遷移・送信結果を新規 JSONL ファイルへ記録します。
|
|
23
|
+
- ディスク I/O は有界キューを持つ専用ワーカープロセスに分離されており、ファイル障害やキュー溢れが起きても UART セッション自体は継続できます。
|
|
24
|
+
- **正確な配送アカウンティング**
|
|
25
|
+
- 0 バイト受理が確定した失敗では、明示的に再試行できるようテキストバッファを保持します。
|
|
26
|
+
- 部分受理または配送不確定の失敗では、重複送信を防ぐため自動再送を行わず、エディタをクリアしたうえで受理バイト数と復元用スナップショットを表示します。
|
|
27
|
+
|
|
28
|
+
## 動作要件
|
|
29
|
+
|
|
30
|
+
- **Python**: 3.12 以上(64-bit)
|
|
31
|
+
- **パッケージマネージャ**: [`uv`](https://docs.astral.sh/uv/)(推奨)または標準の `pip` + `venv`
|
|
32
|
+
- **ベンダー環境**: Python ランタイムのアーキテクチャと一致する Intel/Altera Quartus(または Quartus Programmer)
|
|
33
|
+
- ネイティブ Windows x64 Python + Quartus `bin64`(`jtag_client.dll`, `jtag_atlantic.dll`, `jtagconfig.exe`)
|
|
34
|
+
- Linux x64 Python + Quartus `linux64`(`libjtag_client.so`, `libjtag_atlantic.so`, `jtagconfig`)
|
|
35
|
+
- **ハードウェア**: ケーブル対応 OS ドライバ、稼働中の JTAG サーバー、および JTAG UART 回路が書き込み済みの FPGA
|
|
36
|
+
- `juart-cli` はベンダーライブラリ・OS ドライバ・ビットストリームを同梱せず、FPGA の書き込みやリセットも自動では行いません。
|
|
37
|
+
|
|
38
|
+
## クイックスタート
|
|
39
|
+
|
|
40
|
+
### `uv` でインストール(推奨)
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
uv sync --dev
|
|
44
|
+
uv run juart --help
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### `pip` でインストール(`uv` を使わない場合)
|
|
48
|
+
|
|
49
|
+
```powershell
|
|
50
|
+
# PowerShell (Windows)
|
|
51
|
+
python -m venv .venv
|
|
52
|
+
.venv\Scripts\python.exe -m pip install -e .
|
|
53
|
+
.venv\Scripts\juart.exe --help
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
# Linux (bash)
|
|
58
|
+
python3 -m venv .venv
|
|
59
|
+
.venv/bin/python -m pip install -e .
|
|
60
|
+
.venv/bin/juart --help
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
> `pip` 環境では、`uv run juart` の代わりに `.venv\Scripts\juart.exe`(または仮想環境有効化後の `juart` / `python -m juart`)を使用してください。
|
|
64
|
+
|
|
65
|
+
### 実機への接続
|
|
66
|
+
|
|
67
|
+
Quartus のインストール先を指定し、接続前にドライバとケーブルを確認します。
|
|
68
|
+
|
|
69
|
+
```powershell
|
|
70
|
+
# PowerShell (Windows) — 実際の Quartus インストールパスに置き換えてください
|
|
71
|
+
$env:QUARTUS_ROOTDIR = 'C:\altera_lite\25.1std\quartus'
|
|
72
|
+
uv run juart --list-drivers
|
|
73
|
+
uv run juart --list-cables
|
|
74
|
+
|
|
75
|
+
# 対話ターミナルを起動(対象が一意であれば自動接続)
|
|
76
|
+
uv run juart --quartus-root $env:QUARTUS_ROOTDIR
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
# Cygwin (Bash / Mintty) — ネイティブ Windows Python の仮想環境を使い、:! に Cygwin Bash を指定
|
|
81
|
+
export QUARTUS_ROOTDIR='C:\altera_lite\25.1std\quartus'
|
|
82
|
+
/cygdrive/c/path/to/juart-cli/.venv/Scripts/python.exe -m juart --shell "$(cygpath -w /bin/bash)"
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
# Linux (bash) — 実際の Quartus インストールパスに置き換えてください
|
|
87
|
+
export QUARTUS_ROOTDIR=/opt/intelFPGA/quartus
|
|
88
|
+
uv run juart --list-drivers
|
|
89
|
+
uv run juart --list-cables
|
|
90
|
+
|
|
91
|
+
# ケーブル・デバイス・UART インスタンスを明示して起動
|
|
92
|
+
uv run juart --cable "USB-Blaster [USB-0]" --device 1 --instance 0
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
CLI は `juart` コマンドまたは `python -m juart` のどちらからでも起動できます。CMD、Git Bash、Cygwin の `PATH` 設定、WSL の詳細は[運用ランブック・ユーザーガイド](docs/user-guide.ja.md)を参照してください。
|
|
96
|
+
|
|
97
|
+
## CLI オプション
|
|
98
|
+
|
|
99
|
+
| オプション | 説明 |
|
|
100
|
+
| --- | --- |
|
|
101
|
+
| `--version` | バージョンを表示して終了します。 |
|
|
102
|
+
| `--driver {quartus}` | トランスポートドライバを選択します(デフォルト: `quartus`)。 |
|
|
103
|
+
| `--list-drivers` | `--quartus-root` / `QUARTUS_ROOTDIR` に Quartus x64 ファイルが存在するか確認します。 |
|
|
104
|
+
| `--list-cables` | `jtagconfig --listhardware` 経由でローカル JTAG ケーブルを一覧表示します。 |
|
|
105
|
+
| `--cable CABLE` | `--list-cables` で表示された正確なケーブル識別子。 |
|
|
106
|
+
| `--device N` | JTAG チェーン上の 1 始まりのデバイス番号。 |
|
|
107
|
+
| `--instance N` | JTAG UART インスタンス番号(`0`〜`255`)。 |
|
|
108
|
+
| `--quartus-root PATH` | Quartus インストールディレクトリ(`QUARTUS_ROOTDIR` より優先)。 |
|
|
109
|
+
| `--shell PATH` | `:!` で使用するシェル実行ファイル(`cmd`, `powershell`, `pwsh`, `sh`, `bash`, `zsh`, `dash`, `ksh`, `fish`)。 |
|
|
110
|
+
|
|
111
|
+
> `--list-drivers` と `--list-cables` は排他指定であり、非対話モードで実行されます。対話セッションの起動には TTY が必要です。
|
|
112
|
+
|
|
113
|
+
## 対話コマンドとキー操作
|
|
114
|
+
|
|
115
|
+
どちらの送信モードでも `:` を押すとコマンド入力に入ります(リテラルのコロンは `::` で送信・挿入します)。
|
|
116
|
+
|
|
117
|
+
| コマンド / キー | 動作 |
|
|
118
|
+
| --- | --- |
|
|
119
|
+
| `:direct`, `:buffer` | 送信モードを切り替え(`direct` へ戻る前に未送信バッファを送信またはクリアする必要があります)。 |
|
|
120
|
+
| `:c` / `:connect` | 指定ターゲットの JTAG UART に接続します。 |
|
|
121
|
+
| `:d` / `:disconnect` | CLI と未送信バッファを保持したまま JTAG UART リソースを解放します。 |
|
|
122
|
+
| `:r` / `:reconnect` | 切断してから再接続します。 |
|
|
123
|
+
| `:s` / `:status` | 接続状態、モード、未送信バイト数、表示形式、ログ、シェル、直近エラーを表示します。 |
|
|
124
|
+
| `:i` / `:info` | ドライバ、確定ターゲット(`cable`, `device`, `instance`)、状態、ワーカー情報を表示します。 |
|
|
125
|
+
| `:h` / `:help` | ターミナル内でヘルプを表示します。 |
|
|
126
|
+
| `:q` / `:quit`, `Ctrl+C` | リソースを解放し、記録中のログをフラッシュ・終了して抜けます。 |
|
|
127
|
+
| `:hex <pairs>` | 空白区切り 2 桁 HEX(1〜4096 バイト)を厳密送信(空バッファかつアイドル接続時のみ)。 |
|
|
128
|
+
| `:view text\|hex` | 受信表示をエスケープ済みテキストと大文字 HEX 表示の間で切り替えます。 |
|
|
129
|
+
| `:log start <path>` | 新規 JSONL ログファイルを排他作成して記録開始(空白を含むパスは引用符で囲みます)。 |
|
|
130
|
+
| `:log stop` | 記録中の JSONL ログをフラッシュして閉じます。 |
|
|
131
|
+
| `:! [command]` | 外部コマンドを実行、または対話シェルを起動(事前に `:d` で `DISCONNECTED` 状態にする必要があります)。 |
|
|
132
|
+
| `::` | リテラルの `:` を送信(`direct`)または挿入(`buffer`)します。 |
|
|
133
|
+
| `Esc` | コマンド入力のキャンセル、または `buffer` モード中の未送信入力をクリアします。 |
|
|
134
|
+
| `Tab`, `Up` / `Down` | コマンド補完とセッション内コマンド履歴の参照(コマンド入力時)。 |
|
|
135
|
+
|
|
136
|
+
## 開発とテスト
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
# ハードウェア非依存の単体・結合テストを実行
|
|
140
|
+
uv run pytest
|
|
141
|
+
|
|
142
|
+
# Ruff でリントを実行
|
|
143
|
+
uv run ruff check .
|
|
144
|
+
|
|
145
|
+
# wheel および sdist をビルド
|
|
146
|
+
uv build
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
[`tests/test_hardware.py`](tests/test_hardware.py) の実機受け入れテストはデフォルトではスキップされます。バイトエコー(ループバック)動作を行う任意の JTAG UART デザインを書き込んだ実機に対して実行する場合のみ、`JUART_RUN_HARDWARE=1` を明示してください。`juart-cli` 本体は、標準の Intel/Altera JTAG UART IP を備えた任意の FPGA デザインで利用できます。
|
|
150
|
+
|
|
151
|
+
## リリース(管理者向け)
|
|
152
|
+
|
|
153
|
+
CI はロックファイル固定の依存関係、Ruff、Windows/Linux/macOS のテスト、ビルドしたパッケージの pip/uv インストールを検証します。ホスト型 CI では FPGA 実機テストを実行しません。
|
|
154
|
+
|
|
155
|
+
初回設定:
|
|
156
|
+
|
|
157
|
+
1. ワークフローを `main` に push し、リポジトリの Settings → Environments で **`pypi`** 環境を作成します。利用可能なら承認保護も設定します。
|
|
158
|
+
2. [PyPI Publishing](https://pypi.org/manage/account/publishing/) で **pending publisher** を登録します。プロジェクト `juart-cli`、所有者 `snowykr`、リポジトリ `juart-cli`、ワークフローファイル名 **`publish.yml`**、環境 **`pypi`** を指定します。既存の PyPI プロジェクトがある場合は、その trusted publisher を設定します。API トークンの secret は不要です。
|
|
159
|
+
|
|
160
|
+
各リリースの手順:
|
|
161
|
+
|
|
162
|
+
1. `pyproject.toml` と `src/juart/__init__.py` のバージョンを揃え、`uv lock` を実行して `main` にコミット・push します。`X.Y.Z` または `X.Y.Zrc1` などのプレリリース形式を使います。
|
|
163
|
+
2. `main` で **Actions → Prepare release → Run workflow** を実行します。検証後、対象コミットと自動生成ノートを使って `v<バージョン>` の下書きを作成します。既存タグは再利用しません。
|
|
164
|
+
3. 下書きを確認し、自分で **Publish release** を押します。**Publish release** ワークフローがタグ・バージョン・main の履歴を確認し、CI を再実行して、検証済み wheel/sdist を OIDC で PyPI に公開します。同じファイルと `SHA256SUMS` を GitHub リリースにも添付します。
|
|
165
|
+
|
|
166
|
+
下書きの作成だけでは PyPI に公開されません。別のワークフローが `GITHUB_TOKEN` でリリースを公開しても後続ワークフローは起動しないため、最終公開は手動で行います。リポジトリが非公開でも PyPI パッケージは公開され、公開済みバージョンは上書きできません。一部のファイルだけがアップロードされた場合は PyPI の状態を確認してから対処してください。既存ファイルは自動でスキップしません。GitHub の添付だけが失敗した場合は、成功した PyPI ジョブではなく失敗した添付ジョブだけを再実行します。
|
|
167
|
+
|
|
168
|
+
初回公開の成功後は、`pip install juart-cli` または `uv tool install juart-cli` でインストールして `juart` を実行できます。Quartus とケーブルドライバは別途必要です。
|
|
169
|
+
|
|
170
|
+
## ドキュメント
|
|
171
|
+
|
|
172
|
+
- **ユーザーガイド / 運用ランブック**
|
|
173
|
+
- [English (`docs/user-guide.en.md`)](docs/user-guide.en.md)
|
|
174
|
+
- [日本語 (`docs/user-guide.ja.md`)](docs/user-guide.ja.md)
|
|
175
|
+
- [한국어 (`docs/user-guide.ko.md`)](docs/user-guide.ko.md)
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
[English](README.md) | [日本語](README.ja.md) | [한국어](README.ko.md)
|
|
2
|
+
|
|
3
|
+
# juart-cli
|
|
4
|
+
|
|
5
|
+
Intel/Altera Quartus FPGA 환경을 위한 대화형 JTAG UART 터미널입니다. 즉시 전송(`direct`)과 줄 편집 후 전송(`buffer`), 정확한 바이너리 HEX 전송, 안전한 셸 전환, 선택적 JSONL 세션 로깅을 제공합니다.
|
|
6
|
+
|
|
7
|
+
## 주요 기능
|
|
8
|
+
|
|
9
|
+
- **이중 전송 모드**
|
|
10
|
+
- `[direct]`(기본값): 출력 가능한 ASCII 키를 누르는 즉시 전송합니다(`Enter`는 `0x0D`, `Tab`은 `0x09`, `Backspace`는 `0x08`, `Ctrl+D`는 `0x04`). 로컬 TX 에코는 꺼져 있습니다.
|
|
11
|
+
- `[buffer]`: 최대 4096바이트의 ASCII/Tab 입력을 로컬에서 편집한 뒤 전송합니다. `Enter`는 편집된 바이트**만** 전송하며 암묵적 CR/LF를 붙이지 않습니다. 빈 버퍼에서 유휴 상태의 `Enter`는 아무것도 전송하지 않습니다.
|
|
12
|
+
- **정확한 바이너리 전송 및 안전한 수신 렌더링**
|
|
13
|
+
- `:hex <pairs>`로 줄 끝 문자 없이 임의의 바이너리 페이로드(1~4096바이트)를 그대로 전송할 수 있습니다.
|
|
14
|
+
- `:view text`(제어 문자를 `\xNN`으로 이스케이프해 터미널 이스케이프 시퀀스 주입 방지)와 `:view hex` 수신 표시 모드를 전환할 수 있습니다.
|
|
15
|
+
- **서브프로세스로 격리된 Quartus 백엔드**
|
|
16
|
+
- 벤더 네이티브 라이브러리(`jtag_client` / `jtag_atlantic`)는 UI 프로세스에 로드되지 않습니다.
|
|
17
|
+
- 모든 벤더 I/O는 제한된 타임아웃이 적용된 별도 워커 프로세스에서 실행되며, 멈춤 발생 시 워커를 안전하게 종료·회수하고 수락된 바이트 수를 flush 완료와 분리해 기록합니다.
|
|
18
|
+
- **안전한 외부 명령 및 셸 전환**
|
|
19
|
+
- `:d`(`:disconnect`)로 JTAG UART 점유를 해제하면서도 CLI와 미전송 버퍼를 그대로 유지할 수 있습니다.
|
|
20
|
+
- 연결 해제(`DISCONNECTED`) 상태에서만 `:! [command]`로 외부 명령(예: FPGA 프로그래머)이나 대화형 셸을 실행하고, 복귀 후 `:c`(`:connect`)로 작업을 이어갈 수 있습니다.
|
|
21
|
+
- **선택적 구조화 JSONL 로깅**
|
|
22
|
+
- `:log start <path>` / `:log stop`으로 수락된 TX 바이트, 원시 RX 바이트, 상태 전이, 전송 결과를 새 JSONL 파일에 기록합니다.
|
|
23
|
+
- 디스크 I/O가 유한 큐를 가진 별도 워커 서브프로세스로 격리되어 있어 파일 오류나 큐 오버플로가 발생해도 UART 세션은 중단되지 않습니다.
|
|
24
|
+
- **정직한 전송 결과 회계**
|
|
25
|
+
- 0바이트 수락이 확정된 실패에서는 명시적 재시도를 위해 텍스트 버퍼를 유지합니다.
|
|
26
|
+
- 부분 수락 또는 전송 불확실 오류에서는 중복 명령 전송을 막기 위해 자동 재전송하지 않고 편집기를 비운 뒤 수락 바이트 수와 복구용 스냅샷을 표시합니다.
|
|
27
|
+
|
|
28
|
+
## 요구 사항
|
|
29
|
+
|
|
30
|
+
- **Python**: 3.12 이상 (64-bit)
|
|
31
|
+
- **패키지 관리자**: [`uv`](https://docs.astral.sh/uv/) (권장) 또는 기본 `pip` + `venv`
|
|
32
|
+
- **벤더 스택**: Python 런타임 아키텍처와 일치하는 Intel/Altera Quartus(또는 Quartus Programmer)
|
|
33
|
+
- 네이티브 Windows x64 Python + Quartus `bin64` (`jtag_client.dll`, `jtag_atlantic.dll`, `jtagconfig.exe`)
|
|
34
|
+
- Linux x64 Python + Quartus `linux64` (`libjtag_client.so`, `libjtag_atlantic.so`, `jtagconfig`)
|
|
35
|
+
- **하드웨어**: 케이블용 OS 드라이버, 실행 중인 JTAG 서버, JTAG UART 디자인이 이미 로드된 FPGA
|
|
36
|
+
- `juart-cli`는 벤더 라이브러리, OS 드라이버, 비트스트림을 배포하지 않으며 FPGA를 자동으로 프로그래밍하거나 플래시하지 않습니다.
|
|
37
|
+
|
|
38
|
+
## 빠른 시작
|
|
39
|
+
|
|
40
|
+
### `uv`로 설치 (권장)
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
uv sync --dev
|
|
44
|
+
uv run juart --help
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### `pip`로 설치 (`uv` 없이 사용)
|
|
48
|
+
|
|
49
|
+
```powershell
|
|
50
|
+
# PowerShell (Windows)
|
|
51
|
+
python -m venv .venv
|
|
52
|
+
.venv\Scripts\python.exe -m pip install -e .
|
|
53
|
+
.venv\Scripts\juart.exe --help
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
# Linux (bash)
|
|
58
|
+
python3 -m venv .venv
|
|
59
|
+
.venv/bin/python -m pip install -e .
|
|
60
|
+
.venv/bin/juart --help
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
> `pip` 환경에서는 `uv run juart` 대신 `.venv\Scripts\juart.exe`(또는 가상 환경 활성화 후 `juart` / `python -m juart`)로 실행하세요.
|
|
64
|
+
|
|
65
|
+
### 하드웨어 연결
|
|
66
|
+
|
|
67
|
+
Quartus 설치 경로를 지정하고 연결 전에 드라이버와 케이블을 확인합니다.
|
|
68
|
+
|
|
69
|
+
```powershell
|
|
70
|
+
# PowerShell (Windows) — 실제 Quartus 설치 경로로 변경하세요
|
|
71
|
+
$env:QUARTUS_ROOTDIR = 'C:\altera_lite\25.1std\quartus'
|
|
72
|
+
uv run juart --list-drivers
|
|
73
|
+
uv run juart --list-cables
|
|
74
|
+
|
|
75
|
+
# 대화형 터미널 실행 (대상이 유일하면 자동 연결)
|
|
76
|
+
uv run juart --quartus-root $env:QUARTUS_ROOTDIR
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
# Cygwin (Bash / Mintty) — 네이티브 Windows Python 가상 환경으로 실행하고 :! 셸을 Cygwin Bash로 지정
|
|
81
|
+
export QUARTUS_ROOTDIR='C:\altera_lite\25.1std\quartus'
|
|
82
|
+
/cygdrive/c/path/to/juart-cli/.venv/Scripts/python.exe -m juart --shell "$(cygpath -w /bin/bash)"
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
# Linux (bash) — 실제 Quartus 설치 경로로 변경하세요
|
|
87
|
+
export QUARTUS_ROOTDIR=/opt/intelFPGA/quartus
|
|
88
|
+
uv run juart --list-drivers
|
|
89
|
+
uv run juart --list-cables
|
|
90
|
+
|
|
91
|
+
# 케이블, 디바이스, UART 인스턴스를 명시해 실행
|
|
92
|
+
uv run juart --cable "USB-Blaster [USB-0]" --device 1 --instance 0
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
CLI는 `juart` 또는 `python -m juart`로 실행할 수 있습니다. CMD, Git Bash, Cygwin `PATH`, WSL 세부 절차는 [운영 런북 및 사용자 가이드](docs/user-guide.ko.md)를 참고하세요.
|
|
96
|
+
|
|
97
|
+
## CLI 옵션
|
|
98
|
+
|
|
99
|
+
| 옵션 | 설명 |
|
|
100
|
+
| --- | --- |
|
|
101
|
+
| `--version` | 버전을 출력하고 종료합니다. |
|
|
102
|
+
| `--driver {quartus}` | 전송 드라이버 백엔드(기본값: `quartus`). |
|
|
103
|
+
| `--list-drivers` | `--quartus-root` / `QUARTUS_ROOTDIR`에 Quartus x64 파일이 있는지 확인합니다. |
|
|
104
|
+
| `--list-cables` | `jtagconfig --listhardware`로 로컬 JTAG 케이블 목록을 조회합니다. |
|
|
105
|
+
| `--cable CABLE` | `--list-cables`가 출력한 정확한 케이블 식별자. |
|
|
106
|
+
| `--device N` | JTAG 체인의 1부터 시작하는 디바이스 인덱스. |
|
|
107
|
+
| `--instance N` | JTAG UART 인스턴스 인덱스(`0`–`255`). |
|
|
108
|
+
| `--quartus-root PATH` | Quartus 설치 디렉터리(`QUARTUS_ROOTDIR`보다 우선). |
|
|
109
|
+
| `--shell PATH` | `:!`에 사용할 셸 실행 파일(`cmd`, `powershell`, `pwsh`, `sh`, `bash`, `zsh`, `dash`, `ksh`, `fish`). |
|
|
110
|
+
|
|
111
|
+
> `--list-drivers`와 `--list-cables`는 상호 배타적이며 비대화형으로 실행됩니다. 대화형 세션을 시작하려면 TTY가 필요합니다.
|
|
112
|
+
|
|
113
|
+
## 대화형 명령 및 단축키
|
|
114
|
+
|
|
115
|
+
두 전송 모드 어디에서나 `:`를 누르면 명령 입력 모드로 진입합니다(리터럴 콜론은 `::`로 전송/삽입).
|
|
116
|
+
|
|
117
|
+
| 명령 / 키 | 동작 |
|
|
118
|
+
| --- | --- |
|
|
119
|
+
| `:direct`, `:buffer` | 전송 모드 전환(`direct`로 돌아가기 전에 대기 중인 버퍼를 전송하거나 비워야 합니다). |
|
|
120
|
+
| `:c` / `:connect` | 지정한 JTAG UART 대상에 연결합니다. |
|
|
121
|
+
| `:d` / `:disconnect` | CLI와 대기 중인 버퍼를 유지한 채 JTAG UART 점유를 해제합니다. |
|
|
122
|
+
| `:r` / `:reconnect` | 연결을 해제한 뒤 다시 연결합니다. |
|
|
123
|
+
| `:s` / `:status` | 연결 상태, 모드, 대기 바이트 수, 표시 형식, 로그, 셸, 마지막 오류를 표시합니다. |
|
|
124
|
+
| `:i` / `:info` | 드라이버, 확정된 대상(`cable`, `device`, `instance`), 상태, 워커 메타데이터를 표시합니다. |
|
|
125
|
+
| `:h` / `:help` | 터미널 내 도움말을 표시합니다. |
|
|
126
|
+
| `:q` / `:quit`, `Ctrl+C` | 리소스를 해제하고 활성 로그를 플러시·종료한 뒤 나갑니다. |
|
|
127
|
+
| `:hex <pairs>` | 공백으로 구분된 2자리 HEX 바이트(1~4096바이트) 전송(빈 버퍼 및 유휴 연결 필요). |
|
|
128
|
+
| `:view text\|hex` | 수신 표시를 이스케이프된 텍스트와 대문자 HEX 간에 전환합니다. |
|
|
129
|
+
| `:log start <path>` | 새 JSONL 로그 파일을 배타적으로 생성해 기록 시작(공백이 포함된 경로는 따옴표로 감쌈). |
|
|
130
|
+
| `:log stop` | 활성 JSONL 로그 파일을 플러시하고 닫습니다. |
|
|
131
|
+
| `:! [command]` | 셸 명령을 실행하거나 대화형 셸을 엽니다(`:d`로 `DISCONNECTED` 상태가 먼저 필요). |
|
|
132
|
+
| `::` | 리터럴 `:`를 전송(`direct`)하거나 버퍼에 삽입(`buffer`)합니다. |
|
|
133
|
+
| `Esc` | 명령 입력 취소 또는 `buffer` 모드에서 대기 중인 버퍼 비우기. |
|
|
134
|
+
| `Tab`, `Up` / `Down` | 명령 자동 완성 및 세션 로컬 명령 이력 탐색(명령 입력 모드). |
|
|
135
|
+
|
|
136
|
+
## 개발 및 테스트
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
# 하드웨어 비의존 단위·통합 테스트 실행
|
|
140
|
+
uv run pytest
|
|
141
|
+
|
|
142
|
+
# Ruff 린트 검사
|
|
143
|
+
uv run ruff check .
|
|
144
|
+
|
|
145
|
+
# wheel 및 sdist 패키지 빌드
|
|
146
|
+
uv build
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
[`tests/test_hardware.py`](tests/test_hardware.py)의 실장비 수락 테스트는 기본적으로 건너뛰며, 바이트 에코(루프백) 동작을 하는 임의의 JTAG UART 디자인이 로드된 보드에 대해 `JUART_RUN_HARDWARE=1`을 명시적으로 설정해야 실행됩니다. `juart-cli` 본체는 표준 Intel/Altera JTAG UART IP를 포함한 어떤 FPGA 디자인에서도 동작합니다.
|
|
150
|
+
|
|
151
|
+
## 릴리즈 (관리자)
|
|
152
|
+
|
|
153
|
+
CI는 잠금 파일 고정 설치, Ruff, Windows/Linux/macOS 테스트, 빌드한 패키지의 pip/uv 설치 검증을 수행합니다. 호스팅 CI에서는 실장비 FPGA 테스트를 실행하지 않습니다.
|
|
154
|
+
|
|
155
|
+
최초 설정:
|
|
156
|
+
|
|
157
|
+
1. 워크플로를 `main`에 push하고 저장소 Settings → Environments에서 **`pypi`** 환경을 만듭니다. 지원되는 경우 승인 보호도 설정합니다.
|
|
158
|
+
2. [PyPI Publishing](https://pypi.org/manage/account/publishing/)에서 **pending publisher**를 등록합니다: 프로젝트 `juart-cli`, 소유자 `snowykr`, 저장소 `juart-cli`, 워크플로 파일명 **`publish.yml`**, 환경 **`pypi`**. 이미 PyPI 프로젝트가 있다면 해당 프로젝트의 trusted publisher를 설정합니다. API 토큰 secret은 필요 없습니다.
|
|
159
|
+
|
|
160
|
+
릴리즈 절차:
|
|
161
|
+
|
|
162
|
+
1. `pyproject.toml`과 `src/juart/__init__.py`의 버전을 동일하게 변경하고 `uv lock`을 실행한 뒤 `main`에 커밋·push합니다. `X.Y.Z` 또는 `X.Y.Zrc1` 같은 사전 릴리즈 버전을 사용합니다.
|
|
163
|
+
2. **Actions → Prepare release → Run workflow**를 `main`에서 실행합니다. 검증을 통과하면 해당 커밋을 대상으로 자동 생성 릴리즈 노트가 포함된 `v<버전>` 초안을 만듭니다. 기존 태그는 재사용하지 않습니다.
|
|
164
|
+
3. 초안을 검토하고 직접 **Publish release**를 누릅니다. **Publish release** 워크플로가 태그·버전·main 이력을 확인하고 CI를 다시 실행한 뒤, 검증된 wheel/sdist를 OIDC로 PyPI에 게시합니다. 같은 파일과 `SHA256SUMS`를 GitHub 릴리즈에도 첨부합니다.
|
|
165
|
+
|
|
166
|
+
초안 생성만으로 PyPI에 게시되지는 않습니다. `GITHUB_TOKEN`을 사용하는 다른 워크플로가 릴리즈까지 게시하면 후속 게시 워크플로가 트리거되지 않으므로, 최종 게시는 직접 수행합니다. 저장소가 비공개여도 PyPI 패키지는 공개되며 게시한 버전은 덮어쓸 수 없습니다. 일부 파일만 업로드된 실패는 PyPI 상태를 확인한 뒤 처리해야 하며, 기존 파일을 자동으로 건너뛰지 않습니다. GitHub 첨부만 실패했다면 성공한 PyPI 작업이 아니라 실패한 첨부 작업만 재실행합니다.
|
|
167
|
+
|
|
168
|
+
첫 게시가 성공하면 사용자는 `pip install juart-cli` 또는 `uv tool install juart-cli`로 설치하고 `juart`를 실행할 수 있습니다. Quartus와 케이블 드라이버는 별도 설치가 필요합니다.
|
|
169
|
+
|
|
170
|
+
## 문서
|
|
171
|
+
|
|
172
|
+
- **사용자 가이드 / 운영 런북**
|
|
173
|
+
- [English (`docs/user-guide.en.md`)](docs/user-guide.en.md)
|
|
174
|
+
- [日本語 (`docs/user-guide.ja.md`)](docs/user-guide.ja.md)
|
|
175
|
+
- [한국어 (`docs/user-guide.ko.md`)](docs/user-guide.ko.md)
|