klen / mixer

Mixer -- Is a fixtures replacement. Supported Django, Flask, SqlAlchemy and custom python objects.
Other
939 stars 96 forks source link

Incompatible with latest version of Faker (`12.1.0`) #145

Closed mtilda closed 2 years ago

mtilda commented 2 years ago

Using the latest version of Faker (12.1.0) raises the following exception:

AttributeError: type object 'Factory' has no attribute '_get_provider_class'

The latest version of Faker (published 11 hours ago) removed the method "_get_provider_class".

This package uses _get_provider_class here: https://github.com/klen/mixer/blob/39ef3b717d4ac9da1824cb9c242fd326fa00ba08/mixer/_faker.py#L33

Disallowing the latest version of Faker seems to fix the problem.

gmmcal commented 2 years ago

_get_provider_class was renamed to _find_provider_class https://github.com/joke2k/faker/commit/60f0941a80519ff9106ec1b4dcffcbc7e23139e5

omerfarukabaci commented 2 years ago

In any case, I think Faker dependency should be pinned to a specific version.

mtilda commented 2 years ago

_get_provider_class was renamed to _find_provider_class joke2k/faker@60f0941

@gmmcal Slightly more than renamed... _get_provider_class previously used _find_provider_class.

The return values for those methods are slightly different, and the logic for handling localization changed.

Not sure if the change in localization logic will impact the behavior of Mixer in a negative way, as I am unfamiliar with Mixer's source code.

gmmcal commented 2 years ago

good point @mtilda. internally, call to old method was replaced by new one. imo, it is a bad decision to use a "private" method from Faker here, but that change requires a bigger refactoring that goes beyond scope of our conversation.

I'm also unfamiliar with code of mixer. I got issues updating dependencies of an application due to this bug.