Metadata-Version: 2.1
Name: qtrio
Version: 0.4.1
Summary: a library bringing Qt GUIs together with ``async`` and ``await`` via Trio
Home-page: https://github.com/altendky/qtrio
Author: Kyle Altendorf
Author-email: sda@fstab.net
License: MIT -or- Apache License 2.0
Project-URL: Documentation, https://qtrio.readthedocs.io/
Project-URL: Chat, https://gitter.im/python-trio/general
Project-URL: Forum, https://trio.discourse.group/
Project-URL: Issues, https://github.com/altendky/qtrio/issues
Project-URL: Repository, https://github.com/altendky/qtrio
Project-URL: Tests, https://github.com/altendky/qtrio/actions?query=branch%3Amaster
Project-URL: Coverage, https://codecov.io/gh/altendky/qtrio
Project-URL: Distribution, https://pypi.org/project/qtrio
Keywords: async,io,Trio,GUI,Qt,PyQt5,PySide2
Platform: UNKNOWN
Classifier: License :: OSI Approved :: MIT License
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Framework :: Trio
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Operating System :: Microsoft :: Windows
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: User Interfaces
Requires-Python: >=3.6
Requires-Dist: async-generator
Requires-Dist: attrs
Requires-Dist: decorator
Requires-Dist: outcome
Requires-Dist: qtpy
Requires-Dist: trio (>=0.16)
Requires-Dist: typing-extensions ; python_version < "3.8"
Provides-Extra: cli
Requires-Dist: click (~=7.0) ; extra == 'cli'
Provides-Extra: examples
Requires-Dist: click (~=7.0) ; extra == 'examples'
Requires-Dist: httpcore (~=0.12.0) ; extra == 'examples'
Requires-Dist: httpx (~=0.16.0) ; extra == 'examples'
Requires-Dist: hyperlink (~=20.0.0) ; extra == 'examples'
Provides-Extra: p_checks
Requires-Dist: black (==20.8b1) ; extra == 'p_checks'
Requires-Dist: check-manifest (~=0.46.0) ; extra == 'p_checks'
Requires-Dist: flake8 (~=3.8) ; extra == 'p_checks'
Requires-Dist: mypy (==0.790) ; extra == 'p_checks'
Requires-Dist: pytest (~=6.2) ; extra == 'p_checks'
Requires-Dist: quart-trio (~=0.7.0) ; extra == 'p_checks'
Requires-Dist: towncrier (>=19.9.0rc1) ; extra == 'p_checks'
Requires-Dist: click (~=7.0) ; extra == 'p_checks'
Requires-Dist: httpcore (~=0.12.0) ; extra == 'p_checks'
Requires-Dist: httpx (~=0.16.0) ; extra == 'p_checks'
Requires-Dist: hyperlink (~=20.0.0) ; extra == 'p_checks'
Provides-Extra: p_docs
Requires-Dist: sphinx (!=3.4.0,!=3.4.1,>=3.2.1) ; extra == 'p_docs'
Requires-Dist: sphinx-autodoc-typehints (~=1.11) ; extra == 'p_docs'
Requires-Dist: sphinx-qt-documentation (~=0.3.0) ; extra == 'p_docs'
Requires-Dist: sphinx-rtd-theme (~=0.5.0) ; extra == 'p_docs'
Requires-Dist: sphinxcontrib-trio (~=1.1) ; extra == 'p_docs'
Requires-Dist: towncrier (>=19.9.0rc1) ; extra == 'p_docs'
Provides-Extra: p_tests
Requires-Dist: click (~=7.0) ; extra == 'p_tests'
Requires-Dist: httpcore (~=0.12.0) ; extra == 'p_tests'
Requires-Dist: httpx (~=0.16.0) ; extra == 'p_tests'
Requires-Dist: hyperlink (~=20.0.0) ; extra == 'p_tests'
Requires-Dist: coverage (~=5.3) ; extra == 'p_tests'
Requires-Dist: pytest (~=6.0) ; extra == 'p_tests'
Requires-Dist: pytest-cov (~=2.10) ; extra == 'p_tests'
Requires-Dist: pytest-faulthandler (~=2.0) ; extra == 'p_tests'
Requires-Dist: pytest-qt (~=3.3) ; extra == 'p_tests'
Requires-Dist: pytest-trio (>=0.7.0) ; extra == 'p_tests'
Requires-Dist: pytest-xdist[psutil] (~=2.2) ; extra == 'p_tests'
Requires-Dist: quart-trio ; (python_version >= "3.7") and extra == 'p_tests'
Requires-Dist: pytest-xvfb (~=2.0) ; (sys_platform == "linux") and extra == 'p_tests'
Provides-Extra: pyqt5
Requires-Dist: pyqt5 (~=5.15.1) ; extra == 'pyqt5'
Requires-Dist: pyqt5-stubs (==5.14.2.2) ; extra == 'pyqt5'
Provides-Extra: pyside2
Requires-Dist: pyside2 (!=5.15.2,~=5.15) ; extra == 'pyside2'
Provides-Extra: s_pytest
Requires-Dist: pytest (~=6.0) ; extra == 's_pytest'
Provides-Extra: s_pytest_trio
Requires-Dist: pytest-trio (>=0.7.0) ; extra == 's_pytest_trio'
Provides-Extra: s_quart_trio
Requires-Dist: quart-trio ; (python_version >= "3.7") and extra == 's_quart_trio'
Provides-Extra: s_towncrier
Requires-Dist: towncrier (>=19.9.0rc1) ; extra == 's_towncrier'
Provides-Extra: testing
Requires-Dist: pytest-trio (>=0.7.0) ; extra == 'testing'

