Skip to main content

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.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

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

pyside_migrate-0.4.0.tar.gz (255.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyside_migrate-0.4.0-py3-none-any.whl (262.2 kB view details)

Uploaded Python 3

File details

Details for the file pyside_migrate-0.4.0.tar.gz.

File metadata

  • Download URL: pyside_migrate-0.4.0.tar.gz
  • Upload date:
  • Size: 255.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.17

File hashes

Hashes for pyside_migrate-0.4.0.tar.gz
Algorithm Hash digest
SHA256 feeef117865062713dbdb5464a8a3a12e10324cca3d70e827fc9fc43f27e83b3
MD5 d26ed337c17831ab26469393296a6537
BLAKE2b-256 50052cb0445c0f465819dc10b9caf63354fdcea3f89966fab4f312c17c69c910

See more details on using hashes here.

File details

Details for the file pyside_migrate-0.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pyside_migrate-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b64ad5a24252ebb3dcf3817e7d9d06f6f8e958206efc0f7a8f491c996f9fca8b
MD5 c1c38d9054cffc3630da263f9e8dc4cb
BLAKE2b-256 ff2fb70da14603530425084fa6905d7829ae7af0cff8472c9b7b8d2aa5738e50

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page