Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ dependencies = [
"pyyaml>=6.0",
"tqdm>=4.64.0",
"numpy>=1.22.0",
"python-dotenv>=1.2.1",
]

[project.optional-dependencies]
Expand Down Expand Up @@ -60,7 +61,6 @@ frontier-cs = [
"google-genai>=1.55.0",
"google-generativeai>=0.8.5",
"numpy>=2.0.0", # Frontier-CS requires numpy 2.x
"python-dotenv>=1.2.1",
"skypilot>=0.10.5",
]
prompt-optimization = [
Expand Down
4 changes: 4 additions & 0 deletions skydiscover/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import traceback
from typing import Optional

from dotenv import load_dotenv

from skydiscover import Runner
from skydiscover.config import (
_parse_model_spec,
Expand All @@ -23,6 +25,8 @@

logger = logging.getLogger(__name__)

load_dotenv()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Calling load_dotenv() at the module level can cause unintended side effects, especially during testing. For example, tests/test_cli_checkpoint_discovery.py imports a function from this module, which would trigger load_dotenv() and could make tests dependent on a .env file or modify the environment unexpectedly.

It's better to move this call inside the main() function to ensure it only runs when the CLI is executed as a script. This will isolate the side effect of loading environment variables to the application's entry point. You should remove this line and add load_dotenv() to your main function, like so:

def main() -> int:
    """Synchronous entry point for the skydiscover console script."""
    load_dotenv()
    return asyncio.run(main_async())

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can make this change if requested. Note that there are main() and main_async(). I'm not sure which of them to update (or maybe both).


_SEARCH_CHOICES = [
"evox",
"adaevolve",
Expand Down
3 changes: 2 additions & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading