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
                                                                            
 Usage: yoda [OPTIONS] COMMAND [ARGS]...                                    
                                                                            
╭─ Options ────────────────────────────────────────────────────────────────╮
│ --install-completion          Install completion for the current shell.  │
│ --show-completion             Show completion for the current shell, to  │
│                               copy it or customize the installation.     │
│ --help                        Show this message and exit.                │
╰──────────────────────────────────────────────────────────────────────────╯
╭─ Commands ───────────────────────────────────────────────────────────────╮
│ ai       AI command. Allows you to communicate with your local LLMs      │
│ config   Config management                                               │
│ dev                                                                      │
│ init     Init yoda configurations                                        │
│ plugin   Commands to manage plugins                                      │
│ url                                                                      │
╰──────────────────────────────────────────────────────────────────────────╯

You can find the details for each plugin with the --help flag. Some examples:

❯ yoda ai --help
                                                                            
 Usage: yoda ai [OPTIONS] COMMAND [ARGS]...                                 
                                                                            
 AI command. Allows you to communicate with your local LLMs                 
                                                                            
╭─ Options ────────────────────────────────────────────────────────────────╮
│ --help          Show this message and exit.                              │
╰──────────────────────────────────────────────────────────────────────────╯
╭─ Commands ───────────────────────────────────────────────────────────────╮
│ chat               Chat with the AI model based on the provided prompt.  │
│ generate-command   Generate code for a new plugin command based on the   │
│                    provided prompt.                                      │
╰──────────────────────────────────────────────────────────────────────────╯
❯ yoda dev --help
                                                                            
 Usage: yoda dev [OPTIONS] COMMAND [ARGS]...                                
                                                                            
╭─ Options ────────────────────────────────────────────────────────────────╮
│ --help          Show this message and exit.                              │
╰──────────────────────────────────────────────────────────────────────────╯
╭─ Commands ───────────────────────────────────────────────────────────────╮
│ checksite          Check if a site is up and running                     │
│ coinflip           Flip a coin!                                          │
│ generatepassword   Generates a secure password                           │
│ speedtest          Test your internet connection                         │
│ whois              Check whois info for a domain name                    │
╰──────────────────────────────────────────────────────────────────────────╯

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

app = typer.Typer(help="""
    Hi plugin. Say hello.

    Example:

        $ yoda hi hello --name MP

        $ yoda hi hello
    """)


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

Use AI to generate your own plugin

$ yoda ai generate-command weather "show weather for the provided location"

🤖 Generated code:

import requests
from typing import Optional

app = typer.Typer(help="""
    Show weather for a given location.

    Example:

        $ yoda weather London

        $ yoda weather -l London
    """)

@app.command()
def weather(location: str, units: Optional[str] = None):
    """Show the current weather for a given location."""
    # Set up your API key or database connection here
    api_key = "YOUR_API_KEY"
    db_conn = None  # Initialize your DB connection here
    
    # Use the requests library to make an HTTP request to the API
    url = f"https://api.openweathermap.org/data/2.5/weather?q={location}&appid={api_key}"
    response = requests.get(url)
    
    # If the response is successful, parse the JSON data and return it in a format that typer can display
    if response.status_code == 200:
        data = response.json()
        temperature = data["main"]["temp"]
        humidity = data["main"]["humidity"]
        wind = data["wind"]["speed"]
        pressure = data["main"]["pressure"]
        
        typer.echo(f"Weather for {location}:")
        typer.echo(f"\tTemperature: {temperature}°C")
        typer.echo(f"\tHumidity: {humidity}%")
        typer.echo(f"\tWind speed: {wind} m/s")
        typer.echo(f"\tPressure: {pressure} hPa")
        
    # If the response is not successful, print an error message
    else:
        typer.echo(f"Error: {response.status_code}")

.. or chat with Yoda:

❯ yoda ai chat "How are you?"
🤖 AI response:
I am well, young one. The Force is strong with me.

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

Metadata

Release files for yodapa 2.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for yodapa 2.0.3
File Size Uploaded Provenance
yodapa-2.0.3.tar.gz 10.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for yodapa 2.0.3
File Interpreter ABI Platform
yodapa-2.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 23.2 kB

Release files / yodapa-2.0.3.tar.gz

Download URL yodapa-2.0.3.tar.gz
Size 10.0 kB
Tags Source
SHA-256 checksum
How to use checksums
b5340d194db353903b3d96e1147edb34616922add1595036ccfc208f3462bcd7
BLAKE2b-256 checksum
How to use checksums
4b81a5a3698e50ff53dc765b05dc9ce5c6d9bd571f70840305bc519a01893aa1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.3 CPython/3.9.23 Linux/6.11.0-1018-azure

Release files / yodapa-2.0.3-py3-none-any.whl

Download URL yodapa-2.0.3-py3-none-any.whl
Size 13.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d2af8521f1cf07db12c62821c7e7862f879fa3f97d313cc15f3521495e53fb19
BLAKE2b-256 checksum
How to use checksums
d1a2fe1a22d938e998242e5ba41afa5b778c0a94ad92699a11f3957c191d0b1a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.3 CPython/3.9.23 Linux/6.11.0-1018-azure

Security for yodapa 2.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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