Skip to content

import .gitattributes from CPython#6939

Merged
youknowone merged 1 commit into
RustPython:mainfrom
youknowone:gitattributes
Feb 1, 2026
Merged

import .gitattributes from CPython#6939
youknowone merged 1 commit into
RustPython:mainfrom
youknowone:gitattributes

Conversation

@youknowone

@youknowone youknowone commented Feb 1, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • Chores
    • Expanded repository attributes: broader binary and text classifications, explicit no-EOL markers, and per-file LF/CRLF rules to standardize line endings.
    • Added language-aware diff hints and generated/vendored markers to improve diff headers and to flag generated or third-party files for clearer version control presentation.

✏️ Tip: You can customize this high-level summary in your review settings.

@youknowone youknowone marked this pull request as ready for review February 1, 2026 14:38
@coderabbitai

coderabbitai Bot commented Feb 1, 2026

Copy link
Copy Markdown
Contributor

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

The .gitattributes file is expanded with explicit binary type classifications (images, archives, executables), many diff style hints (diff=css/html/python/markdown), and extensive linguist overrides marking numerous Lib/* and test paths as generated or vendored. It also adds explicit text/eol and per-file noeol rules.

Changes

Cohort / File(s) Summary
Git Attributes Configuration
.gitattributes
Replaced the previous *.pck binary rule with a broad set of binary classifications (images, archives, executables, fonts, blobs); added diff= hints for CSS/HTML/Python/Markdown and a diff=generated marker; added many generated / vendored linguist overrides for Lib/* and test files; added explicit -text/noeol entries and LF/CRLF eol rules for specific scripts and test files. Areas to review: generated/vendored path selection, per-file noeol placements, and diff driver mappings.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

🐰
I nibble lines in git tonight,
Mark binaries, diffs, and files just right.
LF hops in, CRLF takes a bow,
Generated flags — I tidy now.
A tiny hop — repo gleams with light! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: importing .gitattributes configuration from CPython, which is reflected in the comprehensive updates to .gitattributes rules and binary/text handling metadata.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Fix all issues with AI agents
In @.gitattributes:
- Around line 29-31: Remove the unused CPython-specific gitattributes rule
"PC/classicAppCompat.*" from the .gitattributes file; locate the line containing
the literal pattern "PC/classicAppCompat.* binary" and delete it so the file no
longer contains the nonexistent PC/ directory rule.
- Around line 32-40: Remove the erroneous attribute entry
"Lib/test/cjkencodings/*                    noeol" from .gitattributes; locate
the matching pattern string in the "Text files that should not be subject to eol
conversion" block and delete that single line so only existing test-data
directories (e.g., tokenizedata, decimaltestdata, test_email, xmltestdata)
remain.
- Around line 56-71: Remove or correct .gitattributes entries that reference
files not present in our repo: delete the lines for Lib/idlelib/help.html,
Lib/test/levenshtein_examples.json, and Lib/test/test_stable_abi_ctypes.py; then
verify whether Lib/_opcode_metadata.py, Lib/keyword.py, Lib/token.py and files
under Lib/test/certdata/ are actually produced by our build/generation pipeline
(or exist in source) and if not, remove their "generated" markers; if they are
generated, ensure the generation step emits those files and document/update the
build scripts to match so the attributes stay accurate.

Comment thread .gitattributes Outdated
Comment on lines +29 to +31
# Specific binary files
PC/classicAppCompat.* binary

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check for CPython-specific paths referenced in .gitattributes

echo "=== Checking PC/classicAppCompat.* ==="
fd -g 'classicAppCompat.*' PC/ 2>/dev/null || echo "PC/ directory or classicAppCompat.* not found"

echo ""
echo "=== Listing PC directory contents (if exists) ==="
ls -la PC/ 2>/dev/null || echo "PC/ directory not found"

echo ""
echo "=== Checking if PC directory exists ==="
if [ -d "PC" ]; then
  echo "PC/ directory exists"
  find PC -type f | head -20
else
  echo "PC/ directory does not exist"
fi

Repository: RustPython/RustPython

Length of output: 294


Remove the unused PC/classicAppCompat.* rule from .gitattributes.

The PC/ directory does not exist in the RustPython repository. This CPython-specific rule will never match any files and should be removed to avoid unnecessary clutter and confusion when maintaining the repository.

🤖 Prompt for AI Agents
In @.gitattributes around lines 29 - 31, Remove the unused CPython-specific
gitattributes rule "PC/classicAppCompat.*" from the .gitattributes file; locate
the line containing the literal pattern "PC/classicAppCompat.* binary" and
delete it so the file no longer contains the nonexistent PC/ directory rule.

Comment thread .gitattributes
Comment on lines +32 to +40
# Text files that should not be subject to eol conversion
[attr]noeol -text

Lib/test/cjkencodings/* noeol
Lib/test/tokenizedata/coding20731.py noeol
Lib/test/decimaltestdata/*.decTest noeol
Lib/test/test_email/data/*.txt noeol
Lib/test/xmltestdata/* noeol

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check if CPython test data paths exist in RustPython

echo "=== Checking for test data directories ==="
for dir in "cjkencodings" "tokenizedata" "decimaltestdata" "test_email" "xmltestdata"; do
  if [ -d "Lib/test/$dir" ]; then
    echo "✓ Lib/test/$dir exists"
  else
    echo "✗ Lib/test/$dir not found"
  fi
done

echo -e "\n=== Checking specific file ==="
if [ -f "Lib/test/tokenizedata/coding20731.py" ]; then
  echo "✓ Lib/test/tokenizedata/coding20731.py exists"
else
  echo "✗ Lib/test/tokenizedata/coding20731.py not found"
fi

echo -e "\n=== Listing Lib/test subdirectories ==="
ls -d Lib/test/*/ 2>/dev/null | head -15

Repository: RustPython/RustPython

Length of output: 708


Remove the non-existent Lib/test/cjkencodings/ path from .gitattributes (line 35).

The directory Lib/test/cjkencodings/ does not exist in RustPython's repository, unlike the other test data directories referenced in this section (tokenizedata, decimaltestdata, test_email, xmltestdata). Remove this line to keep the configuration accurate.

🤖 Prompt for AI Agents
In @.gitattributes around lines 32 - 40, Remove the erroneous attribute entry
"Lib/test/cjkencodings/*                    noeol" from .gitattributes; locate
the matching pattern string in the "Text files that should not be subject to eol
conversion" block and delete that single line so only existing test-data
directories (e.g., tokenizedata, decimaltestdata, test_email, xmltestdata)
remain.

Comment thread .gitattributes
Comment on lines +56 to +71
# Generated files
# https://github.com/github/linguist/blob/master/docs/overrides.md
#
# To always hide generated files in local diffs, mark them as binary:
# $ git config diff.generated.binary true
#
[attr]generated linguist-generated=true diff=generated

Lib/_opcode_metadata.py generated
Lib/keyword.py generated
Lib/idlelib/help.html generated
Lib/test/certdata/*.pem generated
Lib/test/certdata/*.0 generated
Lib/test/levenshtein_examples.json generated
Lib/test/test_stable_abi_ctypes.py generated
Lib/token.py generated

Copy link
Copy Markdown
Contributor

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
# Check if the listed files exist in RustPython

echo "=== Checking individual generated Python files ==="
for file in Lib/_opcode_metadata.py Lib/keyword.py Lib/token.py; do
  if test -f "$file"; then
    echo "$file exists ($(wc -l < "$file") lines)"
  else
    echo "$file not found"
  fi
done

echo -e "\n=== Checking IDLE help ==="
if test -f Lib/idlelib/help.html; then
  echo "✓ Lib/idlelib/help.html exists"
else
  echo "✗ Lib/idlelib/help.html not found"
fi

echo -e "\n=== Checking test data directory ==="
if test -d Lib/test/certdata; then
  file_count=$(find Lib/test/certdata -type f 2>/dev/null | wc -l)
  echo "✓ Lib/test/certdata/ exists with $file_count files"
else
  echo "✗ Lib/test/certdata/ not found"
fi

echo -e "\n=== Checking levenshtein and stable ABI test files ==="
for file in Lib/test/levenshtein_examples.json Lib/test/test_stable_abi_ctypes.py; do
  if test -f "$file"; then
    echo "$file exists"
  else
    echo "$file not found"
  fi
done

echo -e "\n=== Checking repository structure ==="
echo "Repository root structure:"
ls -la | grep -E "^d" | head -20

Repository: RustPython/RustPython

Length of output: 1805


🏁 Script executed:

#!/bin/bash
# Check if these files are referenced in build configs or if they're CPython-specific

echo "=== Searching for help.html references ==="
rg "help\.html" --type py --type rust --type toml --type md 2>/dev/null | head -20

echo -e "\n=== Searching for levenshtein_examples references ==="
rg "levenshtein_examples" --type py --type rust --type toml 2>/dev/null | head -20

echo -e "\n=== Searching for test_stable_abi_ctypes references ==="
rg "test_stable_abi_ctypes" --type py --type rust --type toml 2>/dev/null | head -20

echo -e "\n=== Checking if these are CPython standard files ==="
echo "CPython stdlib would have help.html (IDLE help)"
echo "CPython stdlib would have levenshtein_examples.json (test data)"
echo "CPython stdlib would have test_stable_abi_ctypes.py (ctypes stable ABI test)"

echo -e "\n=== Checking .gitattributes history ==="
git log --oneline .gitattributes 2>/dev/null | head -5

echo -e "\n=== Checking if certdata is truly generated ==="
ls -la Lib/test/certdata/ | head -10

Repository: RustPython/RustPython

Length of output: 1528


Remove or verify entries for non-existent files marked as generated.

The .gitattributes file was imported from CPython but contains entries for files that don't exist in RustPython: Lib/idlelib/help.html, Lib/test/levenshtein_examples.json, and Lib/test/test_stable_abi_ctypes.py. These should either be removed if they're not needed or added to the repository if they're required. Additionally, verify that Lib/test/certdata/ files and the Python stdlib files (_opcode_metadata.py, keyword.py, token.py) are actually generated during the build process, as marking non-generated files as such can cause confusing diff behavior.

🤖 Prompt for AI Agents
In @.gitattributes around lines 56 - 71, Remove or correct .gitattributes
entries that reference files not present in our repo: delete the lines for
Lib/idlelib/help.html, Lib/test/levenshtein_examples.json, and
Lib/test/test_stable_abi_ctypes.py; then verify whether Lib/_opcode_metadata.py,
Lib/keyword.py, Lib/token.py and files under Lib/test/certdata/ are actually
produced by our build/generation pipeline (or exist in source) and if not,
remove their "generated" markers; if they are generated, ensure the generation
step emits those files and document/update the build scripts to match so the
attributes stay accurate.

@youknowone youknowone merged commit d907922 into RustPython:main Feb 1, 2026
1 of 2 checks passed
@youknowone youknowone deleted the gitattributes branch February 1, 2026 15:27
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.

1 participant