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.3.0.tar.gz (252.5 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.3.0-py3-none-any.whl (259.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pyside_migrate-0.3.0.tar.gz
Algorithm Hash digest
SHA256 1587fae7454809faa20a6f7833509d3a4915fc0e17c2505bd742c52e7f925da0
MD5 7adbe3ec85cde5c1fc3b78a3c95ce23c
BLAKE2b-256 7f971a1fbc0fdd0f6e52b2036d9bd3da96da7ad68c0ec85cfab09f5dbe793778

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyside_migrate-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f1564ffe8050ebe5705d7e3601dc675ca00927f2a4882fd807eae15bbd775175
MD5 6c062064ab8403813dc1e2d2e350df92
BLAKE2b-256 8d59923af4bd4ede1cc63793e03f08775d07ba5c931e404942d6a76af8d9e869

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