QTrio - a library bringing Qt GUIs together with ``async`` and ``await`` via Trio
=================================================================================

Resources
---------

=================================  =================================  =============================

`Documentation <documentation_>`_  `Read the Docs <documentation_>`_  |documentation badge|
`Chat <chat_>`_                    `Gitter <chat_>`_                  |chat badge|
`Forum <forum_>`_                  `Discourse <forum_>`_              |forum badge|
`Issues <issues_>`_                `GitHub <issues_>`_                |issues badge|

`Repository <repository_>`_        `GitHub <repository_>`_            |repository badge|
`Tests <tests_>`_                  `GitHub Actions <tests_>`_         |tests badge|
`Coverage <coverage_>`_            `Codecov <coverage_>`_             |coverage badge|

`Distribution <distribution_>`_    `PyPI <distribution_>`_            | |version badge|
                                                                      | |python versions badge|
                                                                      | |python interpreters badge|

=================================  =================================  =============================


Introduction
------------

Note:
    This library is in early development.  It works.  It has tests.  It has
    documentation.  Expect breaking changes as we explore a clean API.  By paying this
    price you get the privilege to provide feedback via
    `GitHub issues <https://github.com/altendky/qtrio/issues>`__ to help shape our
    future.  ``:]``

The QTrio project's goal is to bring the friendly concurrency of Trio using Python's
``async`` and ``await`` syntax together with the GUI features of Qt to enable more
correct code and a more pleasant developer experience.  QTrio is `permissively licensed
<https://github.com/altendky/qtrio/blob/master/LICENSE>`__ to avoid introducing
restrictions beyond those of the underlying Python Qt library you choose.  Both PySide2
and PyQt5 are supported.

By enabling use of ``async`` and ``await`` it is possible in some cases to write related
code more concisely and clearly than you would get with the signal and slot mechanisms
of Qt concurrency.  See the ``README`` examples in the docs for the full code.  The
first example here shows classic pure Qt code.

