Skip to content

Commit

Permalink
deprecate package.category (#561)
Browse files Browse the repository at this point in the history
  • Loading branch information
dimbleby authored Apr 10, 2023
1 parent 855e87b commit 8180576
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions src/poetry/core/packages/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ def __init__(

self._dependency_groups: dict[str, DependencyGroup] = {}

# For compatibility with previous version, we keep the category
self.category = "main"
# Category is heading towards deprecation.
self._category = "main"
self.files: list[dict[str, str]] = []
self.optional = False

Expand Down Expand Up @@ -374,6 +374,24 @@ def urls(self) -> dict[str, str]:

return urls

@property
def category(self) -> str:
warnings.warn(
"`category` is deprecated and will be removed in a future release.",
DeprecationWarning,
stacklevel=2,
)
return self._category

@category.setter
def category(self, category: str) -> None:
warnings.warn(
"Setting `category` is deprecated and will be removed in a future release.",
DeprecationWarning,
stacklevel=2,
)
self._category = category

@property
def readme(self) -> Path | None:
warnings.warn(
Expand Down

0 comments on commit 8180576

Please sign in to comment.