$npx skillfedfor your agent

kdtree

A Python implemntation of a kd-tree

With conditionsPyPI LibrariesReleased Oct 201778.2K downloads / moISC licensePure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — kdtree-0.16-py2.py3-none-any.whl
v0.16 · released 2017-10-19

Yes, if you need a lightweight, dependency-free kd-tree for nearest-neighbor queries in Python. The package is stable (ISC-licensed, no known vulnerabilities) and suitable for small to medium datasets. However, the last release was 2017-10-19 and maintenance is aging; for production use at scale or with modern Python versions, verify compatibility and consider whether a more actively maintained alternative (such as scipy.spatial.KDTree) better fits your needs.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Low install friction; pure Python wheel.
  • Maintenance is aging—last release was 2017-10-19 and last commit 2025-05-27, so the codebase is stable but not actively developed.
  • No runtime dependencies.

License · maintenance · safety

ISC license (permissive) — ISC license is permissive; you can use, modify, and distribute this package with minimal restrictions, including in commercial software.

last release 2017-10-19 (3221 days) · last repo commit 2025-05-27 · 381 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 78,179 downloads/mo, #14,464 on PyPI

Verify before relying

import kdtree

# Create tree from list of points (tuples, lists, or indexable objects)
tree = kdtree.create([(2, 3, 4), (4, 5, 6), (5, 3, 2)])

# Find nearest neighbor to point (1, 2, 3)
nearest = tree.search_nn((1, 2, 3))

# Add and remove points
tree.add((5, 4, 3))
tree = tree.remove((5, 4, 3))
  • Whether the package is actively maintained or if aging status poses a risk for future Python versions
  • Performance characteristics (insertion/search time complexity) for large datasets
  • Whether rebalancing is automatic or must be called manually to maintain tree efficiency
Same gist for agents: .md · .json

What it is and what it does

kdtree is a pure-Python implementation of kd-trees, a data structure that partitions points in k-dimensional space to accelerate spatial queries. It lets you build a tree from any collection of indexable objects (tuples, lists, namedtuples, or custom classes that support indexing), then search for the nearest neighbor to any query point in logarithmic time. The tree supports standard operations: insertion, deletion, traversal (inorder and level-order), and rebalancing.

You'd use this when you need to find the closest point(s) in a dataset to a given location—common in machine learning, computational geometry, clustering, and spatial analysis. The package is straightforward: create a tree, add or remove points as needed, and query for nearest neighbors. It handles any number of dimensions and works with any objects that look like tuples to the tree, so you can attach metadata (a payload) to each point without needing a separate index.

Use it for

  • Find the nearest landmark, location, or object in a spatial dataset given a query coordinate
  • Implement k-nearest-neighbor search for machine learning or clustering algorithms
  • Build a spatial index for collision detection or proximity queries in games or simulations
  • Store and query multi-dimensional data (e.g., feature vectors) with fast nearest-neighbor lookup
  • Attach metadata to spatial points and retrieve both the point and its associated data in one query

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

With conditions

Yes, if you need a lightweight, dependency-free kd-tree for nearest-neighbor queries in Python.

The package is stable (ISC-licensed, no known vulnerabilities) and suitable for small to medium datasets. However, the last release was 2017-10-19 and maintenance is aging; for production use at scale or with modern Python versions, verify compatibility and consider whether a more actively maintained alternative (such as scipy.spatial.KDTree) better fits your needs.

Install

kdtree on PyPI

Before you install

Low install friction; pure Python wheel. Maintenance is aging—last release was 2017-10-19 and last commit 2025-05-27, so the codebase is stable but not actively developed. No runtime dependencies.

License in practice

ISC license is permissive; you can use, modify, and distribute this package with minimal restrictions, including in commercial software.

Quickstart

import kdtree

# Create tree from list of points (tuples, lists, or indexable objects)
tree = kdtree.create([(2, 3, 4), (4, 5, 6), (5, 3, 2)])

# Find nearest neighbor to point (1, 2, 3)
nearest = tree.search_nn((1, 2, 3))

# Add and remove points
tree.add((5, 4, 3))
tree = tree.remove((5, 4, 3))

Verify before relying

  • Whether the package is actively maintained or if aging status poses a risk for future Python versions
  • Performance characteristics (insertion/search time complexity) for large datasets
  • Whether rebalancing is automatic or must be called manually to maintain tree efficiency

Package facts

LicenseISC license permissive
Python supportNot specified
Install frictionLow. Pure-Python wheel
Runtime dependenciesNone
MaintenanceAging 3,221 days since the last release
Last repo commit
First released
Downloads78,179 / month, #14,464 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: ISC License (ISCL)Operating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 2Programming Language :: Python :: 2.6Programming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.3Programming Language :: Python :: 3.4Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: LibrariesTopic :: Utilities

Evidence: kdtree-0.16-py2.py3-none-any.whl

Tags

Capabilities
kd-tree nearest neighbor searchspatial indexing pythonmultidimensional point searchkdtree construction and querynearest point lookupspatial data structurek-dimensional tree
Topics
spatial-indexingnearest-neighbordata-structures

Let your AI agent find packages like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.

wish › “kd-tree nearest neighbor search”

  • kdtreeConstructs, modifies, and searches kd-trees—spatial data structures…
  • pynndescentPyNNDescent builds approximate nearest neighbor search indexes using…
  • cuvs-cu12Provides GPU-accelerated approximate nearest neighbor search and…

Give your agent the search over MCP, or paste the wish link into any chat.

More Libraries packages

urllib3 Worth it
PyPI · Libraries · released May 2026

urllib3 is an HTTP client library that provides thread-safe connection pooling, SSL/TLS verification, multipart file uploads, request retries, compression support, and proxy handling for Python applications.

MITpure Python · 3.10+
1.8Bdownloads / mo
requests Worth it
PyPI · Libraries · released May 2026

Requests is a Python HTTP library that simplifies sending HTTP/1.1 requests with automatic handling of headers, authentication, cookies, and response parsing.

Apache-2.0pure Python · 3.10+
1.8Bdownloads / mo
pluggy Worth it
PyPI · Libraries · released May 2025

Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.

Install it if you're building an extensible application or framework.

MITpure Python · 3.9+aging
1.3Bdownloads / mo
python-dateutil Worth it
PyPI · Libraries · released Mar 2024

Provides parsing, arithmetic, and recurrence rule computation for dates and times, with timezone support and iCalendar RFC compliance.

Install it if you need to parse flexible date strings, compute relative dates, handle timezones, or work with recurrence rules—it's the de facto choice for these tasks.

Apache-2.0pure Python
1.2Bdownloads / mo
six With conditions
PyPI · Libraries · released Dec 2024

Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.

MITpure Python
1.2Bdownloads / mo
pytest Worth it
PyPI · Libraries · released Jun 2026

pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.

MITpure Python · 3.10+
1.1Bdownloads / mo

See also rtree · nutree · pynndescent · voyager · spatial_image · nmslib · annoy · pyspark-hnsw · sortedcollections