Skip to content

Commit

Permalink
Ensure .env loading from project root directory (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
skytin1004 authored Dec 20, 2024
1 parent 14e36e5 commit 4392369
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "co_op_translator"
version = "0.6.0"
version = "0.6.1"
description = "Easily automate multilingual translations for your projects with co-op-translator, powered by advanced LLM technology."
authors = ["Minseok Song <[email protected]>", "timothychungd <[email protected]>"]
maintainers = []
Expand Down
7 changes: 7 additions & 0 deletions src/co_op_translator/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,17 @@
import click
import importlib.resources
import yaml
from pathlib import Path
from dotenv import load_dotenv
from co_op_translator.core.project.project_translator import ProjectTranslator
from co_op_translator.config.base_config import Config
from co_op_translator.config.vision_config.config import VisionConfig

# Load .env from the root directory
root_dir = Path(__file__).resolve().parent.parent.parent
env_path = root_dir / '.env'
load_dotenv(dotenv_path=env_path)

logger = logging.getLogger(__name__)

@click.command()
Expand Down
4 changes: 1 addition & 3 deletions src/co_op_translator/config/base_config.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import os
from dotenv import load_dotenv
import logging
from pathlib import Path
from co_op_translator.config.llm_config.config import LLMConfig
from co_op_translator.config.vision_config.config import VisionConfig

load_dotenv()

logger = logging.getLogger(__name__)

class Config:
Expand Down

0 comments on commit 4392369

Please sign in to comment.