hiroshinishio / tetris

A Tetris Game for programming education in Japanese
MIT License
0 stars 0 forks source link

GitAuto: Replace PyQt5 with PyQt6 #5

Closed gitauto-for-dev[bot] closed 1 month ago

gitauto-for-dev[bot] commented 1 month ago

Resolves #1

What is the feature

This feature replaces PyQt5 with PyQt6 across the project.

Why we need the feature

Upgrading to PyQt6 ensures that the project stays current with the latest developments in the Qt framework. PyQt6 provides:

Staying updated reduces technical debt and simplifies future maintenance.

How to implement and why

Think step by step.

  1. Update Dependency Files:

    • Modify requirements.txt and requirements.pytorch.txt to replace PyQt5 with PyQt6.
    • This ensures that the correct version is installed during setup.
  2. Adjust Import Statements:

    • Search for all instances of from PyQt5 and replace them with from PyQt6.
    • Update any class or module imports that have changed in PyQt6 (e.g., QtWidgets, QtCore, QtGui).
  3. Modify Code for API Changes:

    • PyQt6 has introduced several breaking changes:
      • Enums: Enums are now accessed through scoped namespaces (e.g., QtCore.Qt.AlignmentFlag.AlignCenter).
      • Print Function: The print function is no longer a builtin in some PyQt6 modules; ensure all print statements are compatible with Python 3.
      • Removed Modules: Some modules/classes may have been removed or renamed.
    • Refactor code to accommodate these changes.
  4. Update Signal and Slot Connections:

    • The syntax for signals and slots may have changed.
    • Use the new @QtCore.pyqtSlot and @QtCore.pyqtSignal decorators where appropriate.
  5. Test the Application Thoroughly:

    • Run all existing tests to ensure functionality remains intact.
    • Manually test UI components to check for any runtime issues.
  6. Update Documentation:

    • Reflect changes in any documentation, READMEs, or docstrings.
    • If setup or installation instructions mention PyQt5, update them to PyQt6.
  7. Docker and Deployment Configurations:

    • If using Docker, ensure that Docker images and docker-compose files are updated to include PyQt6.
    • Update any scripts in the docker directory that reference PyQt5.

About backward compatibility

Do we need to keep backward compatibility?

Conclusion:

Test these changes locally

git checkout -b gitauto-wes/issue-#1-daefcda9-3d7c-42a8-9c60-4c800bf0e075
git pull origin gitauto-wes/issue-#1-daefcda9-3d7c-42a8-9c60-4c800bf0e075