[SciPy-Dev] cKDTree deprecation?

Ralf Gommers ralf.gommers at gmail.com
Sat Mar 13 11:14:56 EST 2021


On Sat, Mar 13, 2021 at 4:57 PM Andras Deak <deak.andris at gmail.com> wrote:

> Hi All,
>
> I ran into the doc issue that there's no guidance to choose between
> `KDTree` and `cKDTree` in spatial (in either docstrings or at
>
> https://docs.scipy.org/doc/scipy/reference/spatial.html#nearest-neighbor-queries
> ).
> I plan to fix this in the documentation, but from the brief feedback I
> got when I asked on a related issue [1] I wonder if we should do more?
>
> As of November 2020 [2] the two classes have identical APIs, and
> `KDTree` seems to be a thin wrapper around `cKDTree`. The long-term
> plan is to remove the `cKDTree` name. Should we take steps now to
> deprecate `cKDTree`? I don't know if anything else is needed for
> proper deprecation, and it also seems to me that
> `PendingDeprecationWarning`s are not a thing in scipy. At least we
> should add a note that says that `cKDTree` might be removed in a
> future version.
>

We on purpose didn't deprecate cKDTree yet, because KDTree only recently
became fully equivalent and we don't want users to have to write:
if scipy.__version__ < 1.6.0:
   KDTree = spatial.cKDTree
else:
  KDTree = spatial.KDTree

PendingDeprecationWarning is not all that helpful either, because it has
the same issue - quite a few libraries have (or should have) a "zero
warnings" rule in their test suite.

I'd suggest adding the doc note now, and then we do the deprecation in 2-3
releases from now.

Cheers,
Ralf




> Cheers,
>
> András
>
> [1]: https://github.com/scipy/scipy/issues/8923#issuecomment-796924434
> [2]: https://github.com/scipy/scipy/pull/12852
> _______________________________________________
> SciPy-Dev mailing list
> SciPy-Dev at python.org
> https://mail.python.org/mailman/listinfo/scipy-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/scipy-dev/attachments/20210313/eb1ce3e7/attachment.html>


More information about the SciPy-Dev mailing list