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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pysideup-1.0.0.tar.gz
.
File metadata
- Download URL: pysideup-1.0.0.tar.gz
- Upload date:
- Size: 3.2 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | be7f7c7e72401429dd0526c9f7e706efe9726739e7f62fd13d88a6280c26ac42 |
|
MD5 | 52cb44366b182fe40823ca38036221b1 |
|
BLAKE2b-256 | e5d8a7a359ed8ba907b80c9768e7ae16815baefb821f9a09dcb32a9b21c71348 |
File details
Details for the file pysideup-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: pysideup-1.0.0-py3-none-any.whl
- Upload date:
- Size: 2.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62fa76cdb11c743ec4140f7c8161204869593ee46614f41de7104f0ba1935bc1 |
|
MD5 | f22733d83bbc20e1752f70e4c05d6cfb |
|
BLAKE2b-256 | 746b4a68e951be149d8975d46b4521064fbbc78bed70d5aa7725338c833be57e |