Skip to main content

A tool for converting PySide2 code to PySide6

Project description

PySideUp

This repository contains PySideUp, a tool for converting PySide2 code to PySide6. The conversion updates imports, changes outdated components, and ensures your project is compatible with PySide6.

Features

  • Automatic Import Update: Converts PySide2 imports to PySide6 equivalents.
  • Wildcard Handling: Converts wildcard imports to explicitly imported components.

Installation

You can install PySideUp from PyPI:

pip install pysideup

Usage

To convert a PySide2 file to PySide6, use the pysideup command:

pysideup <directory_path>

You can also specify directories to exclude using --exclude.

Example Conversions

Before Conversion (PySide2)

from PySide2.QtWidgets import QWidget, QVBoxLayout, QAction
from PySide2.QtGui import QIcon

class TestWidget(QWidget):
    def __init__(self):
        super().__init__()
        self.setWindowTitle("Test with QAction")
        layout = QVBoxLayout()
        self.setLayout(layout)
        action = QAction("Test Action", self)
        self.setWindowIcon(QIcon())

After Conversion (PySide6)

from PySide6.QtWidgets import QWidget, QVBoxLayout
from PySide6.QtGui import QAction, QIcon

class TestWidget(QWidget):
    def __init__(self):
        super().__init__()
        self.setWindowTitle("Test with QAction")
        layout = QVBoxLayout()
        self.setLayout(layout)
        action = QAction("Test Action", self)
        self.setWindowIcon(QIcon())

Running Unit Tests

Unit tests are provided to ensure that the conversion works as expected. To run the tests, execute:

python -m unittest discover

The tests cover various cases, including multiple imports, wildcard imports, and aliased imports.

Contributing

Contributions are welcome! Feel free to submit issues or pull requests for improvements or bug fixes.

License

This project is licensed under the MIT License.

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

pysideup-1.0.1.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

pysideup-1.0.1-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file pysideup-1.0.1.tar.gz.

File metadata

  • Download URL: pysideup-1.0.1.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

File hashes

Hashes for pysideup-1.0.1.tar.gz
Algorithm Hash digest
SHA256 347d0337fd3fc29ca6f197d6c16b44eb0cd44adeee7c56c133f5430b001f94c3
MD5 af29816a32434e5814b29eec9428fd2a
BLAKE2b-256 8cd96a05a8dc8be3bb22129e6e1b5b1727576b8372223e43376d3f3378f4a572

See more details on using hashes here.

File details

Details for the file pysideup-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: pysideup-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

File hashes

Hashes for pysideup-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 76146dcc5284625b3f9c215cb638286530c79cc6566569ea45123da6031cc14d
MD5 31b4da50f79ee7fd0c3260c8abbfcdb2
BLAKE2b-256 3917b2b783d9e6f06f7ba59cae59c86d16b14652f26267d76e5d33480d888ee4

See more details on using hashes here.

Supported by

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