Skip to content

Commit ba1994f

Browse files
committed
Reordered --without-markers flag to appear last for consistency with internal argument handling.
1 parent 708ced2 commit ba1994f

2 files changed

Lines changed: 14 additions & 20 deletions

File tree

src/poetry_plugin_export/command.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,12 @@
44
from typing import TYPE_CHECKING
55

66
from cleo.helpers import option
7-
from packaging.utils import NormalizedName
8-
from packaging.utils import canonicalize_name
7+
from packaging.utils import NormalizedName, canonicalize_name
98
from poetry.console.commands.group_command import GroupCommand
109
from poetry.core.packages.dependency_group import MAIN_GROUP
1110

1211
from poetry_plugin_export.exporter import Exporter
1312

14-
1513
if TYPE_CHECKING:
1614
from collections.abc import Iterable
1715

@@ -21,10 +19,6 @@ class ExportCommand(GroupCommand):
2119
description = "Exports the lock file to alternative formats."
2220

2321
options = [ # noqa: RUF012
24-
option("without-markers",
25-
None,
26-
"Include markers in the exported file (default - True).",
27-
flag=True),
2822
option(
2923
"format",
3024
"f",
@@ -79,6 +73,10 @@ class ExportCommand(GroupCommand):
7973
),
8074
option("all-extras", None, "Include all sets of extra dependencies."),
8175
option("with-credentials", None, "Include credentials for extra indices."),
76+
option("without-markers",
77+
None,
78+
"Include markers in the exported file (default - True).",
79+
flag=True),
8280
]
8381

8482
@property
@@ -161,12 +159,12 @@ def handle(self) -> int:
161159
)
162160

163161
exporter = Exporter(self.poetry, self.io)
164-
exporter.with_markers(not without_markers)
165162
exporter.only_groups(list(groups))
166163
exporter.with_extras(list(extras))
167164
exporter.with_hashes(not self.option("without-hashes"))
168165
exporter.with_credentials(self.option("with-credentials"))
169166
exporter.with_urls(not self.option("without-urls"))
167+
exporter.with_markers(not without_markers)
170168
exporter.export(fmt, Path.cwd(), output or self.io)
171169

172170
return 0

src/poetry_plugin_export/exporter.py

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

33
import urllib.parse
4-
54
from functools import partialmethod
65
from typing import TYPE_CHECKING
76

@@ -11,13 +10,11 @@
1110
from poetry.core.version.markers import parse_marker
1211
from poetry.repositories.http_repository import HTTPRepository
1312

14-
from poetry_plugin_export.walker import get_project_dependency_packages
15-
from poetry_plugin_export.walker import get_project_dependency_packages2
16-
13+
from poetry_plugin_export.walker import (get_project_dependency_packages,
14+
get_project_dependency_packages2)
1715

1816
if TYPE_CHECKING:
19-
from collections.abc import Collection
20-
from collections.abc import Iterable
17+
from collections.abc import Collection, Iterable
2118
from pathlib import Path
2219
from typing import ClassVar
2320

@@ -73,17 +70,16 @@ def with_hashes(self, with_hashes: bool = True) -> Exporter:
7370

7471
return self
7572

76-
def with_markers(self, with_markers: bool = True) -> Exporter:
77-
# This is a no-op for now, but we can implement it in the future
78-
# if needed.
79-
self._with_markers = with_markers
80-
return self
81-
8273
def with_credentials(self, with_credentials: bool = True) -> Exporter:
8374
self._with_credentials = with_credentials
8475

8576
return self
8677

78+
def with_markers(self, with_markers: bool = True) -> Exporter:
79+
self._with_markers = with_markers
80+
81+
return self
82+
8783
def export(self, fmt: str, cwd: Path, output: IO | str) -> None:
8884
if not self.is_format_supported(fmt):
8985
raise ValueError(f"Invalid export format: {fmt}")

0 commit comments

Comments
 (0)