<commit_before>guv Documentation
=================

.. note::

    The documentation is currently in very active developemnt and not yet
    complete. Please keep checking back for updates and filing issues for
    missing sections or suggestions for enhancement.


Contents
--------

.. toctree::
    :maxdepth: 2
    :titlesonly:

    How does guv work? <howitworks>
    librarysupport
    modules


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

guv is a fast networking library and WSGI server (like gevent/eventlet) for
Python >= 3.2 and pypy3

The event loop backend is ``pyuv_cffi``, which aims to be fully compatible with
the ``pyuv`` interface. ``pyuv_cffi`` is fully supported on CPython and pypy3.
``libuv`` >= 1.0.0 is required.

Asynchronous DNS queries are supported via dnspython3. To forcefully disable
greendns, set the environment variable ``GUV_NO_GREENDNS`` to any value.

guv currently only runs on POSIX-compliant operating systems, but Windows
support is not far off and can be added in the near future if there is a demand
for this.

This library is actively maintained and has a zero bug policy. Please submit
issues and pull requests, and bugs will be fixed immediately.

**This project is under active development and any help is appreciated.**


Quickstart
----------

The following examples serve the sample WSGI app found in the ``examples``
directory.

**Serve your WSGI app using guv directly**:

.. code-block:: python

    if __name__ == '__main__':
        server_sock = guv.listen(('0.0.0.0', 8001))
        guv.wsgi.serve(server_sock, app)

**Serve your WSGI app using guv with gunicorn**::

    gunicorn -w 4 -b 127.0.0.1:8001 -k guv.GuvWorker wsgi_app:app


Guarantees
----------

This library makes the following guarantees:
<commit_msg>Add client example to homepage<commit_after>guv Documentation
=================

.. note::

    The documentation is currently in very active developemnt and not yet
    complete. Please keep checking back for updates and filing issues for
    missing sections or suggestions for enhancement.


Contents
--------

.. toctree::
    :maxdepth: 2
    :titlesonly:

    How does guv work? <howitworks>
    librarysupport
    modules


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

guv is a fast networking library and WSGI server (like gevent/eventlet) for
Python >= 3.2 and pypy3

The event loop backend is ``pyuv_cffi``, which aims to be fully compatible with
the ``pyuv`` interface. ``pyuv_cffi`` is fully supported on CPython and pypy3.
``libuv`` >= 1.0.0 is required.

Asynchronous DNS queries are supported via dnspython3. To forcefully disable
greendns, set the environment variable ``GUV_NO_GREENDNS`` to any value.

guv currently only runs on POSIX-compliant operating systems, but Windows
support is not far off and can be added in the near future if there is a demand
for this.

This library is actively maintained and has a zero bug policy. Please submit
issues and pull requests, and bugs will be fixed immediately.

**This project is under active development and any help is appreciated.**


Quickstart
----------

**Serve your WSGI app using guv directly**:

.. code-block:: python

    app = <your WSGI app>

    if __name__ == '__main__':
        server_sock = guv.listen(('0.0.0.0', 8001))
        guv.wsgi.serve(server_sock, app)

**Serve your WSGI app using guv with gunicorn**::

    gunicorn -w 4 -b 127.0.0.1:8001 -k guv.GuvWorker wsgi_app:app

**Crawl the web: efficiently make multiple "simultaneous" requests**:

.. code-block:: python

    import guv
    guv.monkey_patch()

    import requests


    def get_url(url):
        print('get_url({})'.format(url))
        return requests.get(url)


    def main():
        urls = ['http://gnu.org'] * 10
        urls += ['https://eff.org'] * 10

        pool = guv.GreenPool()
        results = pool.starmap(get_url, zip(urls))

        for i, resp in enumerate(results):
            print('{}: done, length: {}'.format(i, len(resp.text)))


    if __name__ == '__main__':
        main()


Guarantees
----------

This library makes the following guarantees:

{'fraction_non_alphanumeric': 0.11094710947109471, 'fraction_numerical': 0.014760147601476014, 'mean_word_length': 3.1788283658787257, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 10, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6499918', 'n_tokens_mistral': 1275, 'n_tokens_neox': 1186, 'n_words': 492}