-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Rewrite the Getting Started and Installation Pages #10009
Merged
pradyunsg
merged 10 commits into
pypa:main
from
pradyunsg:new-getting-started-and-installation
May 23, 2021
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
9fb3b7c
Add new installation document
pradyunsg 86c7944
Add initial getting-started scaffold
pradyunsg afcefa9
Rewrite substantial portions of installation docs
pradyunsg cbade4e
Further tweak the installation page
pradyunsg 0139009
Flesh out the Getting Started page
pradyunsg f99ccb1
Update copyright in conf.py, to match copyright.rst
pradyunsg 5734d32
Change first title in getting-started
pradyunsg 34d181a
quickstart.rst -> getting-started.md
pradyunsg 1b38636
installing.rst -> installation.md
pradyunsg f9dc946
Use the footnote in the installation page
pradyunsg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
# Getting Started | ||
|
||
To get started with using pip, you should [install Python] on your system. | ||
|
||
[install Python]: https://realpython.com/installing-python/ | ||
|
||
## Ensure you have a working pip | ||
|
||
As a first step, you should check that you have a working Python with pip | ||
installed. This can be done by running the following commands and making | ||
sure that the output looks similar. | ||
|
||
```{pip-cli} | ||
$ python --version | ||
Python 3.N.N | ||
$ pip --version | ||
pip X.Y.Z from ... (python 3.N.N) | ||
``` | ||
|
||
If that worked, congratulations! You have a working pip in your environment. | ||
|
||
If you got output that does not look like the sample above, please read | ||
the {doc}`installation` page. It provides guidance on how to install pip | ||
within a Python environment that doesn't have it. | ||
|
||
## Common tasks | ||
|
||
### Install a package | ||
|
||
```{pip-cli} | ||
$ pip install sampleproject | ||
[...] | ||
Successfully installed sampleproject | ||
``` | ||
|
||
By default, pip will fetch packages from [Python Package Index][PyPI], a | ||
repository of software for the Python programming language where anyone can | ||
upload packages. | ||
|
||
[PyPI]: https://pypi.org/ | ||
|
||
### Install a package from GitHub | ||
|
||
```{pip-cli} | ||
$ pip install git+https://github.com/pypa/sampleproject.git@main | ||
[...] | ||
Successfully installed sampleproject | ||
``` | ||
|
||
See {ref}`VCS Support` for more information about this syntax. | ||
|
||
### Install a package from a distribution file | ||
|
||
pip can install directly from distribution files as well. They come in 2 forms: | ||
|
||
- {term}`source distribution <Source Distribution (or "sdist")>` (usually shortened to "sdist") | ||
- {term}`wheel distribution <Wheel>` (usually shortened to "wheel") | ||
|
||
```{pip-cli} | ||
$ pip install sampleproject-1.0.tar.gz | ||
[...] | ||
Successfully installed sampleproject | ||
$ pip install sampleproject-1.0-py3-none-any.whl | ||
[...] | ||
Successfully installed sampleproject | ||
``` | ||
|
||
### Install multiple packages using a requirements file | ||
|
||
Many Python projects use {file}`requirements.txt` files, to specify the | ||
list of packages that need to be installed for the project to run. To install | ||
the packages listed in that file, you can run: | ||
|
||
```{pip-cli} | ||
$ pip install -r requirements.txt | ||
[...] | ||
Successfully installed sampleproject | ||
``` | ||
|
||
### Upgrade a package | ||
|
||
```{pip-cli} | ||
$ pip install --upgrade sampleproject | ||
Uninstalling sampleproject: | ||
[...] | ||
Proceed (y/n)? y | ||
Successfully uninstalled sampleproject | ||
``` | ||
|
||
### Uninstall a package | ||
|
||
```{pip-cli} | ||
$ pip uninstall sampleproject | ||
Uninstalling sampleproject: | ||
[...] | ||
Proceed (y/n)? y | ||
Successfully uninstalled sampleproject | ||
``` | ||
|
||
## Next Steps | ||
|
||
It is recommended to learn about what virtual environments are and how to use | ||
them. This is covered in the ["Installing Packages"](pypug:tutorials/installing-packages) | ||
tutorial on packaging.python.org. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# Installation | ||
|
||
Usually, pip is automatically installed if you are: | ||
|
||
- working in a | ||
{ref}`virtual environment <pypug:Creating and using Virtual Environments>` | ||
- using Python downloaded from [python.org](https://www.python.org) | ||
- using Python that has not been modified by a redistributor to remove | ||
{mod}`ensurepip` | ||
|
||
## Supported Methods | ||
|
||
If your Python environment does not have pip installed, there are 2 mechanisms | ||
to install pip supported directly by pip's maintainers: | ||
|
||
- [`ensurepip`](#using-ensurepip) | ||
- [`get-pip.py`](#using-get-pip-py) | ||
|
||
### `ensurepip` | ||
|
||
Python comes with an {mod}`ensurepip` module[^python], which can install pip in | ||
a Python environment. | ||
|
||
```{pip-cli} | ||
$ python -m ensurepip --upgrade | ||
``` | ||
|
||
More details about how {mod}`ensurepip` works and how it can be used, is | ||
available in the standard library documentation. | ||
|
||
### `get-pip.py` | ||
|
||
This is a Python script that uses some bootstrapping logic to install | ||
pip. | ||
|
||
- Download the script, from <https://bootstrap.pypa.io/get-pip.py>. | ||
- Open a terminal/command prompt, `cd` to the folder containing the | ||
`get-pip.py` file and run: | ||
|
||
```{pip-cli} | ||
$ python get-pip.py | ||
``` | ||
|
||
More details about this script can be found in [pypa/get-pip]'s README. | ||
|
||
[pypa/get-pip]: https://github.com/pypa/get-pip | ||
|
||
## Alternative Methods | ||
|
||
Depending on how you installed Python, there might be other mechanisms | ||
available to you for installing pip such as | ||
{ref}`using Linux package managers <pypug:installing pip/setuptools/wheel with linux package managers>`. | ||
|
||
These mechanisms are provided by redistributors of pip, who may have modified | ||
pip to change its behaviour. This has been a frequent source of user confusion, | ||
since it causes a mismatch between documented behaviour in this documentation | ||
and how pip works after those modifications. | ||
|
||
If you face issues when using Python and pip installed using these mechanisms, | ||
it is recommended to request for support from the relevant provider (eg: Linux | ||
distro community, cloud provider support channels, etc). | ||
|
||
## Compatibility | ||
|
||
The current version of pip works on: | ||
|
||
- Windows, Linux and MacOS. | ||
- CPython 3.6, 3.7, 3.8, 3.9 and latest PyPy3. | ||
|
||
pip is tested to work on the latest patch version of the Python interpreter, | ||
for each of the minor versions listed above. Previous patch versions are | ||
supported on a best effort approach. | ||
|
||
pip's maintainers do not provide support for users on older versions of Python, | ||
and these users should request for support from the relevant provider | ||
(eg: Linux distro community, cloud provider support channels, etc). | ||
|
||
[^python]: The `ensurepip` module was added to the Python standard library in Python 3.4. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@pradyunsg looks like this title has lost its label causing https://github.com/pypa/packaging.python.org/pull/898/checks?check_run_id=2655734156#step:6:34 to fail.
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.
Hm... I think this refactoring removed a lot of labels: https://webknjaz.github.io/intersphinx-untangled/pip.pypa.io/
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 wonder if it's time to enable
autolabel
.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.
Ah, nice catch.
We should probably update that to point to https://github.com/pypa/get-pip/#readme instead, since that's the source of truth for information about get-pip now.
I don't want every heading to be an "intersphinx contract" that this documentation needs to be mindful of when making changes.
That's correct. Is that a problem somehow?
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.
My understanding is that they used to be exposed via intersphinx and now they are not. So this has probably broken some sphinx sites.
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 agree with this. I don't think that our previous documentation was well-enough structured that we want to be blocked from improving it just because some sites linked to individual sections. (I don't think that docs are ever so perfect that not being able to reorganise them is reasonable, actually...)
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 believe that Pradyun's comment was not about the old titles but about enabling automatic label creation based on title names. Sphinx has a built-in extension called
autolabel
for this. With this, there wouldn't be any need to create manual labels before titles.