-
Notifications
You must be signed in to change notification settings - Fork 98
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
Change signature of pairwise!
and colwise!
#239
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #239 +/- ##
==========================================
- Coverage 97.57% 92.69% -4.88%
==========================================
Files 8 8
Lines 865 520 -345
==========================================
- Hits 844 482 -362
- Misses 21 38 +17
☔ View full report in Codecov by Sentry. |
Distances uses the standard convention that the first argument is the one getting mutated. It doesn't feel worth changing this when it has been like this for so long. |
Yes, this is definitely a strong argument against changing any of these function signatures. The main motivation for this PR is that |
It's true that Given that there is no ambiguity, maybe we could allow both forms for some time? This is very similar to deprecating it, except that both would be mentioned in the docs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I completely missed this! Looks good, indeed the new order is consistent with map!
. Just a small remark about a missing test, given that it's essential existing code continues to work for a long time all arguments should be tested.
test/test_dists.jl
Outdated
rxy2 = similar(rxy) | ||
@test @test_deprecated(pairwise!(rxy2, dist, vecx, vecy)) ≈ rxy | ||
@test rxy2 ≈ rxy | ||
rxy3 = similar(rxy) | ||
@test pairwise!(dist, rxy3, vecx, vecy) ≈ rxy | ||
@test rxy3 ≈ rxy | ||
|
||
rxx2 = similar(rxx) | ||
@test @test_deprecated(pairwise!(rxx2, dist, vecx)) ≈ rxx | ||
@test rxx2 ≈ rxx | ||
rxx3 = similar(rxx) | ||
@test pairwise!(dist, rxx3, vecx) ≈ rxx | ||
@test rxx3 ≈ rxx |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also test passing dims
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These tests here are only for general arguments such as iterators or vectors of vectors. There are actually no tests of pairwise!
with dims
currently. I added them in c43e9dc.
Shall we finish this, release as v0.10.x, and subsequently merge #233 and release as v0.11.0? Potentially removing the deprecation warnings right away? Package maintainers will need to bump their |
Sorry, I missed the last few comments here. I added more tests (it seems currently |
I would vote for keeping the |
I'd say we can deprecate methods right away, as deprecations are not printed by default anyway so they won't annoy users in normal work. But as you prefer. What I wonder is how we should document these: should we attach a separate docstring to the methods, or add a note mentioning the deprecated argument order in the docstring for standard methods? Also, how about tagging 0.10.8 with deprecated methods first, and then tag 1.0 so that we can drop deprecated methods in 1.x (e.g. in a few years as there's no hurry)? |
@nalimilan I added docstrings to the deprecated methods. (Regarding releases, I think maybe we might want to merge and release some other outstanding PRs such as #246 first before making a breaking release. I guess it will take a while for a breaking release to be supported throughout the Julia ecosystem and it might be nice to spread goodies such as #246 a bit faster.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, but I'm a bit worried about the failing tests. They seem unrelated, but I couldn't find a way to run CI on master to confirm that.
I triggered CI in #250. |
Indeed the same test failures show up in #250 (and hence on the master branch). |
The weird thing is that I can't reproduce these test errors locally (Julia 1.9.1, clean environment). So I can't debug them locally. @nalimilan Good to go anyway? |
This API change is appreciated, but it breaks definitions of custom distances. |
The old syntax still exists and is only deprecated, so you can still call |
I've linked a PR with an example of |
This seems to be a bug, I should have updated the internal calls to |
This PR fixes #238 and deprecates
pairwise!(r, dist, a[, b])
in favour ofpairwise!(dist, r, a[, b])
which is consistent with StatsAPI and StatsBase.It seemed natural to keep
colwise!
consistent withpairwise!
, and hence I also deprecatedcolwise!(r, dist, a, b)
in favour ofcolwise!(dist, r, a, b)
.