Skip to content

Activate virtualenv before running codeflash#22

Open
aseembits93 wants to merge 1 commit intomainfrom
activate-venv-before-run
Open

Activate virtualenv before running codeflash#22
aseembits93 wants to merge 1 commit intomainfrom
activate-venv-before-run

Conversation

@aseembits93
Copy link
Contributor

Summary

  • When codeflash is found inside a virtualenv (.venv, venv, .env, env), all hook scripts now track the activate script path alongside the binary
  • Generated commands prepend source <venv>/bin/activate && so codeflash runs with the project's full package environment
  • Updated the optimizer agent instructions to detect virtualenvs and activate them before any codeflash invocation

Test plan

  • Verify codeflash runs correctly when installed in a .venv (not on global PATH)
  • Verify no activation prefix is added when codeflash is on the global PATH
  • Test post-commit hook (suggest-optimize.sh) generates correct command with venv activation
  • Test session config check (check-config.sh) includes activation instructions in messages
  • Test optimizer agent follows venv activation steps

🤖 Generated with Claude Code

When codeflash is installed in a project virtualenv rather than globally,
the environment must be activated so codeflash has access to the project's
installed packages. This updates find_codeflash() in all hook scripts to
track the venv activate path, and prepends `source <activate> &&` to all
generated commands. The optimizer agent instructions are also updated to
detect and activate the venv.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant