Skip to content

version 6.0.0 change of making Distribution an abstract class breaks some projects #422

@Psycojoker

Description

@Psycojoker

Hello,

As stated in the changelog:

#419: Declared Distribution as an abstract class, enforcing definition of abstract methods in instantiated subclasses. It's no longer possible to instantiate a Distribution or any subclasses unless they define the abstract methods.

Please comment in the issue if this change breaks any projects. This change will likely be rolled back if it causes significant disruption.

This change indeed breaks at least 2 projects (logilab.common and pytest-capture-deprecated-warnings). Both those projects are using importlib_metadata this way:

{x.metadata["Name"].lower(): x.metadata["Version"] for x in importlib_metadata.Distribution().discover()}

(this might not be the best way to use this lib)

While not having to use the 2 required methods:

TypeError: Can't instantiate abstract class Distribution with abstract methods locate_file, read_text

Those projects aren't very big in the python ecosystem and I'm the process of fixing them (by creating a subclass with the required methods) but since the changelog is asking for a report here it is.

Cheers and thx for your work ❤️

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions