Skip to content
Open
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
16 changes: 9 additions & 7 deletions higgsfield/internal/experiment/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,8 @@ def as_keyed_repo_url(repo_url: Optional[str], project_name: str) -> str:


def insert_env_line(keys: List[str], indent: str) -> str:
lines = []
for key in keys:
line = indent + "echo " + key + '="${{ secrets.' + key + ' }}" >> env'
lines.append(line)

# Use list comprehension and f-strings for improved performance and readability
lines = [f'{indent}echo {key}="${{{{ secrets.{key} }}}}" >> env' for key in keys]
return "\n".join(lines)


Expand Down Expand Up @@ -118,7 +115,6 @@ def generate(self, experiment_name: str, params: List[Param]):
),
)
)


print("Updated experiment action", experiment_name)

Expand All @@ -130,7 +126,13 @@ def _source_experiments(base_path: Path):
the same dependencies (aka environment) as the docker container.
"""
for file in base_path.glob("**/*.py"):
module_name = os.path.basename(file).split(".py")[0].split(".py")[0].replace(" ", "_").replace("-", "_")
module_name = (
os.path.basename(file)
.split(".py")[0]
.split(".py")[0]
.replace(" ", "_")
.replace("-", "_")
)
SourceFileLoader(module_name, str(file)).load_module()


Expand Down