daqc commited on
Commit
4d71812
·
1 Parent(s): ad2dc0f

Remove deprecated environment loading utility

Browse files
src/synthetic_dataset_generator/load_env.py DELETED
@@ -1,48 +0,0 @@
1
- import os
2
- from pathlib import Path
3
- from typing import Dict
4
- from dotenv import load_dotenv
5
-
6
- def load_env_file(env_path: Path | str) -> Dict[str, str]:
7
- """
8
- Load environment variables from a .env file.
9
-
10
- Args:
11
- env_path: Path to the .env file
12
-
13
- Returns:
14
- Dict of environment variables loaded
15
-
16
- Raises:
17
- FileNotFoundError: If the .env file doesn't exist
18
- """
19
- env_vars = {}
20
-
21
- with open(env_path) as f:
22
- for line in f:
23
- line = line.strip()
24
- if line and not line.startswith('#'):
25
- key, value = line.split('=', 1)
26
- key = key.strip()
27
- value = value.strip()
28
- os.environ[key] = value
29
- env_vars[key] = value
30
-
31
- return env_vars
32
-
33
-
34
- def init_environment():
35
- """Initialize environment variables."""
36
- root_dir = Path(__file__).parent.parent.parent
37
- env_file = root_dir / ".env"
38
-
39
- # Load .env if it exists, but do not fail if it does not exist
40
- if env_file.exists():
41
- load_dotenv(env_file)
42
-
43
- # Verify required variables are set
44
- if not os.getenv("HF_TOKEN"):
45
- raise ValueError(
46
- "HF_TOKEN environment variable is required. "
47
- "Please set it in your .env file or environment."
48
- )