Skip to content

Redundant abstractmethod run in setuptools.command.setopt.option_base#4549

Merged
abravalheri merged 1 commit intopypa:mainfrom
Avasam:setuptools-abstract-base-classes-and-methods
Aug 9, 2024
Merged

Redundant abstractmethod run in setuptools.command.setopt.option_base#4549
abravalheri merged 1 commit intopypa:mainfrom
Avasam:setuptools-abstract-base-classes-and-methods

Conversation

@Avasam
Copy link
Copy Markdown
Contributor

@Avasam Avasam commented Aug 8, 2024

Summary of changes

@abravalheri I noticed this abstractmethod was redundant (doesn't break anything) by marking the class as ABC after #4503 was merged

Pull Request Checklist

@abravalheri
Copy link
Copy Markdown
Contributor

Should we also remove the ABC from the definition class option_base(Command, ABC), as command is now already an ABC? Or is it left there intentionally (to make it more explicit)?

@Avasam
Copy link
Copy Markdown
Contributor Author

Avasam commented Aug 9, 2024

Should we also remove the ABC from the definition class option_base(Command, ABC), as command is now already an ABC? Or is it left there intentionally (to make it more explicit)?

It's there explicitly.
When subclassing a class with abstract methods, type-checkers will remind you to implement all its abstract methods. Unless you mark it with ABC (or meta=ABCMeta, same thing) where it'll inherit the "Abstract" state of the parent class.

In other words, either option_base adds all 3 abstract methods, or it submetaclasses ABCMeta.

@abravalheri abravalheri merged commit a6f7484 into pypa:main Aug 9, 2024
@abravalheri
Copy link
Copy Markdown
Contributor

Thank you!

@Avasam Avasam deleted the setuptools-abstract-base-classes-and-methods branch August 9, 2024 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants