Skip to content

Remove print statements executing during openwebui_engine module import#4

Merged
achimrabus merged 2 commits intogemini-3-adjustmentsfrom
copilot/sub-pr-2-again
Dec 3, 2025
Merged

Remove print statements executing during openwebui_engine module import#4
achimrabus merged 2 commits intogemini-3-adjustmentsfrom
copilot/sub-pr-2-again

Conversation

Copy link

Copilot AI commented Dec 3, 2025

Addresses feedback from #2 about print statements executing at module import time in engines/openwebui_engine.py.

Changes

  • Moved environment variable loading from module-level to __init__ via new _load_env_variables() method
  • Removed print statements on lines 25 and 27 that executed during import
  • Environment loading now silent; falls back gracefully if python-dotenv not installed

Before:

# Module-level code - executes on import
try:
    from dotenv import load_dotenv
    env_path = Path(__file__).parent.parent / ".env"
    if env_path.exists():
        load_dotenv(env_path)
        print(f"[OpenWebUIEngine] Loaded environment variables from {env_path}")
except ImportError:
    print("[OpenWebUIEngine] Warning: python-dotenv not installed...")

After:

def __init__(self):
    # ... other initialization ...
    self._load_env_variables()

def _load_env_variables(self):
    """Load environment variables from .env file if available."""
    try:
        from dotenv import load_dotenv
        env_path = Path(__file__).parent.parent / ".env"
        if env_path.exists():
            load_dotenv(env_path)
    except ImportError:
        pass  # Environment variables can still be set via OS

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…ngine

Co-authored-by: achimrabus <67736443+achimrabus@users.noreply.github.com>
Copilot AI changed the title [WIP] Address feedback on Gemini 3 adjustments from review comments Remove print statements executing during openwebui_engine module import Dec 3, 2025
Copilot AI requested a review from achimrabus December 3, 2025 07:35
@achimrabus achimrabus marked this pull request as ready for review December 3, 2025 07:38
@achimrabus achimrabus merged commit 20b189c into gemini-3-adjustments Dec 3, 2025
@achimrabus achimrabus deleted the copilot/sub-pr-2-again branch January 23, 2026 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants