taskhawk


Nametaskhawk JSON
Version 4.6.0 PyPI version JSON
download
home_pagehttps://github.com/cloudchacho/taskhawk-python
SummaryTaskhawk Python Library
upload_time2024-12-02 11:11:34
maintainerAniruddha Maru
docs_urlNone
authorAutomatic Labs
requires_python>=3.6
licenseApache Software License (Apache License 2.0)
keywords python taskhawk
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            Taskhawk Library for Python
===========================

.. image:: https://travis-ci.org/cloudchacho/taskhawk-python.svg?branch=master
    :target: https://travis-ci.org/cloudchacho/taskhawk-python

.. image:: https://coveralls.io/repos/github/cloudchacho/taskhawk-python/badge.svg?branch=master
    :target: https://coveralls.io/github/cloudchacho/taskhawk-python?branch=master

.. image:: https://img.shields.io/pypi/v/taskhawk.svg?style=flat-square
    :target: https://pypi.python.org/pypi/taskhawk

.. image:: https://img.shields.io/pypi/pyversions/taskhawk.svg?style=flat-square
    :target: https://pypi.python.org/pypi/taskhawk

.. image:: https://img.shields.io/pypi/implementation/taskhawk.svg?style=flat-square
    :target: https://pypi.python.org/pypi/taskhawk

.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
    :target: https://github.com/ambv/black

TaskHawk is a replacement for celery that works on AWS SQS/SNS and Google PubSub, while keeping things pretty simple and
straightforward. Any unbound function can be converted into a TaskHawk task.

Only Python 3.6+ is supported currently.

You can find the latest, most up to date, documentation at `Read the Docs`_.


Quick Start
-----------

First, install the library:

.. code:: sh

    $ pip install taskhawk

Next, set up a few configuration settings:

Common required settings:

.. code:: python

    TASKHAWK_QUEUE = "DEV-MYAPP"

When using AWS, additional required settings are:

.. code:: python

    AWS_ACCESS_KEY = <YOUR AWS KEY>
    AWS_ACCOUNT_ID = <YOUR AWS ACCOUNT ID>
    AWS_REGION = <YOUR AWS REGION>
    AWS_SECRET_KEY = <YOUR AWS SECRET KEY>

    TASKHAWK_CONSUMER_BACKEND = 'taskhawk.backends.aws.AWSSQSConsumerBackend'
    TASKHAWK_PUBLISHER_BACKEND = 'taskhawk.backends.aws.AWSSNSPublisherBackend'


In case of GCP, additional required settings are:

.. code:: python

    TASKHAWK_CONSUMER_BACKEND = 'taskhawk.backends.gcp.GooglePubSubConsumerBackend'
    TASKHAWK_PUBLISHER_BACKEND = 'taskhawk.backends.gcp.GooglePubSubPublisherBackend'


If running outside Google Cloud (e.g. locally), set ``GOOGLE_APPLICATION_CREDENTIALS``.

Within Google Cloud, these credentials and permissions are managed by Google using IAM.

If the Pub/Sub resources lie in a different project, set ``GOOGLE_CLOUD_PROJECT`` to the project id.

For Django projects, simple use `Django settings`_ to configure Taskhawk. For Flask projects, use `Flask config`_.
For other frameworks, you can either declare an environment variable called ``SETTINGS_MODULE`` that points to a
module where settings may be found, or manually configure using ``taskhawk.conf.settings.configure_with_object``.

Then, simply add the decorator ``taskhawk.task`` to your function:

.. code:: python

   @taskhawk.task
   def send_email(to: str, subject: str, from_email: str = None) -> None:
       # send email

And finally, dispatch your function asynchronously:

.. code:: python

    send_email.dispatch('example@email.com', 'Hello!', from_email='example@spammer.com')

Development
-----------

Getting Started
~~~~~~~~~~~~~~~
Assuming that you have Python, ``pyenv`` and ``pyenv-virtualenv`` installed, set up your
environment and install the required dependencies like this instead of
the ``pip install taskhawk`` defined above:

.. code:: sh

    $ git clone https://github.com/cloudchacho/taskhawk-python.git
    $ cd taskhawk-python
    $ pyenv virtualenv 3.7.7 taskhawk-python-3.7
    ...
    $ pyenv activate taskhawk-python-3.7
    $ pip install -r requirements/dev-3.7.txt

Running Tests
~~~~~~~~~~~~~
You can run tests in using ``make test``. By default,
it will run all of the unit and functional tests, but you can also specify your own
``py.test`` options.

