refactor(venv): Extract pure VenvEngine from monolithic VenvManager - #14
Open
raidos23 wants to merge 1 commit into
Open
refactor(venv): Extract pure VenvEngine from monolithic VenvManager#14raidos23 wants to merge 1 commit into
raidos23 wants to merge 1 commit into
Conversation
…rations Signed-off-by: Samuel Amen Ague <ague.samuel27@gmail.com>
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.
Description
This PR refactors the virtual environment management system by extracting deterministic, pure Python logic from the monolithic
VenvManagerinto a standalone, UI-independentVenvEngine.Key Changes
New
VenvEnginemodule (venvengine.py):validate_venv_strict), tool binary discovery (has_tool_binary), preference file I/O (read_workspace_pref/write_workspace_pref), dependency analysis (can_use_system_python), and SHA-256 requirement markers (compute_file_hash).prepare_manager_commandandcreate_venv_syncfor CLI and headless execution.Refactored
VenvManager(Manager.py):VenvManagernow acts as an orchestrator / facade, delegating pure logic toself.enginewhile preserving 100% backwards compatibility for existing GUI/CLI flows.install_requirements_if_neededthat previously triggeredcreate_venv_if_neededtwice duringpycompiler_ark init --with-venv.Unit Tests (
tests/test_venv_engine.py):VenvEnginetesting path resolution, strict validation, requirement markers, command preparation, and preference management.Verification and Testing
python3 -m unittest discover -s tests).pycompiler_ark init --entry ark.yml --with-venvCLI execution without duplicate log output.Checklist
VenvManagerpublic API.