Skip to content

Drop support for Numpy 1.12. #84

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jan 27, 2018

Conversation

hameerabbasi
Copy link
Collaborator

@hameerabbasi hameerabbasi commented Jan 19, 2018

  • Drop Numpy 1.12 support
  • Implement all operators via NDArrayOperatorsMixin.
  • Support for scipy.sparse.spmatrix operations from the left (mostly).
  • Raise TypeError for __array__.

@hameerabbasi
Copy link
Collaborator Author

hameerabbasi commented Jan 19, 2018

Closes #81 as wontfix.

Edit: #81 will now be closed as fixed.

@hameerabbasi
Copy link
Collaborator Author

In addition, closes #78 as wontfix.

@hameerabbasi
Copy link
Collaborator Author

I've updated this PR with the excellent suggestions from @njsmith.

@nils-werner @mrocklin Nice if you gave it a look.

@hameerabbasi hameerabbasi changed the title Nd array operators mixin Drop support for scipy.sparse ops and Numpy 1.12. Jan 19, 2018
@nils-werner
Copy link
Contributor

nils-werner commented Jan 19, 2018

This is a radical change and needs a proper code review, but it would be a very sleek solution, if no issues pop up.

Also, it should warrant a major version bump, as it is pretty backwards-incompatible :-)

@mrocklin
Copy link
Contributor

I agree with @nils-werner that this is sleek.

The dependence on 1.13 is interesting. I'm fine going forward with this, but we might want to release before we merge, just so we can point people not yet on latest numpy to that version.

Also, it should warrant a major version bump, as it is pretty backwards-incompatible :-)

We haven't released in a good long while. I'll add this (and instructions) to my TODO list if no one has objections.

@hameerabbasi
Copy link
Collaborator Author

hameerabbasi commented Jan 19, 2018

Here's what I propose (in no particular order):

Even if we do the latter first, we can always make a 0.2 branch from the previous commit. Git is awesome that way. :)

@mrocklin
Copy link
Contributor

Any objection to merging #72 to master, releasing, and then merging this one on top of it? I have a slight desire to keep releases in the mainline history. Happy either way though. I'd also be happy if you wanted to just skip directly to dropping numpy 1.13.

@hameerabbasi
Copy link
Collaborator Author

hameerabbasi commented Jan 23, 2018

Releases will diverge from mainline history if we make backwards incompatible changes (as we are doing here) and then have to fix bugs in old releases. This is the reason why I would prefer any backwards-incompatible changes happen on master and the older version be in a separate branch.

This applies particularly to this PR and #72 because we're effectively undoing #72 by merging this, and it makes more sense to me intuitively that they should be in separate branches.

However, I would still prefer to release with #72 merged for the reason that not only are we dropping support for Numpy 1.12 (I have no problem with that part), but we're also dropping support for inter-compatibility with scipy.sparse and requiring that all objects be explicitly converted to COO before any operations.

Edit:

skip directly to dropping numpy 1.13.

I assume that's a typo. We're dropping Numpy 1.12, not 1.13. I'm not in favor of dropping old versions as soon as new ones come out. ;-)

@hameerabbasi hameerabbasi force-pushed the NDArrayOperatorsMixin branch from e593fa9 to 141a025 Compare January 23, 2018 15:15
@hameerabbasi
Copy link
Collaborator Author

I personally am fine with both, releasing with #72 or this PR. I don't know if if you have reservations, though. Because dropping Numpy 1.12 support only requires users to update Numpy, dropping scipy.sparse inter-op requires... well... Rewriting code.

@mrocklin
Copy link
Contributor

This applies particularly to this PR and #72 because we're effectively undoing #72 by merging this, and it makes more sense to me intuitively that they should be in separate branches.

I'm totally fine having a commit in mainline history than we undo in a subsequent commit.

However, I would still prefer to release with #72 merged for the reason that not only are we dropping support for Numpy 1.12 (I have no problem with that part), but we're also dropping support for inter-compatibility with scipy.sparse and requiring that all objects be explicitly converted to COO before any operations.

Hrm, I hadn't realized the change with support for scipy.sparse. Is this critical to achieve the nice refactor that you have here? Was it desired?

@mrocklin
Copy link
Contributor

I assume that's a typo. We're dropping Numpy 1.12, not 1.13. I'm not in favor of dropping old versions as soon as new ones come out. ;-)

Not a typo, just me being distracted and forgetting which versions of Numpy are out :)

@hameerabbasi hameerabbasi changed the title Drop support for scipy.sparse ops and Numpy 1.12. Drop support for Numpy 1.12. Jan 25, 2018
@hameerabbasi
Copy link
Collaborator Author

hameerabbasi commented Jan 25, 2018

I'm totally fine having a commit in mainline history than we undo in a subsequent commit.

In that case, we should be good.

Hrm, I hadn't realized the change with support for scipy.sparse. Is this critical to achieve the nice refactor that you have here? Was it desired?

I added it back, I realized it was too drastic. In any case, supporting scipy.sparse operator COO seems to be a hit-and-miss. add and sub works fine, but mul tries to densify and lt/gt/ne all raise TypeErrors. We should document, at the very least, that it is recommended to convert all arrays to COO before starting.

See tests for details.

Edit: This happens regardless of this change.

@mrocklin
Copy link
Contributor

mrocklin commented Jan 25, 2018 via email

@mrocklin
Copy link
Contributor

mrocklin commented Jan 25, 2018 via email

@hameerabbasi hameerabbasi force-pushed the NDArrayOperatorsMixin branch from a68fde7 to 5ccdbaa Compare January 25, 2018 15:41
@hameerabbasi
Copy link
Collaborator Author

This seems okay to merge from my side.

@hameerabbasi
Copy link
Collaborator Author

hameerabbasi commented Jan 26, 2018

I removed calls of the form COO.ufunc because np.ndarray doesn't have them either. np.ufunc(COO, ...) still works because of the all-powerful __array_ufunc__.

@hameerabbasi
Copy link
Collaborator Author

Also, it should warrant a major version bump, as it is pretty backwards-incompatible :-)

We're only dropping support for Numpy 1.12. Scipy.sparse inter-op has been added back. This slims down our code quite a bit.

@hameerabbasi
Copy link
Collaborator Author

I think this is ready for a code review + merge. :-)

@mrocklin mrocklin merged commit 731c06a into pydata:master Jan 27, 2018
@hameerabbasi hameerabbasi deleted the NDArrayOperatorsMixin branch January 27, 2018 14:31
hameerabbasi added a commit to hameerabbasi/sparse that referenced this pull request Feb 27, 2018
* Add tests for scipy spmatrices from the left.

* Fix failing tests.

* Update docs.

* Add back pure Python abs support.

* Drop Scipy op support

* Add Scipy sparse support back.

* Update docs.

* Remove most .ufunc calls since Numpy doesn't have them.

* Update docs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants