refactor: Modernize for Python 3.12 LTS compatibility#4
Open
jokebear-bot wants to merge 3 commits intoCatosine:masterfrom
Open
refactor: Modernize for Python 3.12 LTS compatibility#4jokebear-bot wants to merge 3 commits intoCatosine:masterfrom
jokebear-bot wants to merge 3 commits intoCatosine:masterfrom
Conversation
Major Changes: - Updated dependencies to Python 3.12 compatible versions - wxPython 4.0.7.post2 → 4.2.0+ - pandas 0.25.3 → 2.0.0+ - opencv-python 4.2.0.32 → 4.9.0+ - Added numpy>=1.24.0 Code Modernization: - Migrated from .format() to f-strings - Added comprehensive type hints - Improved docstrings with Google style - Refactored to use pathlib.Path instead of os.path - Renamed variables to snake_case for consistency Project Structure: - Reorganized to src/ layout - Added pyproject.toml for modern packaging - Added .gitignore with comprehensive rules - Created __main__.py for module execution Documentation: - Updated README.md with Python 3.12 compatibility - Added multi-language README (English, Chinese, Japanese) - Added CHANGELOG.md following Keep a Changelog format BREAKING CHANGE: Minimum Python version raised to 3.9
Implements Catosine#1 Adds keyboard shortcuts for efficient video frame navigation: - Left/Right arrows: -1/+1 frame - Shift+Left/Right: -FPI/+FPI (N frames) - S: Select start frame - E: Select end frame - Ctrl+S: Save label Uses wx.AcceleratorTable for global key capture without requiring button focus.
Owner
|
Hello @jokebear-bot, It's a jolly good one, but I want you to refactor the codes under src to split the two giant scripts into structured codes; Thanks |
Author
|
@Catosine Refactoring completed as requested! 🐻 Changes Made1. Code Structure - Split into ModulesBefore:
After: 2. Comprehensive Inline CommentsAdded detailed comments throughout:
Example from # =========================================================================
# Frame Navigation
# =========================================================================
def next_frame(self) -> None:
"""Advance to the next frame (+1).
Moves the current frame position forward by 1 frame
and displays it. Does nothing if at the end of video.
"""
if not self._check_video_loaded():
return
if self.curr_frame < self.tot_frame - 1:
self.curr_frame += 1
self._display_current_frame()
else:
self.ui.update_error("Already at last frame")3. Organized Code StructureEach module now has clear responsibilities:
Let me know if any further adjustments are needed! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR modernizes the VideoTemporalLabelingTool to support Python 3.12 LTS and improves code quality.
Changes
Dependencies Upgrade
Project Structure
src/vtlt/package structurepyproject.tomlfor modern Python packaging.gitignoreCode Modernization
.format()to f-stringsos.pathwithpathlib.PathDocumentation
Testing
Contributed by Joke Bear