Skip to main content

Yoda PA

Github CI PyPI version

Personal Assistant on the command line.

Yoda

Installation

pip install yodapa

yoda --help

Configure Yoda

yoda configure

Plugins

Yoda is designed to be extensible. You can write your own plugins or use the AI to generate one for you.

List plugins

The help command will list all the available plugins.

$ yoda --help

Write your own plugin for Yoda

Simply create a class with the @yoda_plugin(name="plugin-name") decorator and add methods to it. The non-private methods will be automatically added as sub-commands to Yoda, with the command being the name you provide to the decorator.

import typer
from yodapa.plugin_manager.decorator import yoda_plugin


@yoda_plugin(name="hi")
class HiPlugin:
    """
    Hi plugin. Say hello.

    Example:
        $ yoda hi hello --name MP
        $ yoda hi hello
    """

    def hello(self, name: str = None):
        """Say hello."""
        name = name or "Padawan"
        typer.echo(f"Hello {name}!")

    def _private_method_should_not_be_added(self):
        """This method should not be added as a command."""
        raise NotImplementedError()

Use AI to generate your own plugin

$ yoda ai generate-command todo "todo list that keeps track of your todos"

🤖 Generated code:

import typer

from yodapa.plugin_manager.decorator import yoda_plugin


@yoda_plugin(name="todo")
class TodoPlugin:
    """
    Todo plugin. Keeps track of your todos.

    Example:
        $ yoda todo list --all
        $ yoda todo add "Finish assignment"
        $ yoda todo done 1
        $ yoda todo delete 2
    """

    def list(self, all: bool = False):
        """List all todos."""
        if all:
            typer.echo("All todos:")
            for todo in self.todos:
                typer.echo(f"- {todo}")
        else:
            typer.echo("Active todos:")
            for todo in self.active_todos:
                typer.echo(f"- {todo}")

    def add(self, name: str):
        """Add a new todo."""
        if name == "":
            raise ValueError("Todo name cannot be empty")
        self.todos.append(name)
        typer.echo(f"Added todo '{name}'")

    def done(self, id: int):
        """Mark a todo as done."""
        if id < 0 or id >= len(self.todos):
            raise ValueError("Todo ID out of range")
        self.active_todos.remove(self.todos[id])
        typer.echo(f"Marked todo {id} as done")

    def delete(self, id: int):
        """Delete a todo."""
        if id < 0 or id >= len(self.todos):
            raise ValueError("Todo ID out of range")
        self.todos.remove(self.todos[id])
        typer.echo(f"Deleted todo {id}")

    def __init__(self):
        self.todos = []
        self.active_todos = []

if __name__ == "__main__":
    typer.run(TodoPlugin())

Development setup

# 1. Install poetry from their website: https://python-poetry.org/docs/#installation

# 2. Install dependencies and this package
poetry install

# 3. Activate the virtual environment
poetry shell

# Now you should be able to communicate with yoda
yoda --help

Testing

# Run tests when in the virtual environment
pytest

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yodapa-0.4.0.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yodapa-0.4.0-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file yodapa-0.4.0.tar.gz.

File metadata

  • Download URL: yodapa-0.4.0.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.9.20 Linux/6.8.0-1015-azure

File hashes

Hashes for yodapa-0.4.0.tar.gz
Algorithm Hash digest
SHA256 b860871202e5f34bbd53fa681dd5f95e74f9636ae2b7121920be3153d21ae531
MD5 ccf081cb774cd1d4ad12cd1fbfa19151
BLAKE2b-256 b022b67359815b39393f435a054b92321fabc461eee44c4aaa0609728a251bd4

See more details on using hashes here.

File details

Details for the file yodapa-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: yodapa-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.9.20 Linux/6.8.0-1015-azure

File hashes

Hashes for yodapa-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9b4df55a41e958601f31cf1a23733f31763400de22cbf3193947b1af62e38431
MD5 25b1ec475deaa0279924def4c90340e0
BLAKE2b-256 24c4cf03b38aeb3119f18f9bb268a951ceea1a72896c1221def6b7985baf45fc

See more details on using hashes here.

Release history Release notifications | RSS feed

2.0.3

2 files

2.0.2

2 files

2.0.1

2 files

0.5.0

2 files

This release

0.4.0 This release

2 files

0.3.1

2 files

0.3.0

2 files

0.2.0

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page