On Python 3.7+ environments, use the builtin dataclasses module instead
of shadowing it. This is handled in the dataclasses/init.py which
sets the module in sys.modules.
This allows projects to pin dependencies that are then run in both
Python 3.6 and 3.7+ environments using tools such as pip-tools.
Previously, if dependencies were pinned for Python 3.6, the dataclasses
would be used, but fail to install on Python 3.7+ environments. On the
other hand, if dependencies were pinned for Python 3.7+, dataclasses
would not be available in Python 3.6 environments.
Projects typically pin dependencies using the oldest supported Python.
dataclasses has recently become a dependency of the popular tool Black,
which is how this issue was discovered.
On Python 3.7+ environments, use the builtin dataclasses module instead of shadowing it. This is handled in the dataclasses/init.py which sets the module in sys.modules.
This allows projects to pin dependencies that are then run in both Python 3.6 and 3.7+ environments using tools such as pip-tools.
Previously, if dependencies were pinned for Python 3.6, the dataclasses would be used, but fail to install on Python 3.7+ environments. On the other hand, if dependencies were pinned for Python 3.7+, dataclasses would not be available in Python 3.6 environments.
Projects typically pin dependencies using the oldest supported Python.
dataclasses has recently become a dependency of the popular tool Black, which is how this issue was discovered.
Fixes #153