Skip to content

Commit 67c1b34

Browse files
authored
Merge pull request #4145 from python-poetry/1.1-reorganize-docs
[1.1] Reorganize documentation
2 parents 7a0fdf9 + d14b131 commit 67c1b34

18 files changed

+594
-341
lines changed

.github/workflows/docs.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.
Lines changed: 53 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
1+
---
2+
title: "Introduction"
3+
draft: false
4+
type: docs
5+
layout: "single"
6+
7+
menu:
8+
docs:
9+
weight: 0
10+
---
11+
112
# Introduction
213

3-
Poetry is a tool for dependency management and packaging in Python.
14+
Poetry is a tool for **dependency management** and **packaging** in Python.
415
It allows you to declare the libraries your project depends on and it will manage (install/update) them for you.
516

617

@@ -9,10 +20,10 @@ It allows you to declare the libraries your project depends on and it will manag
920
Poetry requires Python 2.7 or 3.5+. It is multi-platform and the goal is to make it work equally well
1021
on Windows, Linux and OSX.
1122

12-
!!! note
13-
14-
Python 2.7 and 3.5 will no longer be supported in the next feature release (1.2).
15-
You should consider updating your Python version to a supported one.
23+
{{% note %}}
24+
Python 2.7 and 3.5 will no longer be supported in the next feature release (1.2).
25+
You should consider updating your Python version to a supported one.
26+
{{% /note %}}
1627

1728

1829
## Installation
@@ -30,10 +41,10 @@ curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poet
3041
(Invoke-WebRequest -Uri https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py -UseBasicParsing).Content | python -
3142
```
3243

33-
!!! note
34-
35-
You only need to install Poetry once. It will automatically pick up the current
36-
Python version and use it to [create virtualenvs](/docs/managing-environments) accordingly.
44+
{{% note %}}
45+
You only need to install Poetry once. It will automatically pick up the current
46+
Python version and use it to [create virtualenvs]({{< relref "managing-environments" >}}) accordingly.
47+
{{% /note %}}
3748

3849
The installer installs the `poetry` tool to Poetry's `bin` directory.
3950
On Unix it is located at `$HOME/.poetry/bin` and on Windows at `%USERPROFILE%\.poetry\bin`.
@@ -81,29 +92,29 @@ python get-poetry.py --version 0.12.0
8192
POETRY_VERSION=0.12.0 python get-poetry.py
8293
```
8394

84-
!!!note
95+
{{% note %}}
96+
Note that the installer does not support Poetry releases < 0.12.0.
97+
{{% /note %}}
8598

86-
Note that the installer does not support Poetry releases < 0.12.0.
99+
{{% note %}}
100+
The setup script must be able to find one of following executables in your shell's path environment:
87101

88-
!!!note
89-
90-
The setup script must be able to find one of following executables in your shell's path environment:
91-
92-
- `python` (which can be a py3 or py2 interpreter)
93-
- `python3`
94-
- `py.exe -3` (Windows)
95-
- `py.exe -2` (Windows)
102+
- `python` (which can be a py3 or py2 interpreter)
103+
- `python3`
104+
- `py.exe -3` (Windows)
105+
- `py.exe -2` (Windows)
106+
{{% /note %}}
96107

97108
### Alternative installation methods (not recommended)
98109

99-
!!!note
100-
101-
Using alternative installation methods will make Poetry always
102-
use the Python version for which it has been installed to create
103-
virtualenvs.
110+
{{% note %}}
111+
Using alternative installation methods will make Poetry always
112+
use the Python version for which it has been installed to create
113+
virtualenvs.
104114

105-
So, you will need to install Poetry for each Python version you
106-
want to use and switch between them.
115+
So, you will need to install Poetry for each Python version you
116+
want to use and switch between them.
117+
{{% /note %}}
107118

108119
#### Installing with `pip`
109120

