Metadata-Version: 2.1
Name: resumeback
Version: 1.0.0
Summary: Library for using callbacks to resume your code.
Home-page: http://fichtefoll.github.io/resumeback/
License: MIT
Author: FichteFoll
Author-email: fichtefoll2@googlemail.com
Requires-Python: >=3.5,<4.0
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Provides-Extra: docs
Provides-Extra: flake8
Provides-Extra: test
Requires-Dist: flake8 (>=3.7.9,<4.0.0); extra == "flake8"
Requires-Dist: pytest (>=5.4.1,<6.0.0); extra == "test"
Requires-Dist: pytest-cov (>=2.8.1,<3.0.0); extra == "test"
Requires-Dist: sphinx (>=2.4.4,<3.0.0); extra == "docs"
Requires-Dist: sphinx-readable-theme (>=1.3.0,<2.0.0); extra == "docs"
Project-URL: Repository, https://github.com/FichteFoll/resumeback
Description-Content-Type: text/x-rst

============
 resumeback
============

.. image:: https://github.com/FichteFoll/resumeback/workflows/CI/badge.svg
   :target: https://github.com/FichteFoll/resumeback/actions?query=workflow%3ACI+branch%3Amaster

.. image:: https://coveralls.io/repos/FichteFoll/resumeback/badge.svg
   :target: https://coveralls.io/github/FichteFoll/resumeback?branch=master

.. image:: https://img.shields.io/pypi/v/resumeback.svg
    :target: https://pypi.python.org/pypi/resumeback

.. image:: https://img.shields.io/pypi/pyversions/resumeback.svg
    :target: https://pypi.python.org/pypi/resumeback/

.. .. image:: https://img.shields.io/pypi/dd/resumeback.svg
..     :target: https://pypi.python.org/pypi/resumeback/

A Python library for using callbacks to resume your code.

``resumeback`` provides a utility function decorator
that enables using callback-based interfaces
in **a single line of execution**
-- a single function.

Documentation
=============

https://fichtefoll.github.io/resumeback/


Installation
============

.. code-block:: shell

    $ pip install resumeback


Example Usage
=============

.. code-block:: python

    from threading import Thread
    from resumeback import send_self

    def ask_for_user_input(question, on_done):
        def watcher():
            result = input(question)
            on_done(result)

        Thread(target=watcher).start()

    @send_self
    def main(this):  # "this" is a reference to the created generator instance
        arbitrary_value = 10

        # Yield pauses execution until one of the generator methods is called,
        # such as `.send`, which we provide as the callback parameter.
        number = yield ask_for_user_input("Please enter a number", this.send)
        number = int(number)
        print("Result:", number * arbitrary_value)

    if __name__ == "__main__":
        main()


Development
===========

Requires Python, poetry, and GNU Make.

Use ``make help`` to show the available targets.

- poetry__ is used for dependency and virtualenv management.
- tox__ is used as a test runner for multiple isolated environments.
- flake8__ is used for code linting.
- `Github Actions`__ are used for CI.

__ https://python-poetry.org/
__ https://tox.readthedocs.io/
__ https://flake8.readthedocs.io/
__ https://github.com/features/actions


Acknowledgements
================

Project started initially after a `forum post`__ from `@Varriount`__
on the Sublime Text forum.
I just took his idea "to the next (abstraction) level"
and made it more convenient to use.

__ https://forum.sublimetext.com/t/using-generators-for-fun-and-profit-utility-for-developers/14618
__ https://github.com/Varriount

