pyside6-qml-stubgen


Namepyside6-qml-stubgen JSON
Version 0.1.0a1 PyPI version JSON
download
home_pageNone
SummaryGenerate QML stub files (.qmltypes) from Python modules (which use PySide6)
upload_time2024-04-05 10:32:00
maintainerNone
docs_urlNone
authorMatthew Joyce
requires_python>=3.10
licenseNone
keywords pyside6 qml qt6 type checking
VCS
bugtrack_url
requirements black build click coverage docopt iniconfig mypy mypy-extensions packaging pathspec platformdirs pluggy pyproject_hooks PySide6 PySide6_Addons PySide6_Essentials pytest pytest-cov shiboken6 types-docopt typing_extensions
Travis-CI No Travis.
coveralls test coverage No coveralls.
            pyside6-qml-stubgen
===================

Generate QML stub files (`.qmltypes`) from Python modules (which use PySide6)

Installation
------------

This tool can be installed though PyPI:

```bash
pip install pyside6-qml-stubgen
```

If you want to use a development version, instead clone the repo and then install using pip:

```bash
git clone https://github.com/matsjoyce/pyside6-qml-stubgen.git
pip install ./pyside6-qml-stubgen
```

This tool has been tested on Linux, Windows and MacOS using pip-installed PySide6 (on GitHub Actions), and on Arch Linux using system packages. It does not run with PyQt6, although it should be possible in theory (send a PR if you get it working). And finally, it does not run using Qt 5 (PySide2 or PyQt5), as that version is no longer being developed, and QML in Qt 5 has less features than in Qt 6, making it a less attractive target for this sort of tool.

Simple example
--------------

As an example, we'll run this tool on https://github.com/matsjoyce/fantasia2. There are two steps to type checking your QML code when using PySide6. First generate the QML type stubs using this tool:

```bash
pyside6-qml-stubgen fantasia2 --out-dir qmltypes --ignore fantasia2/alembic/
```

This command will generate a folder tree containing `.qmltypes` files and `qmldir` files matching the runtime structure of QML modules registered by the Python modules.

The second step is to run `qmllint` on your QML files using the type stubs:

```bash
/usr/lib/qt6/bin/qmllint fantasia2/*.qml -I ./qmltypes
```

If you change the QML files, you can just rerun `qmllint`. If you change the Python interface, you should rerun both commands.

Links to other projects
-----------------------