@@ -113,14 +124,14 @@ Using `pip` to install Poetry is possible.
113124
pip install --user poetry
114125
```
115126

116-
!!!warning
117-
118-
Be aware that it will also install Poetry's dependencies
119-
which might cause conflicts with other packages.
127+
{{% warning %}}
128+
Be aware that it will also install Poetry's dependencies
129+
which might cause conflicts with other packages.
130+
{{% /warning %}}
120131

121132
#### Installing with `pipx`
122133

123-
Using [`pipx`](https://github.com/cs01/pipx) to install Poetry is also possible. [pipx] is used to install Python CLI applications globally while still isolating them in virtual environments. This allows for clean upgrades and uninstalls. pipx supports Python 3.6 and later. If using an earlier version of Python, consider [pipsi](https://github.com/mitsuhiko/pipsi).
134+
Using [`pipx`](https://github.com/cs01/pipx) to install Poetry is also possible. `pipx` is used to install Python CLI applications globally while still isolating them in virtual environments. This allows for clean upgrades and uninstalls. pipx supports Python 3.6 and later. If using an earlier version of Python, consider [pipsi](https://github.com/mitsuhiko/pipsi).
124135

125136
```bash
126137
pipx install poetry
@@ -158,15 +169,14 @@ to `self update`.
158169
poetry self update 0.8.0
159170
```
160171

161-
!!!note
162-
163-
The `self update` command will only work if you used the recommended
164-
installer to install Poetry.
165-
166-
!!!note
167-
168-
If you are still on poetry version < 1.0 use `poetry self:update` instead.
172+
{{% note %}}
173+
The `self update` command will only work if you used the recommended
174+
installer to install Poetry.
175+
{{% /note %}}
169176

177+
{{% note %}}
178+
If you are still on poetry version < 1.0 use `poetry self:update` instead.
179+
{{% /note %}}
170180

171181
## Enable tab completion for Bash, Fish, or Zsh
172182

@@ -199,9 +209,9 @@ poetry completions zsh > ~/.zprezto/modules/completion/external/src/_poetry
199209

200210
```
201211

202-
!!! note
203-
204-
You may need to restart your shell in order for the changes to take effect.
212+
{{% note %}}
213+
You may need to restart your shell in order for the changes to take effect.
214+
{{% /note %}}
205215

206216
For `zsh`, you must then add the following line in your `~/.zshrc` before `compinit`:
207217

@@ -211,7 +221,7 @@ fpath+=~/.zfunc
211221

212222
For `oh-my-zsh`, you must then enable poetry in your `~/.zshrc` plugins
213223

