pydata / patsy

Describing statistical models in Python using symbolic formulas
Other
947 stars 103 forks source link

MAINT: Reorder imports to avoid deprecation warning importing Mapping from collections. #165

Closed jeroenbouwman closed 3 years ago

jeroenbouwman commented 3 years ago

Line 13 (from collections import Mapping) in constraint.py gives the following warning for python versions > 3.3:

DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.9 it will stop working

A change on line 13 in constraint.py from:

from collections import Mapping

to:

from collections.abc import Mapping

should fix this and makes sure that patsy also works with python 3.9

bashtage commented 3 years ago

This is already handeled with a try except.

https://github.com/pydata/patsy/blob/4c613d0ad3009044ca3aee5a5d70bd56af8f396b/patsy/constraint.py#L12-L16

dengf commented 3 years ago

Hi, I Bashtage-

I noticed that the released 0.5.1 version contraint.py does not include the try except while it is included in the master branch.

bashtage commented 3 years ago

statsmodels tests on Python 3.9 against patsy 0.5.1. It seems to work find so I don't see any needs for a rush to change anything.

https://dev.azure.com/statsmodels/statsmodels-testing/_build/results?buildId=3033&view=logs&j=3f9beef4-2a87-5b9a-d136-eeaf4b842580&t=d7fee839-a503-5b05-b0a4-5008c56e73a3

ns-admetrics commented 3 years ago

It's a bit unfortunate to say one sees no need for a rush to fix an issue that has been around since Python 3.3, in a project that hasn't seen a release in over two years.

All you'd seem to need to do here is to release an 0.5.2 with the fix (which already exists), no?

Samreay commented 3 years ago

Given the fix is already on master, is it possible to make a release as suggested? Even if it runs at the moment, patsy does cause deprecation warnings to be logged in projects which have it as a dependency.

bashtage commented 3 years ago

As far as I know on @njsmith can post a new release to PyPI.

danschef commented 3 years ago

Any chance to get a new release soon?

ivirshup commented 3 years ago

Since the warning is now:

DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.10 it will stop working

And 3.10 is out in beta, it would be really good if this could get updated soon so downstream packages can work in python 3.10. If @njsmith isn't available, could someone from the pydata organization step in and make a release?

jkklapp commented 3 years ago

Bump

Nieju commented 3 years ago

Please fix!

samlovestech commented 3 years ago

It seems nobody is maintaining this package? the latest release is from 2018.... this error is impacting all the downstream packages.....

matthewwardrop commented 3 years ago

Greetings!

A month or so ago I inherited the maintenance of this package, which is now feature frozen as I wrap up the mostly feature-complete replacement Formulaic, of which I am also the maintainer. My plan is to fix issues like these ones so that users who are content with patsy can continue to rely upon it. I'll clean up a few more loose ends and then put out a new release.

matthewwardrop commented 3 years ago

Okay... I've pushed out 0.5.2 with this small change, and cleaned up the CI testing.