Skip to content

Commit 1e13e2c

Browse files
committed
docs: tweak fin's CI instructions
1 parent fec9583 commit 1e13e2c

File tree

1 file changed

+53
-26
lines changed

1 file changed

+53
-26
lines changed

docs/_index.md

+53-26
Original file line numberDiff line numberDiff line change
@@ -276,48 +276,75 @@ To uninstall Poetry, simply delete the entire `$VENV_PATH` directory.
276276
277277
{{< /tab >}}
278278
{{< 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.
279+
Unlike development environments, where making use of the latest tools is desirable, in a CI environment reproducibility
280+
should be made the priority. Here are some suggestions for installing Poetry in such an environment.
282281
283-
**Pin Poetry version**
282+
**Installation method**
284283
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:
284+
The official installer script ([install.python-poetry.org](https://install.python-poetry.org)) offers a streamlined and
285+
simplified installation of Poetry, sufficient for developer use or for simple pipelines. However, in a CI environment
286+
the other two supported installation methods (pipx and manual) should be seriously considered.
287287
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-
```
288+
**Using install.python-poetry.org**
292289
293-
**Installation method**
290+
Downloading a copy of the installer script to a place accessible by your CI pipelines (or maintaining a copy of the
291+
[repository](https://github.com/python-poetry/install.python-poetry.org)) is strongly suggested, to ensure your
292+
pipeline's stability and to maintain control over what code is executed.
294293

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:
294+
By default the installer will install to a user-specific directory. In more complex pipelines that may make accessing
295+
Poetry difficult (especially in cases like multi-stage container builds). It is highly suggested to make use of
296+
`$POETRY_HOME` when using the official installer in CI, as that way the exact paths can be controlled.
297297

298-
***Store a local copy of the installer***
298+
```bash
299+
export POETRY_HOME=/opt/poetry
300+
python3 install-poetry.py --version 1.2.0
301+
$POETRY_HOME/bin/poetry --version
302+
```
299303

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.
304+
**Using pipx**
303305

304-
***Use pip***
306+
Just as `pipx` is a powerful tool for development use, it is equally useful in a CI environment. It takes the same steps
307+
the installer does to safely install Poetry isolated from the rest of your system, but is generic and able to do this
308+
for any Python package, with a syntax/usage that is similar to `pip`. `pipx` should be considered equally supported in
309+
comparison to the official installer, and should be one of your top choices for use of Poetry in CI.
305310

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.
311+
```
312+
pipx install poetry==1.2.0
313+
```
308314

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`:
315+
**Using pip (aka manually)**
311316

312-
```bash
313-
pip install poetry==1.2.0
317+
For maximum control in your CI environment, installation with `pip` is fully supported and something you should
318+
consider. While this requires more explicit commands and knowledge of Python packaging from you, it in return offers the
319+
best debugging experience, and leaves you subject to the fewest external tools.
320+
321+
```
322+
virtualenv /opt/poetry
323+
/opt/poetry/bin/pip install poetry==1.2.0
324+
/opt/poetry/bin/poetry --version
314325
```
315326

316327
{{% 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.
328+
If you install Poetry via `pip`, ensure you have Poetry installed into an isolated environment that is **not the same**
329+
as the target environment managed by Poetry. If Poetry and your project are installed into the same environment, Poetry
330+
is likely to upgrade or uninstall its own dependencies (causing hard-to-debug and understand errors).
319331
{{% /note %}}
320332

333+
**Version pinning**
334+
335+
Whatever method you use, it is highly recommended to explicitly control the version of Poetry used, so that you are able
336+
to upgrade after performing your own validation. Each install method has a different syntax for setting the version --
337+
the following are some simple examples:
338+
339+
```bash
340+
curl -sSL https://install.python-poetry.org | python3 - --version 1.2.0
341+
# or
342+
curl -sSL https://install.python-poetry.org | POETRY_VERSION=1.2.0 python3 -
343+
344+
pipx install poetry==1.2.0
345+
346+
/path/to/venv/bin/pip install poetry==1.2.0
347+
```
321348
{{< /tab >}}
322349
{{< /tabs >}}
323350

0 commit comments

Comments
 (0)