Skip to content

Commit 33ab977

Browse files
Secrusneersighted
andcommitted
docs: rework installation and update docs
Also tweak the plugin docs to match Co-authored-by: Bjorn Neergaard <[email protected]>
1 parent 63afbd3 commit 33ab977

File tree

2 files changed

+130
-61
lines changed

2 files changed

+130
-61
lines changed

docs/_index.md

+122-58
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ menu:
1313

1414
Poetry is a tool for **dependency management** and **packaging** in Python.
1515
It allows you to declare the libraries your project depends on and it will manage (install/update) them for you.
16+
Poetry offers a lockfile to ensure repeatable installs, and can build your project for distribution.
1617

1718

1819
## System requirements
@@ -22,27 +23,43 @@ on Linux, macOS and Windows.
2223

2324
## Installation
2425

25-
{{< tabs tabTotal="3" tabID1="installing-with-the-official-installer" tabID2="installing-with-pipx" tabID3="installing-with-pip" tabName1="With the official installer" tabName2="With pipx" tabName3="With pip" >}}
26+
{{% note %}}
27+
If you are viewing documentation for the development branch, you may wish to install a preview or development version of Poetry.
28+
See the **advanced** installation instructions to use a preview or alternate version of Poetry.
29+
{{% /note %}}
30+
31+
{{< tabs tabTotal="3" tabID1="installing-with-the-official-installer" tabID2="installing-with-pipx" tabID3="installing-manually" tabName1="With the official installer" tabName2="With pipx" tabName3="Manually (advanced)" >}}
2632

2733
{{< tab tabID="installing-with-the-official-installer" >}}
2834

29-
Poetry provides a custom installer that will install `poetry` isolated
30-
from the rest of your system.
35+
We provide a custom installer that will install Poetry in a new virtual environment to isolate it
36+
from the rest of your system. This ensures that dependencies will not be accidentally upgraded or
37+
uninstalled, and allows Poetry to manage its own environment.
3138

3239
{{< steps >}}
3340
{{< step >}}
3441
**Install Poetry**
3542

