-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
docs: getting-started: Improve running pip from source tree section #8148
Conversation
b4703ae
to
17e76c0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wheeee! Thanks for filing this PR!
I think a .trivial file would be better for this.
$ python src/pip --version | ||
$ virtualenv venv | ||
$ source venv/bin/activate | ||
$ (venv) python -m pip install -e . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd drop the "(venv)" here. Further, inside an activated environment, using pip (without python -m) is basically guaranteed to work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, but Windows... :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should encourage users (and developers!) to use python -m pip
instead of pip
in any case.
Also, why drop the (venv)
part? I think it signifies that you are doing that in a venv
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also for python3.3+, you can create a virtualenv using venv via python -m venv venv
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still think my approach is the most intuitive 😞
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I thought I'd mentioned the reasoning behind my suggestion.
The (venv) being after the $ can confuse beginners. They would probably see an error, and it'd likely be easier to remove it eagerly rather than wait for a failure. :)
Alternatively, you should add (venv) before the $ on both the Python -m invocations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see I am outnumbered on this, I'll remove the venv
part.
Thanks for the reviews @pradyunsg @deveshks 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also add the suggestion of using python -m venv venv
to create the virtual environment using the inbuilt venv
module as an alternative of using the external virtualenv
module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done both suggestions :)
364f4c0
to
1ba509a
Compare
Also add news entry
1ba509a
to
c38f962
Compare
@pradyunsg @deveshks I think this PR is still relevant, you can take a look again if you want |
$ virtualenv venv # You can also use "python -m venv venv" from python3.3+ | ||
$ source venv/bin/activate | ||
$ python -m pip install -e . | ||
$ python -m pip --version |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIUC, we can do pip install -e .
and pip --version
if we are inside a virtualenv as well, since we know that pip
inside the virtualenv is pointing to our source tree, so using python -m pip
is equivalent to using pip
.
But sticking with python -m pip
will also be a good idea
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should prefer teaching and using python -m pip
in any case as a good practice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm very inclined to opposed that -- but I know better than to pick up the wrong topics in the wrong place. :)
Thanks @NoahGorny! ^>^ |
Related to #8138
Not really urgent 😄
Lemme know what you think @pradyunsg