Skip to content

Commit ce75c38

Browse files
radoeringSecrus
authored andcommitted
remove deprecated cli options and methods, revoke deprecation of --dev (python-poetry#9732)
1 parent c8f465c commit ce75c38

File tree

16 files changed

+6
-212
lines changed

16 files changed

+6
-212
lines changed

docs/cli.md

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,6 @@ the `--without` option.
158158
poetry install --without test,docs
159159
```
160160

161-
{{% note %}}
162-
The `--no-dev` option is now deprecated. You should use the `--only main` or `--without dev` notation instead.
163-
{{% /note %}}
164-
165161
You can also select optional dependency groups with the `--with` option.
166162

167163
```bash
@@ -262,7 +258,6 @@ poetry install --compile
262258
* `--extras (-E)`: Features to install (multiple values allowed).
263259
* `--all-extras`: Install all extra features (conflicts with --extras).
264260
* `--compile`: Compile Python source files to bytecode.
265-
* `--no-dev`: Do not install dev dependencies. (**Deprecated**, use `--only main` or `--without dev` instead)
266261
* `--remove-untracked`: Remove dependencies not presented in the lock file. (**Deprecated**, use `--sync` instead)
267262

268263
{{% note %}}
@@ -301,7 +296,6 @@ You can do this using the `add` command.
301296
* `--with`: The optional dependency groups to include.
302297
* `--only`: The only dependency groups to include.
303298
* `--dry-run` : Outputs the operations but will not execute anything (implicitly enables --verbose).
304-
* `--no-dev` : Do not update the development dependencies. (**Deprecated**, use `--only main` or `--without dev` instead)
305299
* `--lock` : Do not perform install (only update the lockfile).
306300
* `--sync`: Synchronize the environment with the locked packages and the specified groups.
307301

@@ -454,7 +448,7 @@ about dependency groups.
454448
### Options
455449

456450
* `--group (-G)`: The group to add the dependency to.
457-
* `--dev (-D)`: Add package as development dependency. (**Deprecated**, use `-G dev` instead)
451+
* `--dev (-D)`: Add package as development dependency. (shortcut for `-G dev`)
458452
* `--editable (-e)`: Add vcs/path dependencies as editable.
459453
* `--extras (-E)`: Extras to activate for the dependency. (multiple values allowed)
460454
* `--optional`: Add as an optional dependency to an extra.
@@ -487,7 +481,7 @@ about dependency groups.
487481
### Options
488482

489483
* `--group (-G)`: The group to remove the dependency from.
490-
* `--dev (-D)`: Removes a package from the development dependencies. (**Deprecated**, use `-G dev` instead)
484+
* `--dev (-D)`: Removes a package from the development dependencies. (shortcut for `-G dev`)
491485
* `--dry-run` : Outputs the operations but will not execute anything (implicitly enables --verbose).
492486
* `--lock`: Do not perform operations (only update the lockfile).
493487

@@ -524,7 +518,6 @@ required by
524518
* `--why`: When showing the full list, or a `--tree` for a single package, display whether they are a direct dependency or required by other packages.
525519
* `--with`: The optional dependency groups to include.
526520
* `--only`: The only dependency groups to include.
527-
* `--no-dev`: Do not list the dev dependencies. (**Deprecated**, use `--only main` or `--without dev` instead)
528521
* `--tree`: List the dependencies as a tree.
529522
* `--latest (-l)`: Show the latest version.
530523
* `--outdated (-o)`: Show the latest version but only for packages that are outdated.
@@ -807,7 +800,6 @@ group defined in `tool.poetry.dependencies` when used without specifying any opt
807800
Currently, only `constraints.txt` and `requirements.txt` are supported.
808801
* `--output (-o)`: The name of the output file. If omitted, print to standard
809802
output.
810-
* `--dev`: Include development dependencies. (**Deprecated**, use `--with dev` instead)
811803
* `--extras (-E)`: Extra sets of dependencies to include.
812804
* `--without`: The dependency groups to ignore.
813805
* `--with`: The optional dependency groups to include.

src/poetry/console/commands/add.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ class AddCommand(InstallerCommand, InitCommand):
4343
option(
4444
"dev",
4545
"D",
46-
"Add as a development dependency. (<warning>Deprecated</warning>) Use"
47-
" --group=dev instead.",
46+
"Add as a development dependency. (shortcut for '-G dev')",
4847
),
4948
option("editable", "e", "Add vcs/path dependencies as editable."),
5049
option(
@@ -129,10 +128,6 @@ def handle(self) -> int:
129128

130129
packages = self.argument("name")
131130
if self.option("dev"):
132-
self.line_error(
133-
"<warning>The --dev option is deprecated, "
134-
"use the `--group dev` notation instead.</warning>"
135-
)
136131
group = "dev"
137132
else:
138133
group = self.option("group", self.default_group or MAIN_GROUP)

src/poetry/console/commands/group_command.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from typing import TYPE_CHECKING
55

66
from cleo.helpers import option
7-
from poetry.core.packages.dependency_group import MAIN_GROUP
87

98
from poetry.console.commands.command import Command
109
from poetry.console.exceptions import GroupNotFoundError
@@ -82,18 +81,6 @@ def activated_groups(self) -> set[str]:
8281
}
8382
self._validate_group_options(groups)
8483

85-
for opt, new, group in [
86-
("no-dev", "only", MAIN_GROUP),
87-
("dev", "with", "dev"),
88-
]:
89-
if self.io.input.has_option(opt) and self.option(opt):
90-
self.line_error(
91-
f"<warning>The `<fg=yellow;options=bold>--{opt}</>` option is"
92-
f" deprecated, use the `<fg=yellow;options=bold>--{new} {group}</>`"
93-
" notation instead.</warning>"
94-
)
95-
groups[new].add(group)
96-
9784
if groups["only"] and (groups["with"] or groups["without"]):
9885
self.line_error(
9986
"<warning>The `<fg=yellow;options=bold>--with</>` and "

src/poetry/console/commands/install.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,6 @@ class InstallCommand(InstallerCommand):
1919

2020
options: ClassVar[list[Option]] = [
2121
*InstallerCommand._group_dependency_options(),
22-
option(
23-
"no-dev",
24-
None,
25-
"Do not install the development dependencies."
26-
" (<warning>Deprecated</warning>)",
27-
),
2822
option(
2923
"sync",
3024
None,
@@ -48,12 +42,6 @@ class InstallCommand(InstallerCommand):
4842
"Output the operations but do not execute anything "
4943
"(implicitly enables --verbose).",
5044
),
51-
option(
52-
"remove-untracked",
53-
None,
54-
"Removes packages not present in the lock file."
55-
" (<warning>Deprecated</warning>)",
56-
),
5745
option(
5846
"extras",
5947
"E",
@@ -145,14 +133,6 @@ def handle(self) -> int:
145133
self.installer.extras(extras)
146134

147135
with_synchronization = self.option("sync")
148-
if self.option("remove-untracked"):
149-
self.line_error(
150-
"<warning>The `<fg=yellow;options=bold>--remove-untracked</>` option is"
151-
" deprecated, use the `<fg=yellow;options=bold>--sync</>` option"
152-
" instead.</warning>"
153-
)
154-
155-
with_synchronization = True
156136

157137
self.installer.only_groups(self.activated_groups)
158138
self.installer.skip_directory(self.option("no-directory"))

src/poetry/console/commands/lock.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,6 @@ class LockCommand(InstallerCommand):
2323
"Ignore existing lock file"
2424
" and overwrite it with a new lock file created from scratch.",
2525
),
26-
option(
27-
"check",
28-
None,
29-
"Check that the <comment>poetry.lock</> file corresponds to the current"
30-
" version of <comment>pyproject.toml</>. (<warning>Deprecated</>) Use"
31-
" <comment>poetry check --lock</> instead.",
32-
),
3326
]
3427

3528
help = """
@@ -46,22 +39,6 @@ class LockCommand(InstallerCommand):
4639
loggers: ClassVar[list[str]] = ["poetry.repositories.pypi_repository"]
4740

4841
def handle(self) -> int:
49-
if self.option("check"):
50-
self.line_error(
51-
"<warning>poetry lock --check is deprecated, use `poetry"
52-
" check --lock` instead.</warning>"
53-
)
54-
if self.poetry.locker.is_locked() and self.poetry.locker.is_fresh():
55-
self.line("poetry.lock is consistent with pyproject.toml.")
56-
return 0
57-
self.line_error(
58-
"<error>"
59-
"Error: pyproject.toml changed significantly since poetry.lock was last generated. "
60-
"Run `poetry lock [--no-update]` to fix the lock file."
61-
"</error>"
62-
)
63-
return 1
64-
6542
self.installer.lock(update=self.option("regenerate"))
6643

6744
return self.installer.run()

src/poetry/console/commands/remove.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ class RemoveCommand(InstallerCommand):
3232
"dev",
3333
"D",
3434
"Remove a package from the development dependencies."
35-
" (<warning>Deprecated</warning>)"
36-
" Use --group=dev instead.",
35+
" (shortcut for '-G dev')",
3736
),
3837
option(
3938
"dry-run",
@@ -58,10 +57,6 @@ def handle(self) -> int:
5857
packages = self.argument("packages")
5958

6059
if self.option("dev"):
61-
self.line_error(
62-
"<warning>The --dev option is deprecated, "
63-
"use the `--group dev` notation instead.</warning>"
64-
)
6560
group = "dev"
6661
else:
6762
group = self.option("group", self.default_group)

src/poetry/console/commands/show.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,6 @@ class ShowCommand(GroupCommand, EnvCommand):
4444
]
4545
options: ClassVar[list[Option]] = [
4646
*GroupCommand._group_dependency_options(),
47-
option(
48-
"no-dev",
49-
None,
50-
"Do not list the development dependencies. (<warning>Deprecated</warning>)",
51-
),
5247
option("tree", "t", "List the dependencies as a tree."),
5348
option(
5449
"why",

src/poetry/console/commands/update.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,6 @@ class UpdateCommand(InstallerCommand):
2525
]
2626
options: ClassVar[list[Option]] = [
2727
*InstallerCommand._group_dependency_options(),
28-
option(
29-
"no-dev",
30-
None,
31-
"Do not update the development dependencies."
32-
" (<warning>Deprecated</warning>)",
33-
),
3428
option(
3529
"sync",
3630
None,

src/poetry/repositories/repository_pool.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from __future__ import annotations
22

33
import enum
4-
import warnings
54

65
from collections import OrderedDict
76
from dataclasses import dataclass
@@ -20,8 +19,6 @@
2019
from poetry.core.packages.dependency import Dependency
2120
from poetry.core.packages.package import Package
2221

23-
_SENTINEL = object()
24-
2522

2623
class Priority(IntEnum):
2724
# The order of the members below dictates the actual priority. The first member has
@@ -41,7 +38,6 @@ class RepositoryPool(AbstractRepository):
4138
def __init__(
4239
self,
4340
repositories: list[Repository] | None = None,
44-
ignore_repository_names: object = _SENTINEL,
4541
*,
4642
config: Config | None = None,
4743
) -> None:
@@ -57,15 +53,6 @@ def __init__(
5753
cache_dir=(config or Config.create()).artifacts_cache_directory
5854
)
5955

60-
if ignore_repository_names is not _SENTINEL:
61-
warnings.warn(
62-
"The 'ignore_repository_names' argument to 'RepositoryPool.__init__' is"
63-
" deprecated. It has no effect anymore and will be removed in a future"
64-
" version.",
65-
DeprecationWarning,
66-
stacklevel=2,
67-
)
68-
6956
@staticmethod
7057
def from_packages(packages: list[Package], config: Config | None) -> RepositoryPool:
7158
pool = RepositoryPool(config=config)

src/poetry/toml/file.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
from __future__ import annotations
22

3-
import warnings
4-
53
from typing import TYPE_CHECKING
6-
from typing import Any
74

85
from tomlkit.toml_file import TOMLFile as BaseTOMLFile
96

@@ -36,15 +33,5 @@ def read(self) -> TOMLDocument:
3633
except (ValueError, TOMLKitError) as e:
3734
raise TOMLError(f"Invalid TOML file {self.path.as_posix()}: {e}")
3835

39-
def __getattr__(self, item: str) -> Any:
40-
warnings.warn(
41-
"`__getattr__` will be removed from the `TOMLFile` in a future release."
42-
"\n\nInstead of accessing properties of the underlying `Path` as "
43-
"`tomlfile.whatever`, prefer `tomlfile.path.whatever`.",
44-
DeprecationWarning,
45-
stacklevel=2,
46-
)
47-
return getattr(self.__path, item)
48-
4936
def __str__(self) -> str:
5037
return self.__path.as_posix()

0 commit comments

Comments
 (0)