.. code-block:: python

    class Main:
        def __init__(
            self,
            input_dialog: typing.Optional[QtWidgets.QInputDialog] = None,
            output_dialog: typing.Optional[QtWidgets.QMessageBox] = None,
        ):
            if input_dialog is None:  # pragma: nocover
                input_dialog = create_input()

            if output_dialog is None:  # pragma: nocover
                output_dialog = create_output()

            self.input_dialog = input_dialog
            self.output_dialog = output_dialog

        def setup(self) -> None:
            self.input_dialog.accepted.connect(self.input_accepted)
            self.input_dialog.rejected.connect(self.input_rejected)

            self.input_dialog.show()

        def input_accepted(self) -> None:
            name = self.input_dialog.textValue()

            self.output_dialog.setText(f"Hi {name}, welcome to the team!")

            self.output_dialog.finished.connect(self.output_finished)
            self.output_dialog.show()

        def input_rejected(self) -> None:
            QtCore.QCoreApplication.instance().quit()

        def output_finished(self) -> None:
            QtCore.QCoreApplication.instance().quit()

The second example, below, shows how using ``async`` and ``await`` allows for a
more concise and clear description of the sequenced activity.

.. code-block:: python

    async def main(
        input_dialog: typing.Optional[qtrio.dialogs.TextInputDialog] = None,
        output_dialog: typing.Optional[qtrio.dialogs.MessageBox] = None,
    ) -> None:
        if input_dialog is None:  # pragma: nocover
            input_dialog = create_input()

        if output_dialog is None:  # pragma: nocover
            output_dialog = create_output()

        with contextlib.suppress(qtrio.UserCancelledError):
            name = await input_dialog.wait()

            output_dialog.text = f"Hi {name}, welcome to the team!"

            await output_dialog.wait()

.. _chat: https://gitter.im/python-trio/general
.. |chat badge| image:: https://img.shields.io/badge/chat-join%20now-blue.svg?color=royalblue&logo=Gitter&logoColor=whitesmoke
   :target: `chat`_
   :alt: Support chatroom

.. _forum: https://trio.discourse.group
.. |forum badge| image:: https://img.shields.io/badge/forum-join%20now-blue.svg?color=royalblue&logo=Discourse&logoColor=whitesmoke
   :target: `forum`_
   :alt: Support forum

.. _documentation: https://qtrio.readthedocs.io
.. |documentation badge| image:: https://img.shields.io/badge/docs-read%20now-blue.svg?color=royalblue&logo=Read-the-Docs&logoColor=whitesmoke
   :target: `documentation`_
   :alt: Documentation

.. _distribution: https://pypi.org/project/qtrio
.. |version badge| image:: https://img.shields.io/pypi/v/qtrio.svg?color=indianred&logo=PyPI&logoColor=whitesmoke
   :target: `distribution`_
   :alt: Latest distribution version

.. |python versions badge| image:: https://img.shields.io/pypi/pyversions/qtrio.svg?color=indianred&logo=PyPI&logoColor=whitesmoke
   :alt: Supported Python versions
   :target: `distribution`_

.. |python interpreters badge| image:: https://img.shields.io/pypi/implementation/qtrio.svg?color=indianred&logo=PyPI&logoColor=whitesmoke
   :alt: Supported Python interpreters
   :target: `distribution`_

.. _issues: https://github.com/altendky/qtrio/issues
.. |issues badge| image:: https://img.shields.io/github/issues/altendky/qtrio?color=royalblue&logo=GitHub&logoColor=whitesmoke
   :target: `issues`_
   :alt: Issues

.. _repository: https://github.com/altendky/qtrio
.. |repository badge| image:: https://img.shields.io/github/last-commit/altendky/qtrio.svg?color=seagreen&logo=GitHub&logoColor=whitesmoke
   :target: `repository`_
   :alt: Repository

.. _tests: https://github.com/altendky/qtrio/actions?query=branch%3Amaster
.. |tests badge| image:: https://img.shields.io/github/workflow/status/altendky/qtrio/CI/master?color=seagreen&logo=GitHub-Actions&logoColor=whitesmoke
   :target: `tests`_
   :alt: Tests

.. _coverage: https://codecov.io/gh/altendky/qtrio
.. |coverage badge| image:: https://img.shields.io/codecov/c/github/altendky/qtrio/master?color=seagreen&logo=Codecov&logoColor=whitesmoke
   :target: `coverage`_
   :alt: Test coverage


