{"id":28559148,"url":"https://github.com/toastdriven/quads","last_synced_at":"2025-06-23T11:33:25.246Z","repository":{"id":43771745,"uuid":"281238913","full_name":"toastdriven/quads","owner":"toastdriven","description":"A pure Python Quadtree implementation","archived":false,"fork":false,"pushed_at":"2024-03-20T17:22:20.000Z","size":149,"stargazers_count":37,"open_issues_count":7,"forks_count":7,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-06-15T19:13:01.310Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/toastdriven.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-07-20T22:31:43.000Z","updated_at":"2025-05-30T20:29:02.000Z","dependencies_parsed_at":"2022-07-08T02:44:45.264Z","dependency_job_id":null,"html_url":"https://github.com/toastdriven/quads","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/toastdriven/quads","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toastdriven%2Fquads","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toastdriven%2Fquads/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toastdriven%2Fquads/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toastdriven%2Fquads/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/toastdriven","download_url":"https://codeload.github.com/toastdriven/quads/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/toastdriven%2Fquads/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261469286,"owners_count":23163061,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-10T08:36:08.688Z","updated_at":"2025-06-23T11:33:20.218Z","avatar_url":"https://github.com/toastdriven.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `quads`\n\n[![Documentation Status](https://readthedocs.org/projects/quads/badge/?version=latest)](https://quads.readthedocs.io/en/latest/?badge=latest)\n![CI](https://github.com/toastdriven/quads/workflows/CI/badge.svg)\n\nA pure Python Quadtree implementation.\n\n[Quadtrees](https://en.wikipedia.org/wiki/Quadtree) are a useful data\nstructure for sparse datasets where the location/position of the data is\nimportant. They're especially good for spatial indexing \u0026 image processing.\n\nAn actual visualization of a `quads.QuadTree`:\n\n![quadtree_viz](docs/images/quadtree_visualization.png)\n\n\n## Usage\n\nFull documentation at https://quads.readthedocs.io/en/latest/\n\n```python\n\u003e\u003e\u003e import quads\n\u003e\u003e\u003e tree = quads.QuadTree(\n...     (0, 0),  # The center point\n...     10,  # The width\n...     10,  # The height\n... )\n\n# You can choose to simply represent points that exist.\n\u003e\u003e\u003e tree.insert((1, 2))\nTrue\n# ...or include extra data at those points.\n\u003e\u003e\u003e tree.insert(quads.Point(4, -3, data=\"Samus\"))\nTrue\n\n# You can search for a given point. It returns the point if found...\n\u003e\u003e\u003e tree.find((1, 2))\nPoint(1, 2)\n\n# Or `None` if there's no match.\n\u003e\u003e\u003e tree.find((4, -4))\nNone\n\n# You can also find all the points within a given region.\n\u003e\u003e\u003e bb = quads.BoundingBox(min_x=-1, min_y=-2, max_x=2, max_y=2)\n\u003e\u003e\u003e tree.within_bb(bb)\n[Point(1, 2)]\n\n# You can also search to find the nearest neighbors of a point, even\n# if that point doesn't have data within the quadtree.\n\u003e\u003e\u003e tree.nearest_neighbors((0, 1), count=2)\n[\n    Point(1, 2),\n    Point(4, -4),\n]\n\n# And if you have `matplotlib` installed (not required!), you can visualize\n# the tree.\n\u003e\u003e\u003e quads.visualize(tree)\n```\n\n\n## Installation\n\n```\n$ pip install quads\n```\n\n\n## Requirements\n\n* Python 3.7+ (untested on older versions but may work)\n\n\n## Running Tests\n\n```\n$ git clone https://github.com/toastdriven/quads.git\n$ cd quads\n$ poetry install\n$ poetry shell\n\n# Just the tests.\n$ pytest .\n\n# With coverage.\n$ pytest -s --cov=quads .\n# And with pretty reports.\n$ pytest -s --cov=quads . \u0026\u0026 coverage html\n```\n\n\n## License\n\nNew BSD\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftoastdriven%2Fquads","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftoastdriven%2Fquads","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftoastdriven%2Fquads/lists"}