You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note that the installer does not support Poetry releases < 0.12.0.
97
+
{{% /note %}}
85
98
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:
87
101
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 %}}
96
107
97
108
### Alternative installation methods (not recommended)
98
109
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.
104
114
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 %}}
107
118
108
119
#### Installing with `pip`
109
120
@@ -113,14 +124,14 @@ Using `pip` to install Poetry is possible.
113
124
pip install --user poetry
114
125
```
115
126
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 %}}
120
131
121
132
#### Installing with `pipx`
122
133
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).
124
135
125
136
```bash
126
137
pipx install poetry
@@ -158,15 +169,14 @@ to `self update`.
158
169
poetry self update 0.8.0
159
170
```
160
171
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 %}}
169
176
177
+
{{% note %}}
178
+
If you are still on poetry version < 1.0 use `poetry self:update` instead.
Copy file name to clipboardExpand all lines: docs/basic-usage.md
+42-31Lines changed: 42 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff 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
+
1
12
# Basic usage
2
13
3
14
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.
5
16
6
17
## Project setup
7
18
@@ -77,8 +88,8 @@ It will automatically find a suitable version constraint **and install** the pac
77
88
## Using your virtual environment
78
89
79
90
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
82
93
to create virtual environment within your project directory.
83
94
84
95
@@ -96,19 +107,19 @@ The easiest way to activate the virtual environment is to create a new shell wit
96
107
To deactivate the virtual environment and exit this new shell type `exit`.
97
108
To deactivate the virtual environment without leaving the shell use `deactivate`.
98
109
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?**
108
112
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.
111
119
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 %}}
112
123
113
124
Alternatively, to avoid creating a new shell, you can manually activate the
114
125
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`.
128
139
In our example, we are requesting the `pendulum` package with the version constraint `^1.4`.
129
140
This means any version greater or equal to 1.4.0 and less than 2.0.0 (`>=1.4.0 <2.0.0`).
130
141
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,
132
143
how versions relate to each other, and on the different ways you can specify dependencies.
133
144
134
145
135
-
!!!note
146
+
{{% note %}}
147
+
**How does Poetry download the right files?**
136
148
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.
138
153
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 %}}
146
157
147
158
148
159
## Installing dependencies
@@ -189,9 +200,9 @@ Even if you develop alone, in six months when reinstalling the project you can f
189
200
the dependencies installed are still working even if your dependencies released many new versions since then.
190
201
(See note below about using the update command.)
191
202
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 %}}
195
206
196
207
### Installing dependencies only
197
208
@@ -212,7 +223,7 @@ This will fetch the latest matching versions (according to your `pyproject.toml`
212
223
and update the lock file with the new versions.
213
224
(This is equivalent to deleting the `poetry.lock` file and running `install` again.)
214
225
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`
0 commit comments