Metadata-Version: 2.1
Name: qtrio
Version: 0.1.0
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
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 :: 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: outcome
Requires-Dist: pytest
Requires-Dist: qtpy
Requires-Dist: trio (>=0.16)
Provides-Extra: checks
Requires-Dist: black ; extra == 'checks'
Requires-Dist: flake8 ; extra == 'checks'
Requires-Dist: mypy ; extra == 'checks'
Requires-Dist: towncrier (>=19.9.0rc1) ; extra == 'checks'
Provides-Extra: docs
Requires-Dist: sphinx (>=1.7.0) ; extra == 'docs'
Requires-Dist: sphinx-autodoc-typehints ; extra == 'docs'
Requires-Dist: sphinx-qt-documentation ; extra == 'docs'
Requires-Dist: sphinx-rtd-theme ; extra == 'docs'
Requires-Dist: sphinxcontrib-trio ; extra == 'docs'
Provides-Extra: examples
Requires-Dist: click ; extra == 'examples'
Provides-Extra: pyqt5
Requires-Dist: pyqt5 ; extra == 'pyqt5'
Requires-Dist: pyqt5-stubs ; extra == 'pyqt5'
Provides-Extra: pyside2
Requires-Dist: pyside2 ; extra == 'pyside2'
Provides-Extra: tests
Requires-Dist: click ; extra == 'tests'
Requires-Dist: coverage ; extra == 'tests'
Requires-Dist: pytest ; extra == 'tests'
Requires-Dist: pytest-cov ; extra == 'tests'
Requires-Dist: pytest-faulthandler ; extra == 'tests'
Requires-Dist: pytest-qt ; extra == 'tests'
Requires-Dist: pytest-xvfb ; (sys_platform == "linux") and extra == 'tests'

.. image:: https://img.shields.io/badge/chat-join%20now-blue.svg
   :target: https://gitter.im/python-trio/general
   :alt: Join chatroom

.. image:: https://img.shields.io/badge/forum-join%20now-blue.svg
   :target: https://trio.discourse.group
   :alt: Join forum

.. image:: https://img.shields.io/badge/docs-read%20now-blue.svg
   :target: https://qtrio.readthedocs.io
   :alt: Documentation

.. image:: https://img.shields.io/pypi/v/qtrio.svg
   :target: https://pypi.org/project/qtrio
   :alt: Latest PyPi version

.. image:: https://img.shields.io/github/last-commit/altendky/qtrio.svg
   :target: https://github.com/altendky/qtrio
   :alt: Repository

.. image:: https://codecov.io/gh/altendky/qtrio/branch/master/graph/badge.svg
   :target: https://codecov.io/gh/altendky/qtrio
   :alt: Test coverage


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

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.

.. code-block:: python

    class TwoStep:
        def __init__(self, a_signal, some_path):
            self.signal = a_signal
            self.file = None
            self.some_path = some_path

        def before(self):
            self.file = open(some_path, 'w')
            self.signal.connect(self.after)
            self.file.write('before')

        def after(self, value):
            self.signal.disconnect(self.after)
            self.file.write(f'after {value!r}')
            self.file.close()

.. code-block:: python

    async def together(a_signal):
        with open(self.some_path, 'w') as file:
            async with qtrio.enter_emissions_channel(signals=[a_signal]) as emissions:
                file.write('before')
                emission = await emissions.channel.receive()
                [value] = emission.args
                file.write(f'after {value!r}')

Note how by using ``async`` and ``await`` we are not only able to more clearly and
concisely describe the sequenced activity, we also get to use ``with`` to manage the
context of the open file to be sure it gets closed.


