Skip to main content

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

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.json will be transformed
  • The tool preserves import statements; you'll still need to manually update PySide2 imports to PySide6 after 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)

Source distribution for pyside-migrate 0.4.0
File Size Uploaded
pyside_migrate-0.4.0.tar.gz 255.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyside-migrate 0.4.0
File Interpreter ABI Platform
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

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page