From ce70e7e4eb976128ce831d188ef81c0b93625664 Mon Sep 17 00:00:00 2001 From: Mathieu Kniewallner Date: Sun, 19 Jun 2022 00:28:12 +0200 Subject: [PATCH 1/3] doc(*): better document exact requirements --- docs/cli.md | 1 + docs/dependency-specification.md | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/cli.md b/docs/cli.md index 4c29035c80b..9b21685bf8d 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -293,6 +293,7 @@ You also can specify a constraint when adding a package, like so: ```bash poetry add pendulum@^2.0.5 poetry add "pendulum>=2.0.5" +poetry add "pendulum==2.0.5" ``` If you try to add a package that is already present, you will get an error. diff --git a/docs/dependency-specification.md b/docs/dependency-specification.md index 0bb79368724..954945ef722 100644 --- a/docs/dependency-specification.md +++ b/docs/dependency-specification.md @@ -74,10 +74,13 @@ Here are some examples of inequality requirements: ### Exact requirements You can specify the exact version of a package. + +`==1.2.3` is an example of an exact version specification. + This will tell Poetry to install this version and this version only. If other dependencies require a different version, the solver will ultimately fail and abort any install or update procedures. -#### Multiple requirements +### Multiple requirements Multiple version requirements can also be separated with a comma, e.g. `>= 1.2, < 1.5`. From 53374dfff4ac7ce05cc87ed9e9b3006069c232a7 Mon Sep 17 00:00:00 2001 From: Mathieu Kniewallner Date: Sun, 19 Jun 2022 01:03:11 +0200 Subject: [PATCH 2/3] doc: move `Multiple requirements` under `Inequality requirements` --- docs/dependency-specification.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/dependency-specification.md b/docs/dependency-specification.md index 954945ef722..1e8aa7fd4d3 100644 --- a/docs/dependency-specification.md +++ b/docs/dependency-specification.md @@ -71,6 +71,10 @@ Here are some examples of inequality requirements: != 1.2.3 ``` +#### Multiple requirements + +Multiple version requirements can also be separated with a comma, e.g. `>= 1.2, < 1.5`. + ### Exact requirements You can specify the exact version of a package. @@ -80,10 +84,6 @@ You can specify the exact version of a package. This will tell Poetry to install this version and this version only. If other dependencies require a different version, the solver will ultimately fail and abort any install or update procedures. -### Multiple requirements - -Multiple version requirements can also be separated with a comma, e.g. `>= 1.2, < 1.5`. - ## `git` dependencies To depend on a library located in a `git` repository, From 51c975daae2f6b69c0e11b60f2ee1803d9586044 Mon Sep 17 00:00:00 2001 From: Mathieu Kniewallner Date: Sun, 19 Jun 2022 12:26:41 +0200 Subject: [PATCH 3/3] doc: detail a bit more `add` possibilities --- docs/cli.md | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/docs/cli.md b/docs/cli.md index 9b21685bf8d..8898a0c585f 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -288,18 +288,28 @@ poetry will choose a suitable one based on the available package versions. poetry add requests pendulum ``` -You also can specify a constraint when adding a package, like so: +You can also specify a constraint when adding a package: ```bash +# Allow >=2.0.5, <3.0.0 versions poetry add pendulum@^2.0.5 + +# Allow >=2.0.5, <2.1.0 versions +poetry add pendulum@~2.0.5 + +# Allow >=2.0.5 versions, without upper bound poetry add "pendulum>=2.0.5" -poetry add "pendulum==2.0.5" + +# Allow only 2.0.5 version +poetry add pendulum==2.0.5 ``` If you try to add a package that is already present, you will get an error. However, if you specify a constraint, like above, the dependency will be updated -by using the specified constraint. If you want to get the latest version of an already -present dependency you can use the special `latest` constraint: +by using the specified constraint. + +If you want to get the latest version of an already +present dependency, you can use the special `latest` constraint: ```bash poetry add pendulum@latest @@ -320,8 +330,7 @@ or use ssh instead of https: ```bash poetry add git+ssh://git@github.com/sdispater/pendulum.git -or alternatively: - +# or alternatively: poetry add git+ssh://git@github.com:sdispater/pendulum.git ``` @@ -332,8 +341,7 @@ you can specify it when using `add`: poetry add git+https://github.com/sdispater/pendulum.git#develop poetry add git+https://github.com/sdispater/pendulum.git#2.0.5 -or using SSH instead: - +# or using SSH instead: poetry add git+ssh://github.com/sdispater/pendulum.git#develop poetry add git+ssh://github.com/sdispater/pendulum.git#2.0.5 ```