<commit_before>.. image:: https://pulsar.fluidily.com/assets/images/pulsar-banner.png
   :alt: Pulsar
   :width: 300


:Badges: |license|  |pyversions| |status| |pypiversion|
:Master CI: |master-build|_ |coverage-master|
:Dev CI: |dev-build|_ |coverage-dev|
:Documentation: http://pythonhosted.org/pulsar/
:Downloads: http://pypi.python.org/pypi/pulsar
:Source: https://github.com/quantmind/pulsar
:Mailing list: `google user group`_
:Design by: `Quantmind`_ and `<NAME>`_
:Platforms: Linux, OSX, Windows. Python 3.5 and above
:Keywords: client, server, asynchronous, concurrency, actor, thread, process,
    socket, wsgi, websocket, redis, json-rpc

.. |pypiversion| image:: https://badge.fury.io/py/pulsar.svg
    :target: https://pypi.python.org/pypi/pulsar
.. |pyversions| image:: https://img.shields.io/pypi/pyversions/pulsar.svg
  :target: https://pypi.python.org/pypi/pulsar
.. |license| image:: https://img.shields.io/pypi/l/pulsar.svg
  :target: https://pypi.python.org/pypi/pulsar
.. |status| image:: https://img.shields.io/pypi/status/pulsar.svg
  :target: https://pypi.python.org/pypi/pulsar
.. |downloads| image:: https://img.shields.io/pypi/dd/pulsar.svg
  :target: https://pypi.python.org/pypi/pulsar
.. |master-build| image:: https://travis-ci.org/quantmind/pulsar.svg?branch=master
.. _master-build: http://travis-ci.org/quantmind/pulsar
.. |dev-build| image:: https://travis-ci.org/quantmind/pulsar.svg?branch=dev
.. _dev-build: http://travis-ci.org/quantmind/pulsar
.. |coverage-master| image:: https://coveralls.io/repos/github/quantmind/pulsar/badge.svg?branch=master
  :target: https://coveralls.io/github/quantmind/pulsar?branch=master
.. |coverage-dev| image:: https://coveralls.io/repos/github/quantmind/pulsar/badge.svg?branch=dev
  :target: https://coveralls.io/github/quantmind/pulsar?branch=dev


An example of a web server written with ``pulsar`` which responds with
"Hello World!" for every request:

.. code:: python

    from pulsar.apps import wsgi

    def hello(environ, start_response):
        data = b'Hello World!\n'
        response_headers = [
            ('Content-type','text/plain'),
            ('Content-Length', str(len(data)))
        ]
        start_response('200 OK', response_headers)
        return [data]


    if __name__ == '__main__':
        wsgi.WSGIServer(callable=hello).start()


Pulsar's goal is to provide an easy way to build scalable network programs.
In the ``Hello world!`` web server example above, many client
connections can be handled concurrently.
Pulsar tells the operating system (through epoll or select) that it should be
notified when a new connection is made, and then it goes to sleep.

Pulsar uses the asyncio_ and multiprocessing_ modules from the standard python
library and it can be configured to run in multi-processing mode.

Another example of pulsar framework is the asynchronous HttpClient_:

.. code:: python

    from pulsar.apps import http

    async with http.HttpClient() as session:
        response1 = await session.get('https://github.com/timeline.json')
        response2 = await session.get('https://api.github.com/emojis.json')


The http client maintains connections alive (by default 15 seconds) and therefore
any requests that you make within a session will automatically reuse the
appropriate connection. All connections are released once the session exits the
asynchronous ``with`` block.

Installing
============

Pulsar has no hard dependencies, install via pip::

    pip install pulsar

or downloading the tarball from pypi_.

If cython_ is available, c extensions will be compiled and installed.


Applications
==============
Pulsar design allows for a host of different asynchronous applications
to be implemented in an elegant and efficient way.
Out of the box it is shipped with the the following:

* Socket servers
* WSGI server
* HTTP client
* JSON-RPC_
* Web Sockets
* Test suite
* Data stores
* django_ integration

.. _examples:

Examples
=============
Check out the ``examples`` directory for various working applications.
It includes:

* Hello world! wsgi example
* An Httpbin WSGI application
* An HTTP Proxy server
* A JSON-RPC Calculator server
* Websocket random graph.
* Websocket chat room.
* django_ web site with a websocket based chat room.
* The `dining philosophers problem <http://en.wikipedia.org/wiki/Dining_philosophers_problem>`_.
<commit_msg>no need for cython when installing<commit_after>.. image:: https://pulsar.fluidily.com/assets/images/pulsar-banner.png
   :alt: Pulsar
   :width: 300


