Skip to content

Fix tox error#181

Merged
bjk7119 merged 1 commit intomainfrom
fixtox_simple
Mar 11, 2026
Merged

Fix tox error#181
bjk7119 merged 1 commit intomainfrom
fixtox_simple

Conversation

@bjk7119
Copy link
Contributor

@bjk7119 bjk7119 commented Mar 9, 2026

Description

Fix PyInstaller build failure caused by chardet mypyc

  • chardet 5.0.0+ uses mypyc to compile code with dynamic module names
  • PyInstaller cannot detect these dynamic modules during build
  • Pin chardet<5.0.0 to use pure Python implementation
  • Explicitly collect binaryornot package data in PyInstaller hook
  • Add Hook datas for binaryornot

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Documentation update
  • Refactoring, Maintenance
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Summary by CodeRabbit

  • Chores
    • Updated project dependencies to improve compatibility and stability.
    • Enhanced packaging and build configuration to ensure proper handling of required components during distribution.
    • Optimized test configuration to streamline the testing process and improve build performance.

@bjk7119 bjk7119 requested a review from dd-jy March 9, 2026 07:06
@bjk7119 bjk7119 self-assigned this Mar 9, 2026
@bjk7119 bjk7119 added the chore [PR/Issue] Refactoring, maintenance the code label Mar 9, 2026
@coderabbitai
Copy link

coderabbitai bot commented Mar 9, 2026

📝 Walkthrough

Walkthrough

These changes extend PyInstaller packaging configuration, add a dependency constraint, and configure pytest to exclude specific directories. The fosslight_binary hook is extended to include resources from the binaryornot package, chardet is added to requirements with version bounds, and test discovery is refined.

Changes

Cohort / File(s) Summary
PyInstaller Hook Configuration
hooks/hook-fosslight_binary.py
Extends the hook to collect additional data, binaries, and hidden imports from the binaryornot package and append them to existing fosslight_binary collections.
Dependency Management
requirements.txt
Adds chardet dependency with version upper bound constraint (<5.0.0).
Test Configuration
tox.ini
Adds pytest norecursedirs directive to exclude third_party, build, dist, .tox, .git, and pycache directories from test discovery.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Fix tox error' is vague and lacks specificity about what tox error was fixed or how it was resolved. Use a more descriptive title that specifies the nature of the tox configuration fix, such as 'Add pytest norecursedirs configuration to tox.ini' or 'Fix tox pytest configuration and add chardet dependency'.
✅ Passed checks (2 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fixtox_simple

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

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@tox.ini`:
- Around line 23-25: The tox "release" environment currently only installs from
requirements-dev.txt so the new chardet entry in requirements.txt is not picked
up; update requirements-dev.txt to either include "-r requirements.txt" or add
"chardet" explicitly so the tox "release" env (invoked by the GitHub Actions
workflow using tox -e release) installs the missing dependency; modify the
requirements-dev.txt file accordingly to ensure chardet is available during the
release tox run.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 9c6ae798-0fd5-4441-ae33-42f1da03dabd

📥 Commits

Reviewing files that changed from the base of the PR and between b09cbe9 and fd8ca03.

📒 Files selected for processing (3)
  • hooks/hook-fosslight_binary.py
  • requirements.txt
  • tox.ini

Comment on lines 23 to +25
[pytest]
filterwarnings = ignore::DeprecationWarning
norecursedirs = third_party build dist .tox .git __pycache__
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== tox.ini =="
sed -n '1,120p' tox.ini

echo
echo "== requirements-dev wiring =="
fd '^requirements-dev\.txt$' -x sh -c 'echo "--- $1"; sed -n "1,160p" "$1"' sh {}

echo
echo "== GitHub Actions tox invocations =="
if [ -d .github/workflows ]; then
  fd -e yml -e yaml . .github/workflows -x sh -c '
    echo "--- $1"
    rg -n -C2 "\btox\b|test_run|release|requirements-dev|pip install" "$1" || true
  ' sh {}
else
  echo "No .github/workflows directory found"
fi

Repository: fosslight/fosslight_binary_scanner

Length of output: 3810


The default tox environment won't install chardet from the new requirements.txt entry.

The GitHub Actions workflow runs tox -e release (not test_run), and the release environment depends only on -r{toxinidir}/requirements-dev.txt (lines 42–46). Since requirements-dev.txt does not include -r requirements.txt or list chardet explicitly, the new chardet entry in requirements.txt will not be installed into tox. This change set will not fix the tox job unless requirements-dev.txt is updated to include the missing dependency.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tox.ini` around lines 23 - 25, The tox "release" environment currently only
installs from requirements-dev.txt so the new chardet entry in requirements.txt
is not picked up; update requirements-dev.txt to either include "-r
requirements.txt" or add "chardet" explicitly so the tox "release" env (invoked
by the GitHub Actions workflow using tox -e release) installs the missing
dependency; modify the requirements-dev.txt file accordingly to ensure chardet
is available during the release tox run.

@bjk7119 bjk7119 merged commit 2d36db1 into main Mar 11, 2026
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore [PR/Issue] Refactoring, maintenance the code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants