Skip to content

Added Support for requirements.txt in venv create#63

Merged
shreyasmene06 merged 16 commits intoshreyasmene06:mainfrom
ParthG2209:branch1
Feb 7, 2026
Merged

Added Support for requirements.txt in venv create#63
shreyasmene06 merged 16 commits intoshreyasmene06:mainfrom
ParthG2209:branch1

Conversation

@ParthG2209
Copy link
Contributor

fixes #56

i updated cli.py so the create command now accepts a --requirements flag. then i modified venv.py to actually run pip install inside the new venv if you provide that file. i also added a test case to test_venv.py to make sure it works properly.

@ParthG2209
Copy link
Contributor Author

@shreyasmene06 kindly verify the pr

Copy link
Owner

@shreyasmene06 shreyasmene06 left a comment

Choose a reason for hiding this comment

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

Nice clean implementation that addresses #56. The code is well-structured and the test coverage is good. Just one issue to fix:

Required Change

Remove requirements.txt from the PR
The file requirements.txt at the root with test data shouldn't be committed:
requests==2.31.0
click>=8.0.0
This appears to be a test file you created locally. The project already manages dependencies via pyproject.toml. Please remove this file from the commit.

git rm requirements.txt
git commit --amend

Minor Suggestions (non-blocking)

  1. Consider showing pip output on failure

    Currently using capture_output=True which hides pip's output. For debugging, it might help users to see what went wrong. You could add a --verbose flag or print stderr on failure.

  2. Upgrade pip first?

    Some older venvs have outdated pip. Consider running pip install --upgrade pip before installing requirements, or document this as a known limitation.

Also make sure that the workflow passes all the checks.

Once the requirements.txt file is removed, this is good to merge!

@ParthG2209
Copy link
Contributor Author

@shreyasmene06 i have made the changes kindly verify the PR now

@ParthG2209
Copy link
Contributor Author

Nice clean implementation that addresses #56. The code is well-structured and the test coverage is good. Just one issue to fix:

Required Change

Remove requirements.txt from the PR The file requirements.txt at the root with test data shouldn't be committed: requests==2.31.0 click>=8.0.0 This appears to be a test file you created locally. The project already manages dependencies via pyproject.toml. Please remove this file from the commit.

git rm requirements.txt
git commit --amend

Minor Suggestions (non-blocking)

  1. Consider showing pip output on failure
    Currently using capture_output=True which hides pip's output. For debugging, it might help users to see what went wrong. You could add a --verbose flag or print stderr on failure.
  2. Upgrade pip first?
    Some older venvs have outdated pip. Consider running pip install --upgrade pip before installing requirements, or document this as a known limitation.

Also make sure that the workflow passes all the checks.

Once the requirements.txt file is removed, this is good to merge!

@shreyasmene06 i have removed the requirements.txt file kindly merge the PR

Copy link
Owner

@shreyasmene06 shreyasmene06 left a comment

Choose a reason for hiding this comment

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

Thanks for addressing the previous feedback! The test requirements.txt file was removed and error reporting was improved.
However, there's a bug in the pip command construction:

Required Fix

Duplicate pip arguments in venv.py (lines ~188-197)

pip_cmd.extend(["install", "-r", str(requirements_file)])  # <-- adds args here
# ...then later...
subprocess.run(
    pip_cmd + ["install", "-r", str(requirements_file)],  # <-- adds them AGAIN
    ...
)
This results in running:
pip install -r requirements.txt install -r requirements.txt
Fix: Remove one of the two. Either:
Option A - Remove the .extend():
# pip_cmd.extend(["install", "-r", str(requirements_file)])  # DELETE THIS LINE
subprocess.run(
    pip_cmd + ["install", "-r", str(requirements_file)],
    ...
)
Option B - Use pip_cmd directly:
pip_cmd.extend(["install", "-r", str(requirements_file)])
subprocess.run(
    pip_cmd,  # Use directly, don't add more args
)

Along with these please look for the code checks and the merge conflicts.
Once fixed, this is good to merge!

@ParthG2209
Copy link
Contributor Author

@shreyasmene06 i have made the changes and ran all the scripts you mentioned now kindly merge the PR

Copy link
Owner

@shreyasmene06 shreyasmene06 left a comment

Choose a reason for hiding this comment

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

The pip_cmd duplicate bug is fixed, but a new critical issue was introduced - likely from a bad merge:

Critical Bug

update_python_windows in installers.py is completely broken
The function now does validation and arch detection, but then just... ends. No return statement, no actual installation:

def update_python_windows(version_str: str, preferred: str = \"auto\") -> bool:
    # ... validation and arch detection code ...
    else:
        arch = \"win32\"
    # <-- Function ends here with no return or installation logic!
def update_python_linux(...):  # Next function starts

This will cause update_python_windows to return None instead of bool, breaking Windows installation entirely.
This looks like a merge conflict was resolved incorrectly. The original code was:
def update_python_windows(version_str: str, preferred: str = "auto") -> bool:
return _install_with_plugins(version_str, preferred=preferred)
Please revert installers.py to keep just the original one-liner, or fix the merge properly.
Also

  • Changes to tui.py seem unrelated to this PR (line wrapping change) - was this intentional?
    Please fix the installers.py issue and I'm happy to approve!

also the checks have failed again please look into them

@ParthG2209
Copy link
Contributor Author

@shreyasmene06 kindly verify the PR now

@ParthG2209
Copy link
Contributor Author

@shreyasmene06 pls verify the PR

@ParthG2209
Copy link
Contributor Author

@shreyasmene06 kindly verify the PR

Copy link
Owner

@shreyasmene06 shreyasmene06 left a comment

Choose a reason for hiding this comment

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

All previous issues have been fixed:

  • update_python_windows now properly returns (was broken from bad merge)
  • Duplicate pip_cmd arguments fixed
  • Test requirements.txt file removed
  • Tests included
    The implementation looks clean now:
  • --requirements / -r flag properly integrated
  • Cross-platform pip handling (Windows Scripts/ vs Unix bin/)
  • Fallback to python -m pip when pip exe not found
  • Proper error handling with detailed output
  • Test coverage included

Minor notes (non-blocking)

  1. .flake8 file: This is unrelated to the feature but harmless - consider adding in a separate PR for cleaner history.
  2. tui.py change: This removes "W: wizard" from the hint bar. Since PR #70 (wizard) was already merged, this might cause a merge conflict or revert that addition. Please check when merging.
    LGTM!

@shreyasmene06 shreyasmene06 merged commit 39e80e7 into shreyasmene06:main Feb 7, 2026
12 checks passed
@shreyasmene06 shreyasmene06 added acwoc Indicates this pull request is a part of AcWoC medium denotes an moderately challenging task labels Feb 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

acwoc Indicates this pull request is a part of AcWoC medium denotes an moderately challenging task

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support requirements.txt in venv create

2 participants