Skip to content

Commit fec9583

Browse files
committed
docs: added ci recommendations
1 parent f667d48 commit fec9583

File tree

1 file changed

+46
-1
lines changed

1 file changed

+46
-1
lines changed

docs/_index.md

+46-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ If you are viewing documentation for the development branch, you may wish to ins
2828
See the **advanced** installation instructions to use a preview or alternate version of Poetry.
2929
{{% /note %}}
3030

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)" >}}
31+
{{< tabs tabTotal="4" tabID1="installing-with-the-official-installer" tabID2="installing-with-pipx" tabID3="installing-manually" tabID4="ci-recommendation" tabName1="With the official installer" tabName2="With pipx" tabName3="Manually (advanced)" tabName4="CI recommendations">}}
3232

3333
{{< tab tabID="installing-with-the-official-installer" >}}
3434

@@ -274,10 +274,55 @@ Poetry will be available at `$VENV_PATH/bin/poetry` and can be invoked directly
274274
275275
To uninstall Poetry, simply delete the entire `$VENV_PATH` directory.
276276
277+
{{< /tab >}}
278+
{{< tab tabID="ci-recommendation" >}}
279+
In contrast to development environments, where always having the latest version of an application is a good idea,
280+
CI environments should be as much reproducable as possible. Here are some recommendations, when installing Poetry in
281+
such an environment.
282+
283+
**Pin Poetry version**
284+
285+
To ensure reproducable behavior it is highly recommended to explicit set a version during the installation. This can
286+
be done by either using the `--version` option or set the `$POETRY_VERSION` environment variable:
287+
288+
```bash
289+
curl -sSL https://install.python-poetry.org | python3 - --version 1.2.0
290+
curl -sSL https://install.python-poetry.org | POETRY_VERSION=1.2.0 python3 -
291+
```
292+
293+
**Installation method**
294+
295+
Downloading the installer script from https://install.python-poetry.org always returns the latest version of the script.
296+
To ensure reproducable behavior of the installation process, other ways are recommended:
297+
298+
***Store a local copy of the installer***
299+
300+
Either fork the [repository of the installer](https://github.com/python-poetry/install.python-poetry.org) or download
301+
the installer script once and place it somewhere, where all your CI pipelines have access to. Thus, you have the complete
302+
control over which version of the installer is used.
303+
304+
***Use pip***
305+
306+
The recommended way is using the installer or pipx. Both ensure that Poetry is isolated from other Python packages and
307+
a global `poetry` command is provided.
308+
309+
However, in a CI environment you have usually a complete control over what is installed and which commands run. Thus, it
310+
might be suitable to install Poetry via `pip`:
311+
312+
```bash
313+
pip install poetry==1.2.0
314+
```
315+
316+
{{% note %}}
317+
If you install Poetry via `pip`, ensure it is not installed in the same environment Poetry should manage. Otherwise it is
318+
possible that Poetry will accidentally upgrade or uninstall its own dependencies.
319+
{{% /note %}}
320+
277321
{{< /tab >}}
278322
{{< /tabs >}}
279323
280324
325+
281326
## Enable tab completion for Bash, Fish, or Zsh
282327
283328
`poetry` supports generating completion scripts for Bash, Fish, and Zsh.

0 commit comments

Comments
 (0)