Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deprecate package.category #561

Merged
merged 1 commit into from
Apr 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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