Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by:  Bjorn Neergaard <[email protected]>

Co-authored-by: Bjorn Neergaard <[email protected]>
  • Loading branch information
Secrus and neersighted authored Jun 19, 2022
1 parent 29f272d commit f5ee414
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ poetry add pendulum==2.0.5
```

{{% note %}}
See the [Dependency specification]({{< relref "dependency-specification#using-the--operator" >}}) page for more information about `@` operator.
See the [Dependency specification]({{< relref "dependency-specification#using-the--operator" >}}) page for more information about the `@` operator.
{{% /note %}}

If you try to add a package that is already present, you will get an error.
Expand Down
15 changes: 7 additions & 8 deletions docs/dependency-specification.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,33 +86,32 @@ If other dependencies require a different version, the solver will ultimately fa

### Using the `@` operator

When adding dependencies via CLI `add` command, you can use `@` operator.
This is understood the same way as `==` specifier, with one difference. After the `@` operator, you can use any
specifiers that are valid in `pyproject.toml` file. For example:
When adding dependencies via CLI `add` command, you can use the `@` operator.
This is understood similarly to the `==` syntax, but also allows prefixing any
specifiers that are valid in `pyproject.toml`. For example:

```shell
poetry add django@^4.0.0
```

Would translate to the following entry in `pyproject.toml`:
The above would translate to the following entry in `pyproject.toml`:
```toml
Django = "^4.0.0"
```

This operator, can also be used with in conjunction with word `latest`, to specify latest available version.
For example:
The special keyword `latest` is also understood by the `@` operator:
```shell
poetry add django@latest
```

Would translate to the following entry in `pyproject.toml`:
The above would translate to the following entry in `pyproject.toml`, assuming the latest release of `django` is `4.0.5`:
```toml
Django = "^4.0.5"
```

#### Extras

To use extras for package using the `@` operator, formula is: `package[extra]@version`, for example:
Extras and `@` can be combined as one might expect (`package[extra]@version`):

```shell
poetry add django[bcrypt]@^4.0.0
Expand Down

0 comments on commit f5ee414

Please sign in to comment.