diff --git a/src/poetry/core/packages/package.py b/src/poetry/core/packages/package.py index b127cceeb..e9ff06e28 100644 --- a/src/poetry/core/packages/package.py +++ b/src/poetry/core/packages/package.py @@ -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 @@ -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(