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.2.0.tar.gz (249.4 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.2.0-py3-none-any.whl (255.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pyside_migrate-0.2.0.tar.gz
Algorithm Hash digest
SHA256 1eb63165431019dcc3c53b3bdf53fdcc7159e8b0957105ebf83fdc11a7f90110
MD5 985ef145a736afac7ad57b6fb1e4c44b
BLAKE2b-256 2fc809c00ddb8ad37fc29d2e13ed4a9415133d4bec2cc1e3f8e7622e6b10b8b6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyside_migrate-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 18ad4aef22f890af267e8aee5cfe97c6a0aaea78086e4c301b4efac05b2cec86
MD5 c324e4b4d9ef0bcf73ac7540c90b324c
BLAKE2b-256 ee1f32ee688fa1b55ff841301bff3ce3b64e467e746f0c38bcaf350ae840f7a6

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