Skip to content

Commit

Permalink
fix: add missing deprecation warning for --dev (#6475)
Browse files Browse the repository at this point in the history
`--dev` is marked as deprecated for both
[add](https://python-poetry.org/docs/cli/#options-4) and
[remove](https://python-poetry.org/docs/cli/#options-5) commands in the
documentation and emit a warning when used, but this is not reflected in
the CLI help messages.

I also took the occasion to update the documentation to suggest
replacements. Once backported, this would also require an update of the
1.2.0 blog post announcement, which doesn't mention those deprecations.

(cherry picked from commit 844a720)
  • Loading branch information
mkniewallner authored and github-actions[bot] committed Sep 12, 2022
1 parent 22741bb commit 1adb1b2
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
16 changes: 8 additions & 8 deletions docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,8 @@ poetry install --no-root
* `--dry-run`: Output the operations but do not execute anything (implicitly enables --verbose).
* `--extras (-E)`: Features to install (multiple values allowed).
* `--all-extras`: Install all extra features (conflicts with --extras).
* `--no-dev`: Do not install dev dependencies. (**Deprecated**)
* `--remove-untracked`: Remove dependencies not presented in the lock file. (**Deprecated**)
* `--no-dev`: Do not install dev dependencies. (**Deprecated**, use `--without dev` or `--only main` instead)
* `--remove-untracked`: Remove dependencies not presented in the lock file. (**Deprecated**, use `--sync` instead)

{{% note %}}
When `--only` is specified, `--with` and `--without` options are ignored.
Expand Down Expand Up @@ -271,7 +271,7 @@ update the constraint, for example `^2.3`. You can do this using the `add` comma
* `--with`: The optional dependency groups to include.
* `--only`: The only dependency groups to include.
* `--dry-run` : Outputs the operations but will not execute anything (implicitly enables --verbose).
* `--no-dev` : Do not update the development dependencies. (**Deprecated**)
* `--no-dev` : Do not update the development dependencies. (**Deprecated**, use `--without dev` or `--only main` instead)
* `--lock` : Do not perform install (only update the lockfile).

{{% note %}}
Expand Down Expand Up @@ -409,7 +409,7 @@ about dependency groups.
### Options

* `--group (-G)`: The group to add the dependency to.
* `--dev (-D)`: Add package as development dependency. (**Deprecated**)
* `--dev (-D)`: Add package as development dependency. (**Deprecated**, use `-G dev` instead)
* `--editable (-e)`: Add vcs/path dependencies as editable.
* `--extras (-E)`: Extras to activate for the dependency. (multiple values allowed)
* `--optional`: Add as an optional dependency.
Expand Down Expand Up @@ -442,13 +442,13 @@ about dependency groups.
### Options

* `--group (-G)`: The group to remove the dependency from.
* `--dev (-D)`: Removes a package from the development dependencies. (**Deprecated**)
* `--dev (-D)`: Removes a package from the development dependencies. (**Deprecated**, use `-G dev` instead)
* `--dry-run` : Outputs the operations but will not execute anything (implicitly enables --verbose).


## show

To list all of the available packages, you can use the `show` command.
To list all the available packages, you can use the `show` command.

```bash
poetry show
Expand Down Expand Up @@ -478,7 +478,7 @@ required by
* `--why`: When showing the full list, or a `--tree` for a single package, display why a package is included.
* `--with`: The optional dependency groups to include.
* `--only`: The only dependency groups to include.
* `--no-dev`: Do not list the dev dependencies. (**Deprecated**)
* `--no-dev`: Do not list the dev dependencies. (**Deprecated**, use `--without dev` or `--only main` instead)
* `--tree`: List the dependencies as a tree.
* `--latest (-l)`: Show the latest version.
* `--outdated (-o)`: Show the latest version but only for packages that are outdated.
Expand Down Expand Up @@ -689,7 +689,7 @@ group defined in `tool.poetry.dependencies` when used without specifying any opt
Currently, only `requirements.txt` is supported.
* `--output (-o)`: The name of the output file. If omitted, print to standard
output.
* `--dev`: Include development dependencies. (**Deprecated**)
* `--dev`: Include development dependencies. (**Deprecated**, use `--with dev` instead)
* `--extras (-E)`: Extra sets of dependencies to include.
* `--without`: The dependency groups to ignore.
* `--with`: The optional dependency groups to include.
Expand Down
6 changes: 5 additions & 1 deletion src/poetry/console/commands/add.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ class AddCommand(InstallerCommand, InitCommand):
flag=False,
default=MAIN_GROUP,
),
option("dev", "D", "Add as a development dependency."),
option(
"dev",
"D",
"Add as a development dependency. (<warning>Deprecated</warning>)",
),
option("editable", "e", "Add vcs/path dependencies as editable."),
option(
"extras",
Expand Down
7 changes: 6 additions & 1 deletion src/poetry/console/commands/remove.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ class RemoveCommand(InstallerCommand):
arguments = [argument("packages", "The packages to remove.", multiple=True)]
options = [
option("group", "G", "The group to remove the dependency from.", flag=False),
option("dev", "D", "Remove a package from the development dependencies."),
option(
"dev",
"D",
"Remove a package from the development dependencies."
" (<warning>Deprecated</warning>)",
),
option(
"dry-run",
None,
Expand Down

0 comments on commit 1adb1b2

Please sign in to comment.