This tool relies heavily on PySide6, and is inspired by the [`metaobjectdump.py`](https://code.qt.io/cgit/pyside/pyside-setup.git/tree/sources/pyside-tools/metaobjectdump.py) tool, although this tool uses a runtime approach instead of static analysis, as that works better on large programs.

Command-line arguments
----------------------

```bash
$ pyside6-qml-stubgen --help
Generate QML stub files (.qmltypes) from Python modules (which use PySide6)

Usage:
    pyside6-qml-stubgen <in-dir> --out-dir=<out-dir> [--ignore=<path>...] [--metatypes-dir=<dir>] [--qmltyperegistrar-path=<path>]

Options:
    --ignore=<path>                     Ignore all Python files that are children of thispath
    --metatypes-dir=<dir>               Directory of the Qt 6 metatype files for core modules (automatically detected if not provided)
    --qmltyperegistrar-path=<path>      Path of the qmltyperegistrar tool (automatically detected if not provided)
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pyside6-qml-stubgen",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "pyside6, qml, qt6, type checking",
    "author": "Matthew Joyce",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/68/7b/8c458d5db1e5a44642b19cb439542eeb44e514b130a53e59187f9701c03c/pyside6_qml_stubgen-0.1.0a1.tar.gz",
    "platform": null,
    "description": "pyside6-qml-stubgen\n===================\n\nGenerate QML stub files (`.qmltypes`) from Python modules (which use PySide6)\n\nInstallation\n------------\n\nThis tool can be installed though PyPI:\n\n```bash\npip install pyside6-qml-stubgen\n```\n\nIf you want to use a development version, instead clone the repo and then install using pip:\n\n```bash\ngit clone https://github.com/matsjoyce/pyside6-qml-stubgen.git\npip install ./pyside6-qml-stubgen\n```\n\nThis tool has been tested on Linux, Windows and MacOS using pip-installed PySide6 (on GitHub Actions), and on Arch Linux using system packages. It does not run with PyQt6, although it should be possible in theory (send a PR if you get it working). And finally, it does not run using Qt 5 (PySide2 or PyQt5), as that version is no longer being developed, and QML in Qt 5 has less features than in Qt 6, making it a less attractive target for this sort of tool.\n\nSimple example\n--------------\n\nAs an example, we'll run this tool on https://github.com/matsjoyce/fantasia2. There are two steps to type checking your QML code when using PySide6. First generate the QML type stubs using this tool:\n\n```bash\npyside6-qml-stubgen fantasia2 --out-dir qmltypes --ignore fantasia2/alembic/\n```\n\nThis command will generate a folder tree containing `.qmltypes` files and `qmldir` files matching the runtime structure of QML modules registered by the Python modules.\n\nThe second step is to run `qmllint` on your QML files using the type stubs:\n\n```bash\n/usr/lib/qt6/bin/qmllint fantasia2/*.qml -I ./qmltypes\n```\n\nIf you change the QML files, you can just rerun `qmllint`. If you change the Python interface, you should rerun both commands.\n\nLinks to other projects\n-----------------------\n\nThis tool relies heavily on PySide6, and is inspired by the [`metaobjectdump.py`](https://code.qt.io/cgit/pyside/pyside-setup.git/tree/sources/pyside-tools/metaobjectdump.py) tool, although this tool uses a runtime approach instead of static analysis, as that works better on large programs.\n\nCommand-line arguments\n----------------------\n\n```bash\n$ pyside6-qml-stubgen --help\nGenerate QML stub files (.qmltypes) from Python modules (which use PySide6)\n\nUsage:\n    pyside6-qml-stubgen <in-dir> --out-dir=<out-dir> [--ignore=<path>...] [--metatypes-dir=<dir>] [--qmltyperegistrar-path=<path>]\n\nOptions:\n    --ignore=<path>                     Ignore all Python files that are children of thispath\n    --metatypes-dir=<dir>               Directory of the Qt 6 metatype files for core modules (automatically detected if not provided)\n    --qmltyperegistrar-path=<path>      Path of the qmltyperegistrar tool (automatically detected if not provided)\n```\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Generate QML stub files (.qmltypes) from Python modules (which use PySide6)",
    "version": "0.1.0a1",
    "project_urls": {
        "Homepage": "https://github.com/matsjoyce/pyside6-qml-stubgen",
        "Issues": "https://github.com/matsjoyce/pyside6-qml-stubgen/issues",
        "Repository": "https://github.com/matsjoyce/pyside6-qml-stubgen.git"
    },
    "split_keywords": [
        "pyside6",
        " qml",
        " qt6",
        " type checking"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "182ac7f297e76f908f53ab780892e6414919cc5a624a24a15408fe69cfcac110",
                "md5": "b5e5619070f83feb75a1ff718b7ba49c",
                "sha256": "dd6db37683c8f3950ee40047c0b4d95aea7ac9e67083f2aed487253f6c2f41d6"
            },
            "downloads": -1,
            "filename": "pyside6_qml_stubgen-0.1.0a1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b5e5619070f83feb75a1ff718b7ba49c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 10629,
            "upload_time": "2024-04-05T10:31:58",
            "upload_time_iso_8601": "2024-04-05T10:31:58.582642Z",
            "url": "https://files.pythonhosted.org/packages/18/2a/c7f297e76f908f53ab780892e6414919cc5a624a24a15408fe69cfcac110/pyside6_qml_stubgen-0.1.0a1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "687b8c458d5db1e5a44642b19cb439542eeb44e514b130a53e59187f9701c03c",
                "md5": "1f5e6f01bb58f868e8289dcf659a3925",
                "sha256": "bdfe75d23a4e1aefbe3e6bcbc9cb159a1d39d61a3d1e5840e33c162d38c92a2c"
            },
            "downloads": -1,
            "filename": "pyside6_qml_stubgen-0.1.0a1.tar.gz",
            "has_sig": false,
            "md5_digest": "1f5e6f01bb58f868e8289dcf659a3925",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 15042,
            "upload_time": "2024-04-05T10:32:00",
            "upload_time_iso_8601": "2024-04-05T10:32:00.060438Z",
            "url": "https://files.pythonhosted.org/packages/68/7b/8c458d5db1e5a44642b19cb439542eeb44e514b130a53e59187f9701c03c/pyside6_qml_stubgen-0.1.0a1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-05 10:32:00",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "matsjoyce",
    "github_project": "pyside6-qml-stubgen",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "black",
            "specs": [
                [
                    "==",
                    "24.3.0"
                ]
            ]
        },
        {
            "name": "build",
            "specs": [
                [
                    "==",
                    "1.1.1"
                ]
            ]
        },
        {
            "name": "click",
            "specs": [
                [
                    "==",
                    "8.1.7"
                ]
            ]
        },
        {
            "name": "coverage",
            "specs": [
                [
                    "==",
                    "7.4.4"
                ]
            ]
        },
        {
            "name": "docopt",
            "specs": [
                [
                    "==",
                    "0.6.2"
                ]
            ]
        },
        {
            "name": "iniconfig",
            "specs": [
                [
                    "==",
                    "2.0.0"
                ]
            ]
        },
        {
            "name": "mypy",
            "specs": [
                [
                    "==",
                    "1.9.0"
                ]
            ]
        },
        {
            "name": "mypy-extensions",
            "specs": [
                [
                    "==",
                    "1.0.0"
                ]
            ]
        },
        {
            "name": "packaging",
            "specs": [
                [
                    "==",
                    "24.0"
                ]
            ]
        },
        {
            "name": "pathspec",
            "specs": [
                [
                    "==",
                    "0.12.1"
                ]
            ]
        },
        {
            "name": "platformdirs",
            "specs": [
                [
                    "==",
                    "4.2.0"
                ]
            ]
        },
        {
            "name": "pluggy",
            "specs": [
                [
                    "==",
                    "1.4.0"
                ]
            ]
        },
        {
            "name": "pyproject_hooks",
            "specs": [
                [
                    "==",
                    "1.0.0"
                ]
            ]
        },
        {
            "name": "PySide6",
            "specs": [
                [
                    "==",
                    "6.6.2"
                ]
            ]
        },
        {
            "name": "PySide6_Addons",
            "specs": [
                [
                    "==",
                    "6.6.2"
                ]
            ]
        },
        {
            "name": "PySide6_Essentials",
            "specs": [
                [
                    "==",
                    "6.6.2"
                ]
            ]
        },
        {
            "name": "pytest",
            "specs": [
                [
                    "==",
                    "8.1.1"
                ]
            ]
        },
        {
            "name": "pytest-cov",
            "specs": [
                [
                    "==",
                    "5.0.0"
                ]
            ]
        },
        {
            "name": "shiboken6",
            "specs": [
                [
                    "==",
                    "6.6.2"
                ]
            ]
        },
        {
            "name": "types-docopt",
            "specs": [
                [
                    "==",
                    "0.6.11.4"
                ]
            ]
        },
        {
            "name": "typing_extensions",
            "specs": [
                [
                    "==",
                    "4.10.0"
                ]
            ]
        }
    ],
    "lcname": "pyside6-qml-stubgen"
}
        
Elapsed time: 0.21638s