Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to customize pyenv-win-venv installation location #35

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

jacquindev
Copy link

@jacquindev jacquindev commented Dec 7, 2024

Instead of using the default location at $env:USERPROFILE\.pyenv-win-venv, we can now use pyenv-win-venv from different location. For example: D:\tools\pyenv-win-venv.

Summary by Sourcery

Introduce the ability to customize the installation location of pyenv-win-venv, providing users with the flexibility to choose a directory other than the default. Enhance the script by improving error handling during the removal of installation scripts.

New Features:

  • Add option to customize the installation location of pyenv-win-venv, allowing users to specify a directory other than the default.

Enhancements:

  • Improve error handling by adding -ErrorAction SilentlyContinue to the Remove-Item command.

Copy link

sourcery-ai bot commented Dec 7, 2024

Reviewer's Guide by Sourcery

This PR adds functionality to customize the installation location of pyenv-win-venv instead of using the default location at %USERPROFILE%.pyenv-win-venv. The implementation modifies the installation script to prompt users for their preferred installation location and updates all related scripts to use the custom location instead of the hardcoded default path.

No diagrams generated as the changes look simple and do not need a visual representation.

File-Level Changes

Change Details Files
Added user prompt for custom installation location
  • Added prompt to choose between default and custom installation location
  • Added input prompt for custom installation path when selected
  • Updated environment variable path setting to use custom installation directory
bin/install-pyenv-win-venv.ps1
Modified scripts to use dynamic installation path
  • Changed hardcoded %USERPROFILE% path to use script location
  • Added script directory detection logic
  • Updated path resolution to use relative paths from script location
bin/pyenv-win-venv.ps1
bin/pyenv-win-venv.bat
bin/pyenv-venv.bat
bin/pyenv-venv.ps1
Minor code improvements and fixes
  • Added error handling for file removal during installation
  • Fixed code formatting and whitespace issues
  • Added cSpell disable comment
bin/install-pyenv-win-venv.ps1
bin/pyenv-win-venv.ps1

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @jacquindev - I've reviewed your changes - here's some feedback:

Overall Comments:

  • The batch files (pyenv-win-venv.bat and pyenv-venv.bat) are incomplete - they set ScriptDir but don't use it to launch the PowerShell scripts. This will break Windows compatibility.
  • Consider replacing the interactive prompt with a command-line parameter for the installation path to support automated installations and CI/CD scenarios.
Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

$PyEnvWinVenvDir = "${env:USERPROFILE}\.pyenv-win-venv"
}
else {
$PyEnvWinVenvDir = Read-Host "Input your desired location for pyenv-win-venv installation"
Copy link

Choose a reason for hiding this comment

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

issue: The custom installation path should be validated before proceeding

Consider adding path validation to ensure the provided location is valid, writable, and doesn't contain invalid characters. This will prevent installation failures later in the script.

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