Skip to content

v2.6.18: 修复 Linux 环境下全新安装时缺失 jmv 命令的问题 (#527); 增加环境变量集成校验#528

Merged
hect0x7 merged 3 commits intomasterfrom
dev
Apr 7, 2026
Merged

v2.6.18: 修复 Linux 环境下全新安装时缺失 jmv 命令的问题 (#527); 增加环境变量集成校验#528
hect0x7 merged 3 commits intomasterfrom
dev

Conversation

@hect0x7
Copy link
Copy Markdown
Owner

@hect0x7 hect0x7 commented Apr 7, 2026

此 PR 解决了因 pyproject.toml 缺乏对应的 entry points 声明,导致在全新环境(如 Linux 下从 PyPI 安装时)未生成 jmv 命令行可执行文件文件的问题。

改动内容:

  • pyproject.toml 中的 [project.scripts] 段补齐 jmv = "jmcomic.cl:view_main"
  • tests/test_jmcomic/test_jm_cli.py 内部补充基于 shutil.whichsubprocess.run 验证系统命令的冒烟测试断言,从根本上防止漏配问题。
  • __version__ 升级至 2.6.18,准备发版。

Fixes #527

Summary by CodeRabbit

  • New Features

    • Added a new jmv console command as an additional entry point alongside the existing jmcomic command.
  • Tests

    • Added a test that verifies console commands are installed and discoverable, and that they respond to --help successfully.
  • Chores

    • Package version bumped to 2.6.18.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 7, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b717ca05-decd-4524-b546-db2d1c0fc4ab

📥 Commits

Reviewing files that changed from the base of the PR and between 5f2b5f1 and 9e4d74c.

📒 Files selected for processing (1)
  • tests/test_jmcomic/test_jm_cli.py

📝 Walkthrough

Walkthrough

Adds a new jmv console-script entry point, bumps package version, and adds a test that verifies both jmcomic and jmv commands are discoverable and respond to --help.

Changes

Cohort / File(s) Summary
Package configuration
pyproject.toml
Added console script entry jmv = "jmcomic.cl:view_main" alongside existing jmcomic entry.
Version bump
src/jmcomic/__init__.py
Updated __version__ from 2.6.172.6.18.
CLI tests
tests/test_jmcomic/test_jm_cli.py
Added test_entry_points_installed to check jmcomic and jmv are on PATH and run <cmd> --help successfully (captures timeout, exit code, stderr).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Poem

🐰
A tiny hop, a new command in view,
jmv joins the path, hello to you!
Version ticked up, tests give a cheer,
CLI friends found far and near.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main changes: fixing missing jmv command on Linux and adding environment variable integration validation.
Linked Issues check ✅ Passed All coding requirements from issue #527 are met: jmv entry point added to pyproject.toml and integration tests added to verify command availability.
Out of Scope Changes check ✅ Passed All changes are in scope: entry point declaration, version bump, and integration tests directly address the linked issue requirements.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
tests/test_jmcomic/test_jm_cli.py (1)

56-61: Add timeout and narrow exception handling in CLI smoke test.

Line 57 should include a timeout (10 seconds) to prevent CI hangs if a command blocks, and line 60 should catch OSError instead of the broad Exception for better error precision (FileNotFoundError, PermissionError, etc. are the likely failures here). Add a subprocess.TimeoutExpired handler if timeout is added.

Proposed patch
             try:
-                subprocess.run([cmd, "--help"], capture_output=True, text=True, check=True)
+                subprocess.run(
+                    [cmd, "--help"],
+                    capture_output=True,
+                    text=True,
+                    check=True,
+                    timeout=10,
+                )
+            except subprocess.TimeoutExpired:
+                self.fail(f"Command '{cmd} --help' timed out.")
             except subprocess.CalledProcessError as e:
                 self.fail(f"Command '{cmd} --help' failed with exit code {e.returncode}. Stderr: {e.stderr.strip()}")
-            except Exception as e:
+            except OSError as e:
                 self.fail(f"Failed to execute command '{cmd}': {e}")
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/test_jmcomic/test_jm_cli.py` around lines 56 - 61, Update the
subprocess invocation in the CLI smoke test: add timeout=10 to the
subprocess.run call in tests/test_jmcomic/test_jm_cli.py to avoid CI hangs, add
an except subprocess.TimeoutExpired handler that fails the test with a clear
timeout message, and replace the broad except Exception handler with except
OSError to precisely catch invocation errors (e.g.,
FileNotFoundError/PermissionError) for the command check in the try/except
surrounding subprocess.run([cmd, "--help"], ...).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@tests/test_jmcomic/test_jm_cli.py`:
- Around line 56-61: Update the subprocess invocation in the CLI smoke test: add
timeout=10 to the subprocess.run call in tests/test_jmcomic/test_jm_cli.py to
avoid CI hangs, add an except subprocess.TimeoutExpired handler that fails the
test with a clear timeout message, and replace the broad except Exception
handler with except OSError to precisely catch invocation errors (e.g.,
FileNotFoundError/PermissionError) for the command check in the try/except
surrounding subprocess.run([cmd, "--help"], ...).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: fdd1112b-f7fd-45c7-9f00-91f8460c87e6

📥 Commits

Reviewing files that changed from the base of the PR and between 2225136 and 5f2b5f1.

📒 Files selected for processing (3)
  • pyproject.toml
  • src/jmcomic/__init__.py
  • tests/test_jmcomic/test_jm_cli.py

@hect0x7 hect0x7 changed the title fix: 补充 pyproject.toml 中的 jmv 指令入口 (Fixes #527) v2.6.18: 修复 Linux 环境下全新安装时缺失 jmv 命令的问题 (#527); 增加环境变量集成校验 Apr 7, 2026
修复内容:
1. [稳定性提升] 为 CLI 终端探测的 subprocess 添加 timeout=10,防止测试机环境阻塞引发挂起
2. [问题捕获精度] 将底层极为宽泛的 Exception 拦截更改为 OSError,并独立捕获 TimeoutExpired
@hect0x7 hect0x7 merged commit 145af2a into master Apr 7, 2026
5 checks passed
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.

[Bug] JMV 命令: bash: jmv: command not found

1 participant