:Badges: |license|  |pyversions| |status| |pypiversion|
:Master CI: |master-build|_ |coverage-master|
:Dev CI: |dev-build|_ |coverage-dev|
:Documentation: http://pythonhosted.org/pulsar/
:Downloads: http://pypi.python.org/pypi/pulsar
:Source: https://github.com/quantmind/pulsar
:Mailing list: `google user group`_
:Design by: `Quantmind`_ and `<NAME>`_
:Platforms: Linux, OSX, Windows. Python 3.5 and above
:Keywords: client, server, asynchronous, concurrency, actor, thread, process,
    socket, wsgi, websocket, redis, json-rpc

.. |pypiversion| image:: https://badge.fury.io/py/pulsar.svg
    :target: https://pypi.python.org/pypi/pulsar
.. |pyversions| image:: https://img.shields.io/pypi/pyversions/pulsar.svg
  :target: https://pypi.python.org/pypi/pulsar
.. |license| image:: https://img.shields.io/pypi/l/pulsar.svg
  :target: https://pypi.python.org/pypi/pulsar
.. |status| image:: https://img.shields.io/pypi/status/pulsar.svg
  :target: https://pypi.python.org/pypi/pulsar
.. |downloads| image:: https://img.shields.io/pypi/dd/pulsar.svg
  :target: https://pypi.python.org/pypi/pulsar
.. |master-build| image:: https://travis-ci.org/quantmind/pulsar.svg?branch=master
.. _master-build: http://travis-ci.org/quantmind/pulsar
.. |dev-build| image:: https://travis-ci.org/quantmind/pulsar.svg?branch=dev
.. _dev-build: http://travis-ci.org/quantmind/pulsar
.. |coverage-master| image:: https://coveralls.io/repos/github/quantmind/pulsar/badge.svg?branch=master
  :target: https://coveralls.io/github/quantmind/pulsar?branch=master
.. |coverage-dev| image:: https://coveralls.io/repos/github/quantmind/pulsar/badge.svg?branch=dev
  :target: https://coveralls.io/github/quantmind/pulsar?branch=dev


An example of a web server written with ``pulsar`` which responds with
"Hello World!" for every request:

.. code:: python

    from pulsar.apps import wsgi

    def hello(environ, start_response):
        data = b'Hello World!\n'
        response_headers = [
            ('Content-type','text/plain'),
            ('Content-Length', str(len(data)))
        ]
        start_response('200 OK', response_headers)
        return [data]


    if __name__ == '__main__':
        wsgi.WSGIServer(callable=hello).start()


Pulsar's goal is to provide an easy way to build scalable network programs.
In the ``Hello world!`` web server example above, many client
connections can be handled concurrently.
Pulsar tells the operating system (through epoll or select) that it should be
notified when a new connection is made, and then it goes to sleep.

Pulsar uses the asyncio_ and multiprocessing_ modules from the standard python
library and it can be configured to run in multi-processing mode.

Another example of pulsar framework is the asynchronous HttpClient_:

.. code:: python

    from pulsar.apps import http

    async with http.HttpClient() as session:
        response1 = await session.get('https://github.com/timeline.json')
        response2 = await session.get('https://api.github.com/emojis.json')


The http client maintains connections alive (by default 15 seconds) and therefore
any requests that you make within a session will automatically reuse the
appropriate connection. All connections are released once the session exits the
asynchronous ``with`` block.

Installing
============

Pulsar has no hard dependencies, install via pip::

    pip install pulsar

or download the tarball from pypi_.


Applications
==============
Pulsar design allows for a host of different asynchronous applications
to be implemented in an elegant and efficient way.
Out of the box it is shipped with the the following:

* Socket servers
* WSGI server
* HttpClient_
* JSON-RPC_
* Web Sockets
* Test suite
* Data stores
* django_ integration

.. _examples:

Examples
=============
Check out the ``examples`` directory for various working applications.
It includes:

* Hello world! wsgi example
* An Httpbin WSGI application
* An HTTP Proxy server
* A JSON-RPC Calculator server
* Websocket random graph.
* Websocket chat room.
* django_ web site with a websocket based chat room.
* The `dining philosophers problem <http://en.wikipedia.org/wiki/Dining_philosophers_problem>`_.

{'fraction_non_alphanumeric': 0.12630612010563785, 'fraction_numerical': 0.002755769893213917, 'mean_word_length': 4.117508813160987, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 40, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4568196', 'n_tokens_mistral': 2865, 'n_tokens_neox': 2698, 'n_words': 809}