Skip to content

fix(deps): add Pygments to requirements.txt (rich.syntax dep)#9819

Merged
iav merged 1 commit into
armbian:mainfrom
iav:fix/pygments-rich-syntax
May 14, 2026
Merged

fix(deps): add Pygments to requirements.txt (rich.syntax dep)#9819
iav merged 1 commit into
armbian:mainfrom
iav:fix/pygments-rich-syntax

Conversation

@iav
Copy link
Copy Markdown
Contributor

@iav iav commented May 13, 2026

lib/tools/patching.py:444 imports from rich.syntax import Syntax. The rich package pinned in requirements.txt has pygments<3.0.0,>=2.13.0 listed in its PyPI requires_dist, yet on a fresh host the install resolved to rich without pulling Pygments (possibly an interaction with the pinned pip == 26.1.1 resolver or a cached pip-hash short-circuit). The build fails with:

Traceback (most recent call last):
  File "/armbian/lib/tools/patching.py", line 444, in <module>
    from rich.syntax import Syntax
  File ".../rich/syntax.py", line 24, in <module>
    from pygments.lexer import Lexer
ModuleNotFoundError: No module named 'pygments'

Reproduced on a fresh Hetzner CAX21 (Ubuntu Noble 6.8) with:

./compile.sh build BOARD=helios4 BRANCH=edge BUILD_MINIMAL=yes \
  RELEASE=noble PREFER_DOCKER=yes KERNEL_CONFIGURE=no EXPERT=yes \
  ARTIFACT_IGNORE_CACHE=yes

Fail surface is the u-boot patching phase (uboot_main_patching_python); any code path that imports rich.syntax is affected.

Pinning Pygments == 2.19.1 explicitly in requirements.txt is a defensive fix — dependabot will keep it current alongside rich.

Assisted-by: Claude:claude-opus-4.7

Summary by CodeRabbit

  • Chores
    • Updated syntax highlighting dependency to a pinned version.

Review Change Stack

`lib/tools/patching.py` imports `from rich.syntax import Syntax`. The
`rich` package already in requirements.txt does not pull `pygments` as a
hard dep — it is an extras_require for syntax highlighting. On a fresh
host where `requirements.txt` is the only source of pip installs, the
build fails:

  Traceback (most recent call last):
    File "/armbian/lib/tools/patching.py", line 444, in <module>
      from rich.syntax import Syntax
    File ".../rich/syntax.py", line 24, in <module>
      from pygments.lexer import Lexer
  ModuleNotFoundError: No module named 'pygments'

Pin Pygments == 2.19.1 so dependabot can keep it current alongside rich.

Assisted-by: Claude:claude-opus-4.7
@iav iav requested a review from igorpecovnik as a code owner May 13, 2026 22:44
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 13, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c1ba8fe2-5326-4ac3-b31f-54b375b96948

📥 Commits

Reviewing files that changed from the base of the PR and between 761d04e and 2189fd8.

📒 Files selected for processing (1)
  • requirements.txt

📝 Walkthrough

Walkthrough

This PR adds a single pinned dependency on Pygments version 2.19.1 to requirements.txt, explicitly marking it as required by the rich.syntax module for syntax highlighting functionality.

Changes

Dependencies

Layer / File(s) Summary
Pygments dependency
requirements.txt
Pygments == 2.19.1 is pinned and added to requirements with a clarifying comment that it is required by rich.syntax.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 A library so bright, for colors so fine,
Pygments joins the fold, locked to 2.19!
Rich syntax now shines with its proper delight,
One line in requirements makes everything right! ✨

🚥 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 and concisely summarizes the main change: adding Pygments as an explicit dependency to requirements.txt to fix a missing dependency issue with rich.syntax.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@github-actions github-actions Bot added Needs review Seeking for review size/small PR with less then 50 lines 05 Milestone: Second quarter release labels May 13, 2026
@github-actions github-actions Bot added the Ready to merge Reviewed, tested and ready for merge label May 14, 2026
@github-actions
Copy link
Copy Markdown
Contributor

✅ This PR has been reviewed and approved — all set for merge!

@github-actions github-actions Bot removed the Needs review Seeking for review label May 14, 2026
@iav iav added the Dependencies Pull requests that update a dependency label May 14, 2026
@iav iav merged commit bac1cad into armbian:main May 14, 2026
14 checks passed
@iav iav deleted the fix/pygments-rich-syntax branch May 15, 2026 03:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

05 Milestone: Second quarter release Dependencies Pull requests that update a dependency Ready to merge Reviewed, tested and ready for merge size/small PR with less then 50 lines

Development

Successfully merging this pull request may close these issues.

2 participants