Entrypoint

Decorators to mark functions as handlers for different type of invocations or requests.

Entrypoint is a function which should handle some kind of external “requests” (different ways of invocation for your application). You can define different entrypoins in one module and associate some specific data with it. Example (not functional here, for illustaration purposes only):

>>> # You can invoke this function running "python <yourappname> -c migrate":
>>> @entrypoint.cli(param="migrate")
>>> # Later in the "main" part of module we should call entrypoint.cmd.run() to run all registered entrypoins...
... def make_migration(): pass
>>> @amqp.consumer(queue="myqueue")
... def my_counsumer(): pass
>>> # Later in the "main" part of module we should call amqp.consumer.run() to run all registered entrypoins (or use its async counterpart: amqp.consumer.create_tasks_future())...

Generally, we can define multiple entrypoins per one module.

class fairways.decorators.entrypoint.Channel(**options)[source]
registry_item_class

alias of EntrypointRegistryItem

class fairways.decorators.entrypoint.Cli(**options)[source]
class fairways.decorators.entrypoint.Cmd(**options)[source]

Invocation via terminal. Special “param” allows to run selected function only when you provide -c / –command argument while starting application.

class fairways.decorators.entrypoint.ConfigHandler(**options)[source]
class fairways.decorators.entrypoint.Cron(**options)[source]
class fairways.decorators.entrypoint.EntrypointRegistryItem(**attrs)[source]

Internal container to keep data related to single entrypoint

handler

Wrapped function

Returns:Decorated function which becomes handler for associated entrypoint
Return type:Callable
classmethod run(args=None)[source]

Invoke all functions decorated by this type of entrypoint.

Parameters:args (Any, optional) – Some data to init run, defaults to None
class fairways.decorators.entrypoint.Http(**options)[source]
as_routes()[source]

Enum string routes with related handlers.

Returns:
[type] – [description]
class fairways.decorators.entrypoint.Listener(**options)[source]
class fairways.decorators.entrypoint.QA(**options)[source]
class fairways.decorators.entrypoint.Transmitter(**options)[source]
fairways.decorators.entrypoint.cli

alias of fairways.decorators.entrypoint.Cli

fairways.decorators.entrypoint.cmd

alias of fairways.decorators.entrypoint.Cmd

fairways.decorators.entrypoint.conf

alias of fairways.decorators.entrypoint.ConfigHandler

fairways.decorators.entrypoint.cron

alias of fairways.decorators.entrypoint.Cron

fairways.decorators.entrypoint.http

alias of fairways.decorators.entrypoint.Http

fairways.decorators.entrypoint.qa

alias of fairways.decorators.entrypoint.QA