Remove six and Python 2 compatibility code#31
Conversation
Now that Python 3.4 is the lowest supported version, we can remove a large amount of code that support versions before it, as well as use of six, as well as the entire _compat module. Drive-by removing the pkg_resources check from setup.py since setuptools 39 is now ten years old.
WalkthroughThis PR removes Python 2 support from wirerope by eliminating the ChangesPython 2 compatibility removal
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@wirerope/callable.py`:
- Line 1: Remove the obsolete Python 2 compatibility import by deleting the line
"from __future__ import absolute_import" at the top of callable.py; no other
code changes required since the project no longer targets Python 2 and this
import has no effect in Python 3.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 75a581b5-b45f-4474-b3e5-de9d061ccb4f
📒 Files selected for processing (6)
setup.cfgsetup.pywirerope/_compat.pywirerope/callable.pywirerope/rope.pywirerope/wire.py
💤 Files with no reviewable changes (3)
- setup.cfg
- wirerope/_compat.py
- setup.py
| @@ -1,9 +1,8 @@ | |||
| from __future__ import absolute_import | |||
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial | 💤 Low value
Consider removing the obsolete __future__ import.
from __future__ import absolute_import has no effect in Python 3. Since this PR removes Python 2 support, this import can be removed for consistency.
🧹 Suggested cleanup
-from __future__ import absolute_import
-
import inspect📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| from __future__ import absolute_import | |
| import inspect |
🧰 Tools
🪛 Ruff (0.15.15)
[warning] 1-1: Unnecessary __future__ import absolute_import for target Python version
Remove unnecessary __future__ import
(UP010)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@wirerope/callable.py` at line 1, Remove the obsolete Python 2 compatibility
import by deleting the line "from __future__ import absolute_import" at the top
of callable.py; no other code changes required since the project no longer
targets Python 2 and this import has no effect in Python 3.
Now that Python 3.4 is the lowest supported version, we can remove a large amount of code that support versions before it, as well as use of six, as well as the entire _compat module. Drive-by removing the pkg_resources check from setup.py since setuptools 39 is now ten years old.
Summary by CodeRabbit
Release Notes