214-
```
224+
```text
215225
plugins(
216226
poetry
217227
...
Lines changed: 42 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
1+
---
2+
title: "Basic usage"
3+
draft: false
4+
type: docs
5+
layout: single
6+
7+
menu:
8+
docs:
9+
weight: 10
10+
---
11+
112
# Basic usage
213

314
For the basic usage introduction we will be installing `pendulum`, a datetime library.
4-
If you have not yet installed Poetry, refer to the [Introduction](/docs/) chapter.
15+
If you have not yet installed Poetry, refer to the [Introduction]({{< relref "." >}} "Introduction") chapter.
516

617
## Project setup
718

@@ -77,8 +88,8 @@ It will automatically find a suitable version constraint **and install** the pac
7788
## Using your virtual environment
7889

7990
By default, poetry creates a virtual environment in `{cache-dir}/virtualenvs` (`{cache-dir}\virtualenvs` on Windows).
80-
You can change the [`cache-dir`](/docs/configuration/#cache-dir) value by editing the poetry config.
81-
Additionally, you can use the [`virtualenvs.in-project`](/docs/configuration/#virtualenvs.in-project) configuration variable
91+
You can change the [`cache-dir`]({{< relref "configuration#cache-dir" >}} "cache-dir configuration documentation") value by editing the poetry config.
92+
Additionally, you can use the [`virtualenvs.in-project`]({{< relref "configuration#virtualenvsin-project" >}} "virtualenv.in-project configuration documentation") configuration variable
8293
to create virtual environment within your project directory.
8394

8495

@@ -96,19 +107,19 @@ The easiest way to activate the virtual environment is to create a new shell wit
96107
To deactivate the virtual environment and exit this new shell type `exit`.
97108
To deactivate the virtual environment without leaving the shell use `deactivate`.
98109

99-
!!!note
100-
101-
**Why a new shell?**
102-
Child processes inherit their environment from their parents, but do not share
103-
them. As such, any modifications made by a child process, is not persisted after
104-
the child process exits. A Python application (Poetry), being a child process,
105-
cannot modify the environment of the shell that it has been called from such
106-
that an activated virtual environment remains active after the Poetry command
107-
has completed execution.
110+
{{% note %}}
111+
**Why a new shell?**
108112

109-
Therefore, Poetry has to create a sub-shell with the virtual envrionment activated
110-
in order for the subsequent commands to run from within the virtual environment.
113+
Child processes inherit their environment from their parents, but do not share
114+
them. As such, any modifications made by a child process, is not persisted after
115+
the child process exits. A Python application (Poetry), being a child process,
116+
cannot modify the environment of the shell that it has been called from such
117+
that an activated virtual environment remains active after the Poetry command
118+
has completed execution.
111119

120+
Therefore, Poetry has to create a sub-shell with the virtual envrionment activated
121+
in order for the subsequent commands to run from within the virtual environment.
122+
{{% /note %}}
112123

113124
Alternatively, to avoid creating a new shell, you can manually activate the
114125
virtual environment by running `source {path_to_venv}/bin/activate` (`source {path_to_venv}\Scripts\activate.bat` on Windows).
@@ -128,21 +139,21 @@ To deactivate this virtual environment simply use `deactivate`.
128139
In our example, we are requesting the `pendulum` package with the version constraint `^1.4`.
129140
This means any version greater or equal to 1.4.0 and less than 2.0.0 (`>=1.4.0 <2.0.0`).
130141

131-
Please read [Dependency specification](/docs/dependency-specification) for more in-depth information on versions,
142+
Please read [Dependency specification]({{< relref "dependency-specification" >}} "Dependency specification documentation") for more in-depth information on versions,
132143
how versions relate to each other, and on the different ways you can specify dependencies.
133144

134145

135-
!!!note
146+
{{% note %}}
147+
**How does Poetry download the right files?**
136148

137-
**How does Poetry download the right files?**
149+
When you specify a dependency in `pyproject.toml`, Poetry first takes the name of the package
150+
that you have requested and searches for it in any repository you have registered using the `repositories` key.
151+
If you have not registered any extra repositories, or it does not find a package with that name in the
152+
repositories you have specified, it falls back on PyPI.
138153

139-
When you specify a dependency in `pyproject.toml`, Poetry first takes the name of the package
140-
that you have requested and searches for it in any repository you have registered using the `repositories` key.
141-
If you have not registered any extra repositories, or it does not find a package with that name in the
142-
repositories you have specified, it falls back on PyPI.
143-
144-
When Poetry finds the right package, it then attempts to find the best match
145-
for the version constraint you have specified.
154+
When Poetry finds the right package, it then attempts to find the best match
155+
for the version constraint you have specified.
156+
{{% /note %}}
146157

147158

148159
## Installing dependencies
@@ -189,9 +200,9 @@ Even if you develop alone, in six months when reinstalling the project you can f
189200
the dependencies installed are still working even if your dependencies released many new versions since then.
190201
(See note below about using the update command.)
191202

192-
!!!note
193-
194-
For libraries it is not necessary to commit the lock file.
203+
{{% note %}}
204+
For libraries it is not necessary to commit the lock file.
205+
{{% /note %}}
195206

196207
### Installing dependencies only
197208

@@ -212,7 +223,7 @@ This will fetch the latest matching versions (according to your `pyproject.toml`
212223
and update the lock file with the new versions.
213224
(This is equivalent to deleting the `poetry.lock` file and running `install` again.)
214225

215-
!!!note
216-
217-
Poetry will display a **Warning** when executing an install command if `poetry.lock` and `pyproject.toml`
218-
are not synchronized.
226+
{{% note %}}
227+
Poetry will display a **Warning** when executing an install command if `poetry.lock` and `pyproject.toml`
228+
are not synchronized.
229+
{{% /note %}}

0 commit comments

Comments
 (0)