Repository navigation
fix(local): install requirements of string-defined functions - #8350
Open
Winoren (Winoren) wants to merge 1 commit into
Open
Winoren (Winoren) wants to merge 1 commit into
Winoren (Winoren) wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why are these changes needed?
LocalCommandLineCodeExecutoracceptsFunctionWithRequirementsStr, including itspython_packagesandglobal_imports, but_setup_functions()only collects package requirements fromFunctionWithRequirements. A string-defined function with a dependency that is not already installed consequently fails while loading its generated module withModuleNotFoundError, even though that dependency was explicitly declared.Include
FunctionWithRequirementsStrin the existing requirement collection. Installation, deduplication, virtual-environment selection, cancellation and function loading continue through the same setup path.The regression test creates a tiny local wheel and a fresh virtual environment. It invokes the real executor, installs the declared wheel through real pip, imports the generated function module and checks the function returns
42. Package-index access and pip version checks are disabled for this test, so it runs without an external package server.Related issue number
Found by inspecting the current local executor implementation; no linked issue.
Validation
Based on upstream
027ecf0a379bcc1d09956d46d12d44a3ad9cee14, using Python 3.11 in an isolateduvenvironment with editable AutoGen packages:ModuleNotFoundError: No module named 'autogen_executor_test_dependency'during function setup.python -m pytest python/packages/autogen-ext/tests/code_executors/test_commandline_code_executor.py -q: 14 passed, 1 skipped (platform-specific PowerShell case).--config-file python/pyproject.toml --follow-imports=silenton both changed files: passed.git diff --check: passed.Full workspace checks, documentation builds, Docker/Azure execution and Windows execution were not run.
Checks
Prepared with Codex assistance.