Skip to content

bogonets/reccd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

reccd

PyPI PyPI - Python Version GitHub

Daemon helper for the ANSWER

About

A wrapper to easily adapt gRPC communication without implementing protobuf.

Usage

Print help message:

python -m reccd --help

Print version number:

python -m reccd --version

Prints a list of available modules:

python -m reccd -vvv modules

Start the gRPC daemon server:

python -m reccd -l -d -vvv server -a 0.0.0.0:8080 template

If you need to pass the module's arguments (sys.argv):

python -m reccd -l -d -vvv server -a 0.0.0.0:8080 template {argv1} {argv2} ... {argvN}

Communicates with the daemon server:

python -m reccd -l -d -vvv client -a 0.0.0.0:8080 -m post -p /echo message

Change module prefix

The default module prefix is reccd_. If you want to change it, you can use the --module-prefix flag.

./python -m reccd --module-prefix 'my_prefix_' modules

How to create a module

Create a project so that the package name starts with reccd_.

All specifications must be implemented in an __init__.py file at the root of the module.

Module Version

Add the module's version. Must follow the SemVer specification.

__version__ = "0.0.0"

Module Documentation

Add documentation explaining how to use the module.

__doc__ = """
Usage: module {arg0} {arg1}
...
"""

Module Open Event

Implement the module's initialization event.

Command line arguments passed to the module can be accessed as sys.argv.

async def on_open() -> None:
    pass

Module Close Event

Implement the module's shutdown event.

async def on_close() -> None:
    pass

Module Register Event

Created to identify clients that will communicate with the module.

Arguments depend on the client implementation.

Returns 0 if registered successfully.

async def on_register(*args, **kwargs) -> int:
    return 0

Define the module's routing table

Check out test file.

async def get_test():
    pass

async def post_test():
    pass

def on_routes():
    return [
        ("GET", "/test", get_test),
        ("POST", "/test", post_test),
    ]

License

See the LICENSE file for details. In summary, reccd is licensed under the MIT license.

About

Daemon helper for the ANSWER

Resources

License

Stars

Watchers

Forks

Packages

No packages published