pulsar

Event driven concurrent framework for Python

https://github.com/quantmind/pulsar

Science Score: 10.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    1 of 27 committers (3.7%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.1%) to scientific vocabulary

Keywords

asyncio greenlet http http-server multiprocessing python rpc test-framework wsgi

Keywords from Contributors

pallets werkzeug
Last synced: 6 months ago · JSON representation

Repository

Event driven concurrent framework for Python

Basic Info
  • Host: GitHub
  • Owner: quantmind
  • License: bsd-3-clause
  • Language: Python
  • Default Branch: master
  • Homepage:
  • Size: 45.4 MB
Statistics
  • Stars: 1,857
  • Watchers: 91
  • Forks: 159
  • Open Issues: 29
  • Releases: 0
Archived
Topics
asyncio greenlet http http-server multiprocessing python rpc test-framework wsgi
Created about 15 years ago · Last pushed about 6 years ago
Metadata Files
Readme License

README.rst

.. image:: https://fluidily-public.s3.amazonaws.com/pulsar/images/pulsar-banner-600.svg
   :alt: Pulsar
   :width: 300

|
|

:Badges: |license|  |pyversions| |status| |pypiversion| |contributors|
:CI: |circleci| |coverage| |appveyor| |travis| |docs|
:Documentation: https://docs.pulsarweb.org
:Downloads: http://pypi.python.org/pypi/pulsar
:Source: https://github.com/quantmind/pulsar
:Benchmarks: https://bench.pulsarweb.org/
:Chat channel: `Riot.im room`_
:Mailing list: `google user group`_
:Stack overflow: questions tagged python-pulsar_
:Design by: `Quantmind`_ and `Luca Sbardella`_
:Platforms: Linux, OSX, Windows. Python 3.5 and above
:Keywords: python, asyncio, multiprocessing, client/server, asynchronous, concurrency, actor, thread, process, socket, wsgi, websocket, redis, json-rpc

.. |pypiversion| image:: https://img.shields.io/pypi/v/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
.. |appveyor| image:: https://ci.appveyor.com/api/projects/status/w2ip01j07qm161ei?svg=true
    :target: https://ci.appveyor.com/project/lsbardel/pulsar
.. |contributors| image:: https://img.shields.io/github/contributors/quantmind/pulsar.svg
    :target: https://github.com/quantmind/pulsar/graphs/contributors
.. |circleci| image:: https://circleci.com/gh/quantmind/pulsar.svg?style=svg
    :target: https://circleci.com/gh/quantmind/pulsar
.. |coverage| image:: https://codecov.io/gh/quantmind/pulsar/branch/master/graph/badge.svg
  :target: https://codecov.io/gh/quantmind/pulsar
.. |travis| image:: https://api.travis-ci.org/quantmind/pulsar.svg?branch=release
  :target: https://travis-ci.org/quantmind/pulsar
.. |docs| image:: https://media.readthedocs.org/static/projects/badges/passing.svg
  :target: https://docs.pulsarweb.org

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_ module 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 one **hard dependency**:

* multidict_

install via pip::

    pip install pulsar

or download the tarball from pypi_.

To speedup pulsar by a factor of 2 or more these **soft dependencies** are recommended

