{ "info": { "author": "@Robpol86", "author_email": "robpol86@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Web Environment", "Framework :: Flask", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: MacOS :: MacOS X", "Operating System :: Microsoft :: Windows", "Operating System :: POSIX", "Operating System :: POSIX :: Linux", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Topic :: Software Development :: Libraries" ], "description": "Flask-Celery-Helper\n===================\n\nEven though the `Flask documentation `_ says Celery extensions are\nunnecessary now, I found that I still need an extension to properly use Celery in large Flask applications. Specifically\nI need an init_app() method to initialize Celery after I instantiate it.\n\nThis extension also comes with a ``single_instance`` method.\n\n* Python 2.6, 2.7, 3.3, and 3.4 supported on Linux and OS X.\n* Python 2.7, 3.3, and 3.4 supported on Windows (both 32 and 64 bit versions of Python).\n\n.. image:: https://img.shields.io/appveyor/ci/Robpol86/Flask-Celery-Helper.svg?style=flat-square\n :target: https://ci.appveyor.com/project/Robpol86/Flask-Celery-Helper\n :alt: Build Status Windows\n\n.. image:: https://img.shields.io/travis/Robpol86/Flask-Celery-Helper/master.svg?style=flat-square\n :target: https://travis-ci.org/Robpol86/Flask-Celery-Helper\n :alt: Build Status\n\n.. image:: https://img.shields.io/codecov/c/github/Robpol86/Flask-Celery-Helper/master.svg?style=flat-square\n :target: https://codecov.io/github/Robpol86/Flask-Celery-Helper\n :alt: Coverage Status\n\n.. image:: https://img.shields.io/pypi/v/Flask-Celery-Helper.svg?style=flat-square\n :target: https://pypi.python.org/pypi/Flask-Celery-Helper/\n :alt: Latest Version\n\n.. image:: https://img.shields.io/pypi/dm/Flask-Celery-Helper.svg?style=flat-square\n :target: https://pypi.python.org/pypi/Flask-Celery-Helper/\n :alt: Downloads\n\nAttribution\n-----------\n\nSingle instance decorator inspired by\n`Ryan Roemer `_.\n\nSupported Platforms\n-------------------\n\n* OSX and Linux.\n* Python 2.6, 2.7, 3.3, 3.4\n* `Flask `_ 0.10.1\n* `Redis `_ 2.9.1\n* `Celery `_ 3.1.11\n\nQuickstart\n----------\n\nInstall:\n\n.. code:: bash\n\n pip install Flask-Celery-Helper\n\n\nExample:\n\n.. code:: python\n\n # example.py\n from flask import Flask\n from flask.ext.celery import Celery\n \n app = Flask('example')\n app.config['CELERY_BROKER_URL'] = 'redis://localhost'\n app.config['CELERY_RESULT_BACKEND'] = 'redis://localhost'\n celery = Celery(app)\n \n @celery.task()\n def add_together(a, b):\n return a + b\n \n if __name__ == '__main__':\n result = add_together.delay(23, 42)\n print(result.get())\n\n\nRun these two commands in separate terminals:\n\n.. code:: bash\n\n celery -A example.celery worker\n python example.py\n\n\nFactory Example\n---------------\n\n.. code:: python\n\n # extensions.py\n from flask.ext.celery import Celery\n \n celery = Celery()\n\n\n.. code:: python\n\n # application.py\n from flask import Flask\n from extensions import celery\n \n def create_app():\n app = Flask(__name__)\n app.config['CELERY_IMPORTS'] = ('tasks.add_together', )\n app.config['CELERY_BROKER_URL'] = 'redis://localhost'\n app.config['CELERY_RESULT_BACKEND'] = 'redis://localhost'\n celery.init_app(app)\n return app\n\n\n.. code:: python\n\n # tasks.py\n from extensions import celery\n \n @celery.task()\n def add_together(a, b):\n return a + b\n\n\n.. code:: python\n\n # manage.py\n from application import create_app\n \n app = create_app()\n app.run()\n\n\nSingle Instance Example\n-----------------------\n\n.. code:: python\n\n # example.py\n import time\n from flask import Flask\n from flask.ext.celery import Celery, single_instance\n from flask.ext.redis import Redis\n \n app = Flask('example')\n app.config['REDIS_URL'] = 'redis://localhost'\n app.config['CELERY_BROKER_URL'] = 'redis://localhost'\n app.config['CELERY_RESULT_BACKEND'] = 'redis://localhost'\n celery = Celery(app)\n Redis(app)\n \n @celery.task(bind=True)\n @single_instance\n def sleep_one_second(a, b):\n time.sleep(1)\n return a + b\n \n if __name__ == '__main__':\n task1 = sleep_one_second.delay(23, 42)\n time.sleep(0.1)\n task2 = sleep_one_second.delay(20, 40)\n results1 = task1.get(propagate=False)\n results2 = task2.get(propagate=False)\n print(results1) # 65\n if isinstance(results2, Exception) and str(results2) == 'Failed to acquire lock.':\n print('Another instance is already running.')\n else:\n print(results2) # Should not happen.\n\n\nChangelog\n---------\n\n1.1.0\n`````\n\n* Added Windows support.\n* ``CELERY_RESULT_BACKEND`` no longer mandatory.\n* ``single_instance`` supported on SQLite/MySQL/PostgreSQL in addition to Redis.\n* Breaking changes: ``flask.ext.celery.CELERY_LOCK`` moved to ``flask.ext.celery._LockManagerRedis.CELERY_LOCK``.\n\n1.0.0\n`````\n\n* Support for non-Redis backends.\n\n0.2.2\n`````\n\n* Added Python 2.6 and 3.x support.\n\n0.2.1\n`````\n\n* Fixed ``single_instance`` arguments with functools.\n\n0.2.0\n`````\n\n* Added include_args argument to ``single_instance``.\n\n0.1.0\n`````\n\n* Initial release.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Robpol86/Flask-Celery-Helper", "keywords": "flask celery redis", "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "Flask-Celery-Helper", "package_url": "https://pypi.org/project/Flask-Celery-Helper/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/Flask-Celery-Helper/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/Robpol86/Flask-Celery-Helper" }, "release_url": "https://pypi.org/project/Flask-Celery-Helper/1.1.0/", "requires_dist": null, "requires_python": null, "summary": "Celery support for Flask without breaking PyCharm inspections.", "version": "1.1.0" }, "last_serial": 1363282, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "5a0109474c24e1b00503b3de29f3a5e6", "sha256": "6ecf7a8f5c9320828c2c8f86a0e64411a58cfe192a6a46bb3551dc7bcbdb211a" }, "downloads": -1, "filename": "Flask-Celery-Helper-0.1.0.tar.gz", "has_sig": false, "md5_digest": "5a0109474c24e1b00503b3de29f3a5e6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5268, "upload_time": "2014-06-02T02:21:02", "url": "https://files.pythonhosted.org/packages/b0/90/ee413bb6546d722b2927ee5063e5f3b5464463edbb5242491410c9c09855/Flask-Celery-Helper-0.1.0.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "240fc2559e06a54408b3f05193ba5762", "sha256": "3d29f02e1744265db723ac47cfb817b5c513ee20dec7f08a5e9250e6384df0e8" }, "downloads": -1, "filename": "Flask-Celery-Helper-0.2.0.tar.gz", "has_sig": false, "md5_digest": "240fc2559e06a54408b3f05193ba5762", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5558, "upload_time": "2014-06-18T04:22:47", "url": "https://files.pythonhosted.org/packages/9c/bb/d4d32c80868a5d11a9887f4528131da90ae17b23c9bb2ffb70f186cfa6d8/Flask-Celery-Helper-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "0acce955ccc1c08c9d9cc1a3b24c5e8c", "sha256": "139c796254e41cbb964f9dcb1fd1dea61406a644e110e8c0c1d5622ac58af7e3" }, "downloads": -1, "filename": "Flask-Celery-Helper-0.2.1.tar.gz", "has_sig": false, "md5_digest": "0acce955ccc1c08c9d9cc1a3b24c5e8c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5688, "upload_time": "2014-06-18T22:37:35", "url": "https://files.pythonhosted.org/packages/b0/be/c1a5f427452a4455c195067bc1ffca035d63928db1a938782b9016b5e38c/Flask-Celery-Helper-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "733c84362d113013d78c74f35e603205", "sha256": "9ee74efee17ed31511b1b577d0ec60a3a038d5f3692549d8d143005e95c2783d" }, "downloads": -1, "filename": "Flask-Celery-Helper-0.2.2.tar.gz", "has_sig": false, "md5_digest": "733c84362d113013d78c74f35e603205", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6571, "upload_time": "2014-08-11T05:41:31", "url": "https://files.pythonhosted.org/packages/8e/86/5c353adbaead89685598d8eb3bf815e91d89f0c75e7f4bb40b579bdde650/Flask-Celery-Helper-0.2.2.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "ac8603f84c24d53557aa658fe30614cc", "sha256": "8214dc5337bc3406d26c28dbe867740237bfb930152933159c6a83d9e22981e8" }, "downloads": -1, "filename": "Flask-Celery-Helper-1.0.0.tar.gz", "has_sig": false, "md5_digest": "ac8603f84c24d53557aa658fe30614cc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6368, "upload_time": "2014-11-02T02:12:04", "url": "https://files.pythonhosted.org/packages/31/04/147276ab352971b7e9e9308a730d1bb3728a9c755c0f714381091a4c26d8/Flask-Celery-Helper-1.0.0.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "1850fa43dff0c909cbde348e83be5bed", "sha256": "454d4a989c82894be30e5d764341e9f16bb2cedfb2a7f9d5edc67c09e195f8c5" }, "downloads": -1, "filename": "Flask-Celery-Helper-1.1.0.tar.gz", "has_sig": false, "md5_digest": "1850fa43dff0c909cbde348e83be5bed", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7874, "upload_time": "2014-12-29T04:10:33", "url": "https://files.pythonhosted.org/packages/71/f5/3631b71ac28d9b691ff2e2371a95121be18c742c963098635c11cf4a254f/Flask-Celery-Helper-1.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "1850fa43dff0c909cbde348e83be5bed", "sha256": "454d4a989c82894be30e5d764341e9f16bb2cedfb2a7f9d5edc67c09e195f8c5" }, "downloads": -1, "filename": "Flask-Celery-Helper-1.1.0.tar.gz", "has_sig": false, "md5_digest": "1850fa43dff0c909cbde348e83be5bed", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7874, "upload_time": "2014-12-29T04:10:33", "url": "https://files.pythonhosted.org/packages/71/f5/3631b71ac28d9b691ff2e2371a95121be18c742c963098635c11cf4a254f/Flask-Celery-Helper-1.1.0.tar.gz" } ] }