aws / git-remote-codecommit

An implementation of Git Remote Helper that makes it easier to interact with AWS CodeCommit
Apache License 2.0
272 stars 39 forks source link

Feature Request: Add Scripts directory to $PATH in Windows #27

Closed billdenney closed 3 years ago

billdenney commented 3 years ago

As discussed in #4, #11, and #23, the error 'remote-codecommit' is not a git command comes up relatively frequently for Windows users.

It would be helpful if the required path (see those other issues) where checked if it is in the PATH environmental variable, and if not, it should be added. If that is not feasible or thought to be bad practice (to add to the path without asking), it would be helpful if there were a helper command that would add the correct path to the PATH environmental variable. Perhaps something like aws add-git-remote-codecommit-path could be added to the AWS CLI tool.

ghost commented 3 years ago

When you install Python on Windows, the system-wide Scripts directory can be added to your PATH with a checkbox option.

When you install anything with pip with the --user flag, it will go to your "Roaming" AppData which is not on the PATH by default. Unless you've added it to the PATH yourself, pip will always warn you about this:

Installing collected packages: six, urllib3, python-dateutil, jmespath, botocore, git-remote-codecommit
  WARNING: The script git-remote-codecommit.exe is installed in 'C:\Users\MyName\AppData\Roaming\Python\Python36\Scripts' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed botocore-1.20.28 git-remote-codecommit-1.15.1 jmespath-0.10.0 python-dateutil-2.8.1 six-1.15.0 urllib3-1.26.4

If the user misses this warning, then I think that's on the user. It can't be the job of every Python package to modify the user's PATH or repeat this warning upon installation.

Lastly, I would recommend installing a standalone script like this in an isolated virtual environment and add that to your PATH. Tools like pipx can do this for you. This will make sure that if you ever install other CLI applications with pip, their dependencies do not conflict.

billdenney commented 3 years ago

Thank you very much for the detailed answer. I missed the warning from pip, but I agree that if the message is there, it is up to the user.