* httptools_
* uvloop_

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
* `Asynchronous WSGI server`_
* HttpClient_
* JSON-RPC_
* `Web Sockets`_
* `Asynchronous Test suite`_
* `Data stores`_ (with async Redis client)
* `Task queue consumers`_
* `Asynchronous botocore`_
* `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.
* The `dining philosophers problem `_.
* `Twitter streaming `_


Design
=============
Pulsar internals are based on `actors primitive`_. ``Actors`` are the *atoms*
of pulsar's concurrent computation, they do not share state between them,
communication is achieved via asynchronous inter-process message passing,
implemented using the standard python socket library.

Two special classes of actors are the ``Arbiter``, used as a singleton_,
and the ``Monitor``, a manager of several actors performing similar functions.
The Arbiter runs the main eventloop and it controls the life of all actors.
Monitors manage group of actors performing similar functions, You can think
of them as a pool of actors.

.. image:: https://fluidily-public.s3.amazonaws.com/pulsar/images/actors.png
   :alt: Pulsar Actors

More information about design and philosophy in the documentation.


Add-ons
=========
Pulsar checks if some additional libraries are available at runtime, and
uses them to add additional functionalities or improve performance:

* greenlet_: required by the `pulsar.apps.greenio`_ module and useful for
  developing implicit asynchronous applications
* uvloop_: if available it is possible to use it as the default event loop
  for actors by passing ``--io uv`` in the command line (or ``event_loop="uv"``
  in the config file)
* httptools_: if available, the default Http Parser for both client and server
  is replaced by the C implementation in this package
* setproctitle_: if installed, pulsar can use it to change the processes names
  of the running application
* psutil_: if installed, a ``system`` key is available in the dictionary
  returned by Actor info method
* python-certifi_: The HttpClient_ will attempt to use certificates from
  certifi if it is present on the system
* ujson_: if installed it is used instead of the native ``json`` module
* unidecode_: to enhance the ``slugify`` function


Running Tests
==================
Pulsar test suite uses the pulsar test application. To run tests::

    python setup.py test

For options and help type::

    python setup.py test --help

flake8_ check (requires flake8 package)::

    flake8


.. _contributing:

Contributing
=================
Development of pulsar_ happens at Github. We very much welcome your contribution
of course. To do so, simply follow these guidelines:

* Fork pulsar_ on github
* Create a topic branch ``git checkout -b my_branch``
* Push to your branch ``git push origin my_branch``
* Create an issue at https://github.com/quantmind/pulsar/issues with
  pull request for the **dev branch**.
* Alternatively, if you need to report a bug or an unexpected behaviour, make sure
  to include a mcve_ in your issue.

A good ``pull`` request should:

* Cover one bug fix or new feature only
* Include tests to cover the new code (inside the ``tests`` directory)
* Preferably have one commit only (you can use rebase_ to combine several
  commits into one)
* Make sure ``flake8`` tests pass

.. _license:

License
=============
This software is licensed under the BSD_ 3-clause License. See the LICENSE
file in the top distribution directory for the full license text.

.. _asyncio: https://docs.python.org/3/library/asyncio.html
.. _multiprocessing: http://docs.python.org/library/multiprocessing.html
.. _`actors primitive`: http://en.wikipedia.org/wiki/Actor_model
.. _setproctitle: http://code.google.com/p/py-setproctitle/
.. _psutil: https://github.com/giampaolo/psutil
.. _pypi: http://pypi.python.org/pypi/pulsar
.. _BSD: http://opensource.org/licenses/BSD-3-Clause
.. _pulsar: https://github.com/quantmind/pulsar
.. _singleton: http://en.wikipedia.org/wiki/Singleton_pattern
.. _cython: http://cython.org/
.. _`google user group`: https://groups.google.com/forum/?fromgroups#!forum/python-pulsar
.. _flake8: https://pypi.python.org/pypi/flake8
.. _ujson: https://pypi.python.org/pypi/ujson
.. _rebase: https://help.github.com/articles/about-git-rebase
.. _unidecode: https://pypi.python.org/pypi/Unidecode
.. _`Luca Sbardella`: http://lucasbardella.com
.. _`Quantmind`: http://quantmind.com
.. _JSON-RPC: http://www.jsonrpc.org/
.. _mcve: http://stackoverflow.com/help/mcve
.. _python-certifi: https://certifi.io
.. _greenlet: http://greenlet.readthedocs.io/
.. _`pulsar.apps.greenio`: https://github.com/quantmind/pulsar/tree/master/pulsar/apps/greenio
.. _`pulsar.apps.pulse`: https://github.com/quantmind/pulsar/tree/master/pulsar/apps/pulse
.. _HttpClient: http://quantmind.github.io/pulsar/apps/http.html
.. _`Data stores`: http://quantmind.github.io/pulsar/apps/data/index.html
.. _`Task queue consumers`: https://github.com/quantmind/pulsar-queue
.. _`Asynchronous botocore`: https://github.com/quantmind/pulsar-cloud
.. _`django integration`: https://github.com/quantmind/pulsar-django
.. _`python-pulsar`: http://stackoverflow.com/questions/tagged/python-pulsar
.. _`Web Sockets`: http://quantmind.github.io/pulsar/apps/websockets.html
.. _uvloop: https://github.com/MagicStack/uvloop
.. _httptools: https://github.com/MagicStack/httptools
.. _multidict: https://github.com/aio-libs/multidict
.. _`Asynchronous WSGI server`: http://quantmind.github.io/pulsar/apps/wsgi/index.html
.. _`Asynchronous Test suite`: http://quantmind.github.io/pulsar/apps/test.html
.. _`Riot.im room`: https://riot.im/app/#/room/#pulsar:matrix.org

Owner

  • Name: Quantmind
  • Login: quantmind
  • Kind: organization
  • Email: info@quantmind.com
  • Location: London UK

Quantitative data analysis - Quantitative Finance - Visualizations - Web application development

GitHub Events

Total
  • Watch event: 5
  • Fork event: 1
Last Year
  • Watch event: 5
  • Fork event: 1

Committers

Last synced: over 2 years ago

All Time
  • Total Commits: 2,286
  • Total Committers: 27
  • Avg Commits per committer: 84.667
  • Development Distribution Score (DDS): 0.612
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Luca Sbardella l****a@g****m 887
quantmind l****a@c****m 690
Luca Sbardella l****a@q****m 663
jurasource l****e@j****k 6
Ryan.K r****g@i****g 6
Mathieu Sornay m****y@e****r 3
artemmus a****s@y****m 3
Dominik Wild d****d@g****m 2
Rob Gil r****b@r****m 2
felippemr r****e@g****m 2
Paul van der Linden m****l@p****g 2
Remco Veldkamp r****r@g****m 2
Adam Vollrath a****m@e****m 2
Stanislav Sokolko s****o@g****m 2
Evgeny Tataurov t****f@g****m 2
BrightPan b****n@1****m 1
David J. Felix f****j@g****m 1
David Keijser k****r@g****m 1
Even Wiik Thomassen e****h@g****m 1
Fabio Cerqueira f****o@c****e 1
lsbardel l****l@u****) 1
Michael Bikovitsky m****o@g****m 1
Sebastian Krause s****n@r****g 1
unknown l****6@.****t 1
Johan Charpentier c****j@a****g 1
dhutty d****y@a****g 1
Pastafarianist m****t@g****m 1

Issues and Pull Requests

Last synced: 9 months ago

All Time
  • Total issues: 72
  • Total pull requests: 28
  • Average time to close issues: 4 months
  • Average time to close pull requests: 21 days
  • Total issue authors: 30
  • Total pull request authors: 6
  • Average comments per issue: 1.1
  • Average comments per pull request: 1.79
  • Merged pull requests: 19
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • lsbardel (39)
  • scailer (2)
  • carn1x (2)
  • DavHau (2)
  • robgil (2)
  • jruere (1)
  • vit1251 (1)
  • bright-pan (1)
  • RyanKung (1)
  • mLewisLogic (1)
  • erikash (1)
  • msornay (1)
  • jkbbwr (1)
  • beattidp (1)
  • wojpie (1)
Pull Request Authors
  • lsbardel (14)
  • RyanKung (5)
  • s-sokolko (4)
  • scailer (3)
  • fabiocerqueira (1)
  • wilddom (1)
Top Labels
Issue Labels
test (13) bug (12) enhancement (11) http (9) wontfix (7) discussion (6) core (6) design decision (6) question (5) benchmark (5) wsgi (4) stores (4) apps (3) maybe (3) redis (2) installation (2) tests required (2) new feature (2) example (2) need mcve (1) docs (1) django (1) documentation (1) rpc (1) design (1) windows (1) help wanted (1) devops (1) greenio (1) nice to have (1)
Pull Request Labels
invalid (1) http (1)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 1,948 last-month
  • Total dependent packages: 4
  • Total dependent repositories: 39
  • Total versions: 65
  • Total maintainers: 1
pypi.org: pulsar

Event driven concurrent framework for Python

  • Versions: 65
  • Dependent Packages: 4
  • Dependent Repositories: 39
  • Downloads: 1,948 Last month
Rankings
Stargazers count: 1.6%
Dependent packages count: 1.9%
Dependent repos count: 2.3%
Average: 2.9%
Forks count: 3.9%
Downloads: 5.0%
Maintainers (1)
Last synced: 6 months ago

Dependencies

requirements/ci.txt pypi
  • botocore *
  • docker *
  • httptools *
requirements/dev.txt pypi
  • psutil * development
  • pyslink * development
  • setproctitle * development
  • unidecode * development
requirements/docs.txt pypi
  • flask *
  • greenlet *
  • recommonmark *
requirements/hard.txt pypi
  • multidict *
requirements/test-docs.txt pypi
  • sphinxcontrib-spelling * test
requirements/test-posix.txt pypi
  • cython * test
  • httptools * test
  • uvloop * test
requirements/test-win.txt pypi
  • botocore * test
requirements/test.txt pypi
  • certifi * test
  • codecov * test
  • coverage * test
  • flake8 * test
  • flask * test
  • greenlet * test
  • oauthlib * test
  • requests * test
  • twine * test
  • unidecode * test