Metadata-Version: 2.1
Name: chronous
Version: 2.0.0b1
Summary: Library for Event-Driven architecture using asyncio.
Home-page: UNKNOWN
Author: Lapis0875
Author-email: lapis0875@kakao.com
License: MIT
Project-URL: Documentation, https://lapis0875.gitbook.io/chronous-docs
Project-URL: Source, https://github.com/Lapis0875/Chronous/
Project-URL: Tracker, https://github.com/Lapis0875/Chronous/issues
Project-URL: Funding, https://donaricano.com/mypage/1454721972__x4Qvm
Keywords: Event-Driven architecture,EDD,async,asynchronous,asyncio
Platform: UNKNOWN
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: Natural Language :: Korean
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Framework :: AsyncIO
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.6
Description-Content-Type: text/markdown
Requires-Dist: wheel (>=0.35.1)
Provides-Extra: color
Requires-Dist: colorama (>=0.4.3) ; extra == 'color'
Requires-Dist: colorlog (>=4.2.1) ; extra == 'color'

===============
Chronous
===============
|py_ver| |issues|

|pypi_ver| |pypi_license| |pypi_package| |pypi_status|

|discord|

**Chronous** is a asynchronous python library designed to make asynchronous event-driven architectures on discord.py

.. |py_ver| image:: https://img.shields.io/pypi/pyversions/chronous?label=Python%20Version&logo=python&logoColor=yellow
   :target: https://python.org
.. |issues| image:: https://img.shields.io/github/issues/Lapis0875/Chronous?logo=github&logoColor=white
    :target: https://github.com/Lapis0875/Chronous/issues
.. |pypi_ver| image:: https://img.shields.io/pypi/v/chronous?logo=pypi&logoColor=blue
    :target: https://pypi.org/project/chronous/
.. |pypi_license| image:: https://img.shields.io/pypi/l/chronous?logo=pypi&logoColor=blue
    :target: https://github.com/Lapis0875/Chronous/blob/master/LICENSE
.. |pypi_package| image:: https://img.shields.io/pypi/format/chronous?label=package&logo=pypi
   :target: https://pypi.org/project/chronous/
.. |pypi_status| image:: https://img.shields.io/pypi/status/chronous?color=blue&logo=pypi&logoColor=blue
    :target: https://pypi.org/project/chronous/
.. |discord| image:: https://img.shields.io/discord/622434051365535745?color=blue&label=Discord&logo=Discord&logoColor=White
   :target: https://discord.gg/taVq6rw

[Example]

.. code-block:: python

  import asyncio
  from typing import NoReturn
  import datetime
  from chronous.Architecture import BaseArchitecture
  from chronous.events import EventContext, Setup, Init, Start, Close

  class SampleArchitecture(BaseArchitecture):

    def __init__(self) -> None:
      super(SampleArchitecture, self).__init__(name="sample")

      # Registering events
      self.register_event(event=Setup())
      self.register_event(event=Init())
      self.register_event(event=Start())
      self.register_event(event=Close())

    def run(self) -> None:
      # Registering default lifecycle events
      # Start process.
      print("Starting process...")
      asyncio.run(self.process())

    async def process(self) -> NoReturn:
      await self.dispatch("setup")
      await self.dispatch("init")
      print('='*20)
      await self.dispatch("start", datetime.datetime.now())
      index: int = 0
      while index < 10:
        print("Looping!")
        index += 1
      await self.dispatch("close")
      print('='*20)


  sample = SampleArchitecture()

  # Multiple listener sample
  @sample.listen()
  async def setup(ec: EventContext):
    print("{e.name} phase - listener 1".format(e=ec.event))


  @sample.listen()
  async def setup(ec: EventContext):
    print("{e.name} phase - listener 2".format(e=ec.event))


  # EventContext  sample
  @sample.listen()
  async def init(ec: EventContext):
    print("Initialization phase")
    print("Event : {e}".format(e=ec.event))


  # Additional arguments sample
  @sample.listen()
  async def start(ec: EventContext, time: datetime):
    print("Starting process...")
    print("Starting at : {time}".format(time=time))


  # Exception sample
  @sample.listen()
  async def close(ec: EventContext):
    print("Closing process...")
    print(f"Make an error : {1/0}")

  sample.run()



