PySide Migrate
A command-line tool for migrating PySide2 code to PySide6, currently focusing on enum namespace changes.
Overview
PySide6 introduced changes to how enums are accessed. In PySide2, many enums were accessed directly through the Qt namespace (e.g., Qt.AlignCenter). In PySide6, these enums have been moved to their specific enum classes (e.g., Qt.AlignmentFlag.AlignCenter).
This tool automates the migration process by transforming your PySide2 code to use the enum locations that are expected by PySide6. It supports transforming code that uses PySide2 or Qt.py.
Usage
Using uv (recommended)
uvx pyside-migrate ../path/to/code/
Using pip
pip install pyside-migrate
pyside-migrate ../path/to/code/
Examples
Before migration:
from PySide2.QtCore import Qt
alignment = Qt.AlignCenter
button = Qt.LeftButton
flags = Qt.AlignLeft | Qt.AlignTop
After migration:
from PySide2.QtCore import Qt
alignment = Qt.AlignmentFlag.AlignCenter
button = Qt.MouseButton.LeftButton
flags = Qt.AlignmentFlag.AlignLeft | Qt.AlignmentFlag.AlignTop
Development
Running tests
Using uv:
uv run pytest
Or with pytest directly:
pytest
Requirements
- Python 3.10 or higher
- libcst 1.0.0 or higher
License
MIT
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Known Limitations
- The tool currently focuses on enum migrations and does not handle other PySide2 to PySide6 breaking changes
- Only enums defined in
enum-mappings.jsonwill be transformed - The tool preserves import statements; you'll still need to manually update
PySide2imports toPySide6after running the enum migrations
Metadata
Release files for pyside-migrate 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyside_migrate-0.4.0.tar.gz | 255.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyside_migrate-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 517.2 kB
Release files / pyside_migrate-0.4.0.tar.gz
| Download URL | pyside_migrate-0.4.0.tar.gz |
|---|---|
| Size | 255.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
feeef117865062713dbdb5464a8a3a12e10324cca3d70e827fc9fc43f27e83b3
|
|
BLAKE2b-256 checksum How to use checksums |
50052cb0445c0f465819dc10b9caf63354fdcea3f89966fab4f312c17c69c910
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.17
|
Release files / pyside_migrate-0.4.0-py3-none-any.whl
| Download URL | pyside_migrate-0.4.0-py3-none-any.whl |
|---|---|
| Size | 262.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b64ad5a24252ebb3dcf3817e7d9d06f6f8e958206efc0f7a8f491c996f9fca8b
|
|
BLAKE2b-256 checksum How to use checksums |
ff2fb70da14603530425084fa6905d7829ae7af0cff8472c9b7b8d2aa5738e50
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.17
|