36-
Install Poetry by downloading and executing the [installation script](https://install.python-poetry.org).
43+
The installer script is available directly at [install.python-poetry.org](https://install.python-poetry.org),
44+
and is developed in [its own repository](https://github.com/python-poetry/install.python-poetry.org).
45+
The script can be executed directly (i.e. 'curl python') or downloaded and then executed from disk
46+
(e.g. in a CI environment).
47+
48+
{{% warning %}}
49+
The previous `get-poetry.py` and `install-poetry.py` installers are deprecated. Any installs performed
50+
using `get-poetry.py` should be uninstalled and reinstalled using `install.python-poetry.org` to ensure
51+
in-place upgrades are possible.
52+
{{% /warning %}}
3753

3854
**Linux, macOS, Windows (WSL)**
3955

4056
```bash
4157
curl -sSL https://install.python-poetry.org | python3 -
4258
```
59+
4360
{{% note %}}
44-
Note: On some systems, `python` may still refer to Python 2 instead of Python 3. Please always use the
45-
`python3` binary to ensure the right major version of Python is used.
61+
Note: On some systems, `python` may still refer to Python 2 instead of Python 3. We always suggest the
62+
`python3` binary to avoid ambiguity.
4663
{{% /note %}}
4764

4865
**Windows (Powershell)**
@@ -55,60 +72,31 @@ If you have installed Python through the Microsoft Store, replace `py` with `pyt
5572
above.
5673
{{% /note %}}
5774

58-
{{% note %}}
59-
Note that the installer does not support Python < 3.7.
60-
{{% /note %}}
61-
62-
{{% warning %}}
63-
The previous `get-poetry.py` and `install-poetry.py` installers are now deprecated. If you are currently using them
64-
you should migrate to the new, supported, installer through `https://install.python-poetry.org`.
65-
{{% /warning %}}
6675
{{< /step >}}
6776
{{< step >}}
68-
**Add Poetry to your PATH**
69-
70-
The installer installs the `poetry` tool to Poetry's `bin` directory. This location depends on your system:
71-
72-
- `$HOME/.local/bin` for Unix
73-
- `%APPDATA%\Python\Scripts` on Windows
77+
**Install Poetry (advanced)**
7478

75-
If this directory is not on your `PATH`, you will need to add it manually
76-
if you want to invoke Poetry with simply `poetry`.
79+
By default, Poetry is installed into a platform and user-specific directory:
7780

78-
Alternatively, you can use the full path to `poetry` to use it.
79-
{{< /step >}}
80-
81-
{{< step >}}
82-
**Check the installation**
81+
- `~/Library/Application Support/pypoetry` on MacOS.
82+
- `~/.local/share/pypoetry` on Linux/Unix.
83+
- `%APPDATA%\pypoetry` on Windows.
8384

84-
Once Poetry is installed you can execute the following:
85-
86-
```bash
87-
poetry --version
88-
```
89-
90-
If you see something like `Poetry (version 1.2.0)` then you are ready to use Poetry.
91-
{{< /step >}}
92-
93-
{{< step >}}
94-
**Configure the installation**
95-
96-
By default, Poetry is installed into the user's platform-specific home directory.
97-
If you wish to change this, you may define the `POETRY_HOME` environment variable:
85+
If you wish to change this, you may define the `$POETRY_HOME` environment variable:
9886

9987
```bash
10088
curl -sSL https://install.python-poetry.org | POETRY_HOME=/etc/poetry python3 -
10189
```
10290

10391
If you want to install prerelease versions, you can do so by passing `--preview` option to `install-poetry.py`
104-
or by using the `POETRY_PREVIEW` environment variable:
92+
or by using the `$POETRY_PREVIEW` environment variable:
10593

10694
```bash
10795
curl -sSL https://install.python-poetry.org | python3 - --preview
10896
curl -sSL https://install.python-poetry.org | POETRY_PREVIEW=1 python3 -
10997
```
11098

111-
Similarly, if you want to install a specific version, you can use `--version` option or the `POETRY_VERSION`
99+
Similarly, if you want to install a specific version, you can use `--version` option or the `$POETRY_VERSION`
112100
environment variable:
113101

114102
```bash
@@ -122,10 +110,45 @@ You can also install Poetry from a `git` repository by using the `--git` option:
122110
curl -sSL https://install.python-poetry.org | python3 - --git https://github.com/python-poetry/poetry.git@master
123111
````
124112
{{< /step >}}
113+
{{< step >}}
114+
**Add Poetry to your PATH**
115+
116+
The installer creates a `poetry` wrapper in a well-known, platform-specific directory:
117+
118+
- `$HOME/.local/bin` on Unix.
119+
- `%APPDATA%\Python\Scripts` on Windows.
120+
121+
If this directory is not present in your `$PATH`, you can add it in order to invoke Poetry
122+
as `poetry`.
123+
124+
Alternatively, the full path to the `poetry` binary can always be used:
125+
126+
- `$POETRY_HOME/bin/poetry` if `$POETRY_HOME` is set.
127+
- `~/Library/Application Support/pypoetry/bin/poetry` on MacOS.
128+
- `~/.local/share/pypoetry/bin/poetry` on Linux/Unix.
129+
- `%APPDATA%\pypoetry\Scripts\poetry` on Windows.
130+
131+
{{< /step >}}
132+
{{< step >}}
133+
**Use Poetry**
134+
135+
Once Poetry is installed and in your `$PATH`, you can execute the following:
136+
137+
```bash
138+
poetry --version
139+
```
125140

141+
If you see something like `Poetry (version 1.2.0)`, your install is ready to use!
142+
{{< /step >}}
126143
{{< step >}}
127144
**Update Poetry**
128145

146+
Poetry is able to update itself when installed using the official installer.
147+
148+
```bash
149+
poetry self update
150+
```
151+
129152
If you want to install pre-release versions, you can use the `--preview` option.
130153

131154
```bash
@@ -140,11 +163,11 @@ poetry self update 1.2.0
140163
```
141164

142165
{{% warning %}}
143-
Poetry versions installed using the deprecated `get-poetry.py` installer will not be able to use this
144-
command to update to 1.2 releases or later. Migrate to using `https://install.python-poetry.org` or `pipx`.
166+
Poetry `1.1` series releases are not able to update in-place to `1.2` or newer series releases.
167+
To migrate to newer releases, uninstall using your original install method, and then reinstall
168+
using the [methods above]({{< ref "#installation" >}} "Installation").
145169
{{% /warning %}}
146170
{{< /step >}}
147-
148171
{{< step >}}
149172
**Uninstall Poetry**
150173

@@ -156,25 +179,61 @@ the `POETRY_UNINSTALL` environment variable before executing the installer.
156179
curl -sSL https://install.python-poetry.org | python3 - --uninstall
157180
curl -sSL https://install.python-poetry.org | POETRY_UNINSTALL=1 python3 -
158181
```
159-
{{< /step >}}
160182
183+
{{% warning %}}
184+
If you installed using the deprecated `get-poetry.py` script, you should use it to uninstall instead:
185+
186+
```bash
187+
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python3 - --uninstall
188+
```
189+
{{% /warning %}}
190+
191+
{{< /step >}}
161192
{{< /steps >}}
162193
163194
{{< /tab >}}
164-
165195
{{< tab tabID="installing-with-pipx" >}}
166196
167-
Using [`pipx`](https://github.com/pypa/pipx) to install Poetry is also possible.
197+
Using [`pipx`](https://github.com/pypa/pipx) to install Poetry is also possible and fully supported.
168198
169199
`pipx` is used to install Python CLI applications globally while still isolating them in virtual environments.
170-
This allows for clean upgrades and uninstalls.
200+
`pipx` will manage upgrades and uninstalls when used to install Poetry.
171201
172202
{{< steps >}}
173203
{{< step >}}
174204
**Install Poetry**
175205
176206
```bash
177207
pipx install poetry
208+
```
209+
{{< /step >}}
210+
{{< step >}}
211+
**Install Poetry (advanced)**
212+
213+
`pipx` can be install different versions of Poetry, using the same syntax as pip:
214+
215+
```bash
216+
pipx install poetry==1.2.0
217+
```
218+
219+
`pipx` can also install versions of Poetry in parallel, which allows for easy testing of different or prerelease
220+
versions. Each version is given a unique, user-specified suffix, which will be used to create a unique binary name:
221+
222+
```bash
223+
pipx install --suffix=@preview --pip-args=--pre poetry
224+
poetry@preview --version
225+
226+
pipx install [email protected] poetry==1.2.0
227+
228+
```
229+
230+
Finally, `pipx` can install any valid Python URL spec, which allows for installations of the development version from `git`,
231+
or even the local testing of Pull Requests:
232+
233+
```
234+
pipx install --suffix @master git+https://github.com/python-poetry/poetry.git@master
235+
pipx install --suffix @pr1234 git+https://github.com/python-poetry/poetry.git@refs/pull/1234/head
236+
178237
```
179238
{{< /step >}}
180239
{{< step >}}
@@ -194,22 +253,27 @@ pipx uninstall poetry
194253
{{< /steps >}}
195254
196255
{{< /tab >}}
256+
{{< tab tabID="installing-manually" >}}
197257
198-
{{< tab tabID="installing-with-pip" >}}
258+
Poetry can be installed manually using `pip` and the `venv` module. By doing so you will essentially perform the steps carried
259+
out by the official installer. As this is an advanced installation method, these instructions are Unix-only and omit specific
260+
examples such as installing from `git`.
199261
200-
Using `pip` to install Poetry is possible.
262+
The variable `$VENV_PATH` will be used to indicate the path at which the virtual environment was created.
201263
202264
```bash
203-
pip install --user poetry
265+
python3 -m venv $VENV_PATH
266+
$VENV_PATH/bin/pip install -U pip setuptools
267+
$VENV_PATH/bin/pip install poetry
204268
```
205269
206-
{{% warning %}}
207-
Be aware that it will also install Poetry's dependencies
208-
which might cause conflicts with other packages.
209-
{{% /warning %}}
270+
Poetry will be available at `$VENV_PATH/bin/poetry` and can be invoked directly or symlinked elsewhere.
210271
211-
{{< /tab >}}
272+
As this install is effectively managed by Poetry, `poetry self` commands will still be able to manipulate it.
212273
274+
To uninstall Poetry, simply delete the entire `$VENV_PATH` directory.
275+
276+
{{< /tab >}}
213277
{{< /tabs >}}
214278
215279

docs/plugins.md

+8-3
Original file line numberDiff line numberDiff line change
@@ -233,14 +233,19 @@ pipx runpip poetry uninstall poetry-plugin
233233

234234
### With `pip`
235235

236-
If you used `pip` to install Poetry you can add the plugin packages via the `pip install` command.
236+
The `pip` binary in Poetry's virtual environment can also be used to install and remove plugins.
237+
The environment variable `$POETRY_HOME` here is used to represent the path to the virtual environment.
238+
The [installation instructions](/docs/) can be referenced if you are not
239+
sure where Poetry has been installed.
240+
241+
To add a plugin, you can use `pip install`:
237242

238243
```shell
239-
pip install --user poetry-plugin
244+
$POETRY_HOME/bin/pip install --user poetry-plugin
240245
```
241246

242247
If you want to uninstall a plugin, you can run:
243248

244249
```shell
245-
pip uninstall poetry-plugin
250+
$POETRY_HOME/bin/pip uninstall poetry-plugin
246251
```

0 commit comments

Comments
 (0)