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

docs: getting-started: Improve running pip from source tree section #8148

Merged
merged 1 commit into from
May 31, 2020

Conversation

NoahGorny
Copy link
Contributor

Related to #8138
Not really urgent 😄
Lemme know what you think @pradyunsg

Copy link
Member

@pradyunsg pradyunsg left a 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 .
Copy link
Member

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.

Copy link
Member

Choose a reason for hiding this comment

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

Oh, but Windows... :(

Copy link
Contributor Author

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

Copy link
Contributor

@deveshks deveshks Apr 26, 2020

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

Copy link
Contributor Author

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 😞

Copy link
Member

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.

Copy link
Contributor Author

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 😄

Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done both suggestions :)

@NoahGorny NoahGorny force-pushed the improve-dev-docs branch 2 times, most recently from 364f4c0 to 1ba509a Compare April 27, 2020 11:51
@pradyunsg pradyunsg added the type: docs Documentation related label May 5, 2020
@NoahGorny
Copy link
Contributor Author

@pradyunsg @deveshks I think this PR is still relevant, you can take a look again if you want
I rebased on master right now 😄

$ 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
Copy link
Contributor

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

Copy link
Contributor Author

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.

Copy link
Member

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. :)

@pradyunsg pradyunsg merged commit 549a9d1 into pypa:master May 31, 2020
@pradyunsg
Copy link
Member

Thanks @NoahGorny! ^>^

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: docs Documentation related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants