Skip to content

AhmedMo1242/os_assistant

Repository files navigation

license Tests PythonVersion

os_assistant

This is a modern template for a python project with the pyproject.toml with some fields to change based on project. It also has tox configured, docs dir for github pages, .github dir with tox-gh-actions configured and more.

Prerequisites

Make sure uv is installed. Here is the install script on macOS and Linux

curl -LsSf https://astral.sh/uv/install.sh | sh

Installation

  1. clone the repo and cd into it.
 $ git clone <repo_url>
 $ cd os_assistant
  1. run uv sync to install all dependencies in a virtual environment. Note that this step is not necessary as uv automatically runs it before running any script with uv run.
 $ uv sync
  1. Make sure that pre-commit hooks are installed.
 $ uv run pre-commit install
  1. Create a .env file with necessary variables. You can either copy the example file or create it manually.

    On Linux/macOS:

    cp .env.example .env

    On Windows (CMD):

    copy .env.example .env
  2. Edit .env and replace the value of MODEL_BASE_URL with your personal ngrok link, e.g.:

    MODEL_BASE_URL=https://your-ngrok-link.ngrok-free.app
    
  3. Run the environment setup and model pulling script:

    Either On Linux/macOS or Windows:

    make setup_and_pull
    

These scripts:

  • Load variables from your .env file.
  • Set the OLLAMA_HOST environment variable using MODEL_BASE_URL.
  • Pull required models using ollama pull.

Usage

We primarily use make as a command runner (bad practices ik). Have a look at the makefile for all available commands.

CLI Usage

The osassis command line tool provides the following features:

Interactive Chat

Open an interactive chat session with the OS assistant:

 $ make run
 # or activate venv first then run
 $ osassis chat # inside venv

System Tracing

Start tracing file system events in a directory:

 $ osassis trace start file_system --dir path/to/watch

View trace logs with time filtering:

 $ osassis trace show file_system --start "yesterday" --end "now"

Clear trace logs for a domain:

 $ osassis trace clear file_system

Streamlit application

 $ make streamlit_run

Testing with tox

tox creates virtual environments and runs all of pytest, ruff, and mypy.

 $ make tox

Packages

 
 
 

Contributors