Metadata-Version: 2.1
Name: wiji
Version: 0.1.2
Summary: Wiji is an asyncio distributed task processor/queue.
Home-page: https://github.com/komuw/wiji
Author: komuW
Author-email: komuw05@gmail.com
License: MIT
Keywords: wiji,blah
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Build Tools
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Security
Classifier: Topic :: System :: Installation/Setup
Classifier: Topic :: System :: Networking
Classifier: Topic :: System :: Systems Administration
Classifier: Topic :: Utilities
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.6
Provides-Extra: dev
Requires-Dist: pypandoc ; extra == 'dev'
Requires-Dist: twine ; extra == 'dev'
Requires-Dist: wheel ; extra == 'dev'
Requires-Dist: Sphinx (==1.8.3) ; extra == 'dev'
Requires-Dist: sphinx-autodoc-typehints (==1.6.0) ; extra == 'dev'
Provides-Extra: test
Requires-Dist: coverage ; extra == 'test'
Requires-Dist: flake8 ; extra == 'test'
Requires-Dist: pylint ; extra == 'test'
Requires-Dist: black ; extra == 'test'
Requires-Dist: bandit ; extra == 'test'
Requires-Dist: mypy ; extra == 'test'
Requires-Dist: codecov ; extra == 'test'

wiji
----

`Codacy Badge <https://www.codacy.com/app/komuw/wiji>`__
`CircleCI <https://circleci.com/gh/komuw/wiji>`__
`codecov <https://codecov.io/gh/komuw/wiji>`__ `Code style:
black <https://github.com/komuw/wiji>`__

| ``Wiji`` is an asyncio distributed task processor/queue.
| It’s name is derived from the late Kenyan hip hop artiste, Gwiji.

It is a bit like `Celery <https://github.com/celery/celery>`__

``wiji`` has no third-party dependencies and it requires python version
3.7+

| ``wiji`` is work in progress and very early. It’s API may change in
  backward incompatible ways.
| https://pypi.python.org/pypi/wiji

| **Contents:**
| `Installation <#installation>`__
| `Usage <#usage>`__
| + `As a library <#1-as-a-library>`__
| + `As cli app <#2-as-a-cli-app>`__

| `Features <#features>`__
| + `async everywhere <#1-async-everywhere>`__
| + `monitoring-and-observability <#2-monitoring-and-observability>`__
| + `logging <#21-logging>`__
| + `hooks <#22-hooks>`__ + `Rate limiting <#3-rate-limiting>`__
| + `Queuing <#5-queuing>`__

Installation
------------

.. code:: shell

   pip install wiji

Usage
-----

1. As a library
^^^^^^^^^^^^^^^

.. code:: python

   import asyncio
   import wiji

   class AdderTask(wiji.task.Task):
       async def run(self, a, b):
           result = a + b
           print("\nresult: {0}\n".format(result))
           return result


   broker = wiji.broker.InMemoryBroker()
   myAdderTask = AdderTask(the_broker=broker, queue_name="AdderTaskQueue1")

   # queue some tasks
   myAdderTask.synchronous_delay(a=4, b=37)
   myAdderTask.synchronous_delay(a=67, b=847)

   # run the workers
   worker = wiji.Worker(the_task=myAdderTask)
   asyncio.run(worker.consume_tasks())

2. As a cli app
^^^^^^^^^^^^^^^

``wiji`` also ships with a commandline interface app called
``wiji-cli``.

| create a ``wiji`` config file(which is just any python file that has a
  class instance of ``wiji.conf.WijiConf``), eg;
| ``examples/my_config.py``

.. code:: python

   import wiji

   class AdderTask(wiji.task.Task):
       async def run(self, a, b):
           res = a + b
           return res

   BROKER = wiji.broker.InMemoryBroker()
   myAdderTask = AdderTask(the_broker=BROKER, queue_name="AdderTaskQueue")

   MyConfigInstance = wiji.conf.WijiConf(tasks=[myAdderTask])

| **NB:** the directory where your place that file(in this case;
  ``examples/``) ought to be in your ``PYTHONPATH``
| then run ``wiji-cli`` pointing it to the dotted path of the
  ``wiji.conf.WijiConf`` instance:

.. code:: bash

   wiji-cli --config examples.my_config.MyConfigInstance


