Command-line tool to migrate PySide2 code to PySide6
Project description
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
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyside_migrate-0.1.0.tar.gz.
File metadata
- Download URL: pyside_migrate-0.1.0.tar.gz
- Upload date:
- Size: 18.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
582d55e9a04ca46031b74655944772598487fca6cff23e3bedaac19400ab12a7
|
|
| MD5 |
ebe6d3b135ae93a7d7d0193effa55280
|
|
| BLAKE2b-256 |
023670e0f41446932440713da02dc172d1256eaa5da0137aca0b907c0f56418b
|
File details
Details for the file pyside_migrate-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pyside_migrate-0.1.0-py3-none-any.whl
- Upload date:
- Size: 17.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b7359785f51b8059f9719c2a3b69caa64473fe8a44a0306bbb16586593d2acde
|
|
| MD5 |
448941ff97920f0ae0f3418bd03f3326
|
|
| BLAKE2b-256 |
f4c3dd8ea862a2632f6ed2d5cd302956215bf68accec8861398bc8d7b2d0b1cd
|