.. code:: sh

    $ py.test
    $ py.test tests/test_consumer.py

Generating Documentation
~~~~~~~~~~~~~~~~~~~~~~~~
Sphinx is used for documentation. You can generate HTML locally with the
following:

.. code:: sh

    $ pip install -e .[dev]
    $ make docs


Getting Help
------------

We use GitHub issues for tracking bugs and feature requests.

* If it turns out that you may have found a bug, please `open an issue <https://github.com/cloudchacho/taskhawk-python/issues/new>`__

.. _Read the Docs: https://taskhawk.readthedocs.io/en/latest/
.. _Django settings: https://docs.djangoproject.com/en/2.0/topics/settings/
.. _Flask config: https://flask.palletsprojects.com/en/1.1.x/config/



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/cloudchacho/taskhawk-python",
    "name": "taskhawk",
    "maintainer": "Aniruddha Maru",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "aniruddhamaru@gmail.com",
    "keywords": "python taskhawk",
    "author": "Automatic Labs",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/49/d6/8ffa8e14cf96c7245f2842f0f7c50d662a6f98dde7402a22e532f65078f2/taskhawk-4.6.0.tar.gz",
    "platform": null,
    "description": "Taskhawk Library for Python\n===========================\n\n.. image:: https://travis-ci.org/cloudchacho/taskhawk-python.svg?branch=master\n    :target: https://travis-ci.org/cloudchacho/taskhawk-python\n\n.. image:: https://coveralls.io/repos/github/cloudchacho/taskhawk-python/badge.svg?branch=master\n    :target: https://coveralls.io/github/cloudchacho/taskhawk-python?branch=master\n\n.. image:: https://img.shields.io/pypi/v/taskhawk.svg?style=flat-square\n    :target: https://pypi.python.org/pypi/taskhawk\n\n.. image:: https://img.shields.io/pypi/pyversions/taskhawk.svg?style=flat-square\n    :target: https://pypi.python.org/pypi/taskhawk\n\n.. image:: https://img.shields.io/pypi/implementation/taskhawk.svg?style=flat-square\n    :target: https://pypi.python.org/pypi/taskhawk\n\n.. image:: https://img.shields.io/badge/code%20style-black-000000.svg\n    :target: https://github.com/ambv/black\n\nTaskHawk is a replacement for celery that works on AWS SQS/SNS and Google PubSub, while keeping things pretty simple and\nstraightforward. Any unbound function can be converted into a TaskHawk task.\n\nOnly Python 3.6+ is supported currently.\n\nYou can find the latest, most up to date, documentation at `Read the Docs`_.\n\n\nQuick Start\n-----------\n\nFirst, install the library:\n\n.. code:: sh\n\n    $ pip install taskhawk\n\nNext, set up a few configuration settings:\n\nCommon required settings:\n\n.. code:: python\n\n    TASKHAWK_QUEUE = \"DEV-MYAPP\"\n\nWhen using AWS, additional required settings are:\n\n.. code:: python\n\n    AWS_ACCESS_KEY = <YOUR AWS KEY>\n    AWS_ACCOUNT_ID = <YOUR AWS ACCOUNT ID>\n    AWS_REGION = <YOUR AWS REGION>\n    AWS_SECRET_KEY = <YOUR AWS SECRET KEY>\n\n    TASKHAWK_CONSUMER_BACKEND = 'taskhawk.backends.aws.AWSSQSConsumerBackend'\n    TASKHAWK_PUBLISHER_BACKEND = 'taskhawk.backends.aws.AWSSNSPublisherBackend'\n\n\nIn case of GCP, additional required settings are:\n\n.. code:: python\n\n    TASKHAWK_CONSUMER_BACKEND = 'taskhawk.backends.gcp.GooglePubSubConsumerBackend'\n    TASKHAWK_PUBLISHER_BACKEND = 'taskhawk.backends.gcp.GooglePubSubPublisherBackend'\n\n\nIf running outside Google Cloud (e.g. locally), set ``GOOGLE_APPLICATION_CREDENTIALS``.\n\nWithin Google Cloud, these credentials and permissions are managed by Google using IAM.\n\nIf the Pub/Sub resources lie in a different project, set ``GOOGLE_CLOUD_PROJECT`` to the project id.\n\nFor Django projects, simple use `Django settings`_ to configure Taskhawk. For Flask projects, use `Flask config`_.\nFor other frameworks, you can either declare an environment variable called ``SETTINGS_MODULE`` that points to a\nmodule where settings may be found, or manually configure using ``taskhawk.conf.settings.configure_with_object``.\n\nThen, simply add the decorator ``taskhawk.task`` to your function:\n\n.. code:: python\n\n   @taskhawk.task\n   def send_email(to: str, subject: str, from_email: str = None) -> None:\n       # send email\n\nAnd finally, dispatch your function asynchronously:\n\n.. code:: python\n\n    send_email.dispatch('example@email.com', 'Hello!', from_email='example@spammer.com')\n\nDevelopment\n-----------\n\nGetting Started\n~~~~~~~~~~~~~~~\nAssuming that you have Python, ``pyenv`` and ``pyenv-virtualenv`` installed, set up your\nenvironment and install the required dependencies like this instead of\nthe ``pip install taskhawk`` defined above:\n\n.. code:: sh\n\n    $ git clone https://github.com/cloudchacho/taskhawk-python.git\n    $ cd taskhawk-python\n    $ pyenv virtualenv 3.7.7 taskhawk-python-3.7\n    ...\n    $ pyenv activate taskhawk-python-3.7\n    $ pip install -r requirements/dev-3.7.txt\n\nRunning Tests\n~~~~~~~~~~~~~\nYou can run tests in using ``make test``. By default,\nit will run all of the unit and functional tests, but you can also specify your own\n``py.test`` options.\n\n.. code:: sh\n\n    $ py.test\n    $ py.test tests/test_consumer.py\n\nGenerating Documentation\n~~~~~~~~~~~~~~~~~~~~~~~~\nSphinx is used for documentation. You can generate HTML locally with the\nfollowing:\n\n.. code:: sh\n\n    $ pip install -e .[dev]\n    $ make docs\n\n\nGetting Help\n------------\n\nWe use GitHub issues for tracking bugs and feature requests.\n\n* If it turns out that you may have found a bug, please `open an issue <https://github.com/cloudchacho/taskhawk-python/issues/new>`__\n\n.. _Read the Docs: https://taskhawk.readthedocs.io/en/latest/\n.. _Django settings: https://docs.djangoproject.com/en/2.0/topics/settings/\n.. _Flask config: https://flask.palletsprojects.com/en/1.1.x/config/\n\n\n",
    "bugtrack_url": null,
    "license": "Apache Software License (Apache License 2.0)",
    "summary": "Taskhawk Python Library",
    "version": "4.6.0",
    "project_urls": {
        "Homepage": "https://github.com/cloudchacho/taskhawk-python"
    },
    "split_keywords": [
        "python",
        "taskhawk"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "709203be529588683e3ffeb6696308204936f70fcb90040a7f9c8fddc033077e",
                "md5": "d65fb8c8e397330cd77706518c5e0869",
                "sha256": "caa310f17482a88aa91a8a124a3b573b21cebcce371f7f06b637b66f5c5871d6"
            },
            "downloads": -1,
            "filename": "taskhawk-4.6.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d65fb8c8e397330cd77706518c5e0869",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 29846,
            "upload_time": "2024-12-02T11:11:31",
            "upload_time_iso_8601": "2024-12-02T11:11:31.861390Z",
            "url": "https://files.pythonhosted.org/packages/70/92/03be529588683e3ffeb6696308204936f70fcb90040a7f9c8fddc033077e/taskhawk-4.6.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "49d68ffa8e14cf96c7245f2842f0f7c50d662a6f98dde7402a22e532f65078f2",
                "md5": "2d36aaa0e00b52455347201abf80e061",
                "sha256": "73fce24a3ab78c1dfc785ddf4621cac7d692ef561fe262e7580a3a6f34d14890"
            },
            "downloads": -1,
            "filename": "taskhawk-4.6.0.tar.gz",
            "has_sig": false,
            "md5_digest": "2d36aaa0e00b52455347201abf80e061",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 38825,
            "upload_time": "2024-12-02T11:11:34",
            "upload_time_iso_8601": "2024-12-02T11:11:34.190972Z",
            "url": "https://files.pythonhosted.org/packages/49/d6/8ffa8e14cf96c7245f2842f0f7c50d662a6f98dde7402a22e532f65078f2/taskhawk-4.6.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-02 11:11:34",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "cloudchacho",
    "github_project": "taskhawk-python",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": true,
    "lcname": "taskhawk"
}
        
Elapsed time: 2.74046s