lovasoa / marshmallow_dataclass

Automatic generation of marshmallow schemas from dataclasses.
https://lovasoa.github.io/marshmallow_dataclass/html/marshmallow_dataclass.html
MIT License
456 stars 78 forks source link

Replace marshmallow-enum with native marshmallow.fields.Enum #227

Closed otonnesen closed 1 year ago

otonnesen commented 1 year ago

Addresses https://github.com/lovasoa/marshmallow_dataclass/issues/225

dairiki commented 1 year ago

The CI test is failing under python 3.6.

Support for python 3.6 was dropped in marshmallow 3.15 (and Enum support was only added in marshmallow 3.18.)

Two options (perhaps there are others) appear to be:

mivade commented 1 year ago

Python 3.6 reached its end of life over a year ago now. I think it would make sense to drop support for it.

otonnesen commented 1 year ago

In the interest of keeping this diff self-contained, I'll just add the extra code to keep python 3.6 support as you mentioned. I can open another PR to discuss dropping 3.6 support as well if we like.

dairiki commented 1 year ago

Python 3.6 reached its end of life over a year ago now. I think it would make sense to drop support for it.

I do not disagree, however, the last time this came up, @lovasoa wanted to maintain 3.6 support, citing the number of weekly downloads. Since then, download numbers have dropped a bit, but not substantially.

image

One option might be to bump our minor version number, dropping support for py 3.6 in the new version, and maintain two branches (an 8.5.x that supports py3.6, and an 8.6.x which does not).

But, as long as it's not too painful to maintain 3.6 support in the current codebase, it's probably cleaner and less work just to do so.

dairiki commented 1 year ago

@otonnesen Would it be worthwhile (and actually work) to make the [enum] extra conditional on python version?

E.g., in setup.py:

EXTRAS_REQUIRE = {
    "enum": [
        "marshmallow-enum; python_version<'3.7'",
        "marshmallow>=3.18; python_version>='3.7'",
    ],
    ...
}
dairiki commented 1 year ago

@otonnesen Would it be worthwhile (and actually work) to make the [enum] extra conditional on python version?

Never mind. I see you just did that! :laughing:

otonnesen commented 1 year ago

Yeah just tested on 3.6 and 3.10 and it does appear to work as I'd expect

dairiki commented 1 year ago

Will wait for further comments for a couple of days before merging, but LGTM. Thank you @otonnesen!

lovasoa commented 1 year ago

Good for me!

dairiki commented 1 year ago

Released, just now, in 8.5.11. Thank you, @otonnesen!