$ account shapely
Shapely is a mature Python library for manipulation and analysis of planar geometric objects, serving as the computational geometry backbone for the geospatial Python ecosystem (GeoPandas, Fiona, etc.). It wraps the GEOS C++ library (the engine of PostGIS) and exposes both an object-oriented geometry interface (Point, LineString, Polygon, collections) and vectorized NumPy universal functions for high‑performance array operations on geometry arrays. Architecturally, the library consists of a C extension (`shapely.lib`) that provides a `Geometry` type and registers dozens of ufuncs, each wrapping a GEOS function. The Python modules in `shapely/` (constructive, predicates, measurement, set_operations, io, strtree, etc.) provide the public API, using decorators like `@multithreading_enabled` and `@requires_geos` to manage thread safety and version gating. The `STRtree` class (packed R‑tree) offers spatial indexing with `query`, `nearest`, and `query_nearest`. Key entry points include the top-level functions in `shapely/__init__.py` (e.g., `contains`, `intersection`, `buffer`, `from_wkt`), the geometry classes in `shapely/geometry/`, and the I/O and transformation utilities. The codebase is well-tested (300+ test files) and continuously integrated across GEOS 3.10–3.14 and multiple Python versions.