Skip to content

cleanup: drop Python 3.6 and adopt dataclasses #5725

@nfelt

Description

@nfelt

We should consider dropping Python 3.6 support (i.e. bump this line).

Internally, we've been on 3.7 for a while and recently moved to 3.9. In open source, 3.6 is already end-of-lifed as of the end of 2021: https://peps.python.org/pep-0494/#lifespan

Dropping 3.6 will let us start using 3.7-only features, of which the most useful would be dataclasses: https://docs.python.org/3.7/library/dataclasses.html

There are a number of classes in the codebase that could be converted to dataclasses for a more compact definition and less boilerplate, including:

One possible tradeoff is that dataclasses with default values for any properties don't support __slots__ until 3.10: https://stackoverflow.com/questions/50180735/how-can-dataclasses-be-made-to-work-better-with-slots/69661861#69661861 But many of our existing classes don't use defaults anyway, and for those that do, they might not really need to use __slots__.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions