Making your python package CLI callable

17 Nov 2023 01:59 UTC

Render Engine has a cli that can be called with render-engine --help or python -m render_engine --help.

To do the first command you need to have a [project.scripts] that points to the code being called. Render engine's cli is in and can be called with the cli function.

render-engine = "render_engine.cli:cli"

To do the python -m version, you need to add a call to your code in a file. Since I'm using typer I can just call the app directly.

Enables the use of `python -m render_engine` to run the CLI.

from .cli import app

if __name__ == "__main__":