Skip to content

Remove Python 2 compatibility code#1442

Merged
vojtechtrefny merged 1 commit intostoraged-project:mainfrom
vojtechtrefny:main_python2-relics-remove
Dec 4, 2025
Merged

Remove Python 2 compatibility code#1442
vojtechtrefny merged 1 commit intostoraged-project:mainfrom
vojtechtrefny:main_python2-relics-remove

Conversation

@vojtechtrefny
Copy link
Member

@vojtechtrefny vojtechtrefny commented Dec 3, 2025

Remove all remaining Python 2 compatibility imports and shebangs:

  • Remove future imports (print_function, absolute_import, division)
  • Update shebang in libmount_deb.py from python to python3
  • Remove obsolete Python 2/3 compatibility comments

These are no longer needed as blivet is Python 3 only.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Removed Python 2 compatibility imports and code across the project to streamline the codebase for Python 3-only environments.

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

Remove all remaining Python 2 compatibility imports and shebangs:
- Remove __future__ imports (print_function, absolute_import, division)
- Update shebang in libmount_deb.py from python to python3
- Remove obsolete Python 2/3 compatibility comments

These are no longer needed as blivet is Python 3 only.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@coderabbitai
Copy link

coderabbitai bot commented Dec 3, 2025

Walkthrough

This pull request removes Python 2 compatibility code across multiple files. Changes include removal of future imports (absolute_import, print_function, division) and updates to the Python 3 shebang, reflecting a migration away from Python 2 support.

Changes

Cohort / File(s) Change Summary
Python 2 compatibility removal
blivet/arch.py, misc/files/libmount_deb.py, tests/run_tests.py, tests/unit_tests/size_test.py
Removed Python 2 future imports (absolute_import, print_function, division) and associated compatibility comments. Updated interpreter shebang in misc/files/libmount_deb.py from /usr/bin/python to /usr/bin/python3. No functional logic changes.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

  • Changes are repetitive and follow a consistent pattern across all files
  • Removals are straightforward (dead code elimination)
  • No logic, control flow, or behavioral changes introduced
  • Low risk of introducing bugs

Pre-merge checks and finishing touches

✅ 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 'Remove Python 2 compatibility code' directly and accurately summarizes the main objective of the changeset, which removes future imports, updates shebangs, and removes compatibility comments across multiple files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 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.

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

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9d941f5 and 8954418.

📒 Files selected for processing (4)
  • blivet/arch.py (0 hunks)
  • misc/files/libmount_deb.py (1 hunks)
  • tests/run_tests.py (0 hunks)
  • tests/unit_tests/size_test.py (0 hunks)
💤 Files with no reviewable changes (3)
  • tests/run_tests.py
  • tests/unit_tests/size_test.py
  • blivet/arch.py
🧰 Additional context used
🪛 Ruff (0.14.7)
misc/files/libmount_deb.py

1-1: Shebang is present but file is not executable

(EXE001)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: static-analysis
  • GitHub Check: unit-tests
🔇 Additional comments (1)
misc/files/libmount_deb.py (1)

1-120: Python 3 migration looks good.

The removal of Python 2 compatibility code is appropriate and complete. The script correctly uses Python 3 features throughout (native print() function with keyword arguments, proper bytes/string handling with .decode()).

@@ -1,11 +1,9 @@
#!/usr/bin/python
#!/usr/bin/python3
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Make the file executable.

The shebang update to Python 3 is correct. However, files with shebangs should typically be executable.

Apply this command to fix the file permissions:

chmod +x misc/files/libmount_deb.py
🧰 Tools
🪛 Ruff (0.14.7)

1-1: Shebang is present but file is not executable

(EXE001)

🤖 Prompt for AI Agents
In misc/files/libmount_deb.py around line 1, the file has a Python3 shebang but
is not executable; fix it by setting the executable permission on the file (make
it runnable by the owner, e.g., run chmod +x on misc/files/libmount_deb.py) so
the shebang is respected when executed.

@vojtechtrefny vojtechtrefny merged commit f3c5e9b into storaged-project:main Dec 4, 2025
16 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.

1 participant