Skip to main content

s2rst — Python bindings

Python bindings for s2rst, a Rust port of Google's S2 Geometry library.

S2 is a library for spherical geometry — geometry on the surface of a sphere. This package exposes the core S2 types (points, cells, caps, polygons, ...) to Python through a thin PyO3 wrapper.

Install

The package is built with maturin:

pip install maturin
maturin develop --release

(or, for a release wheel: maturin build --release).

Quick example

import s2rst

# Create a point on the sphere from latitude/longitude (in degrees).
ll = s2rst.LatLng.from_degrees(37.7749, -122.4194)
p = ll.to_point()

# Find the leaf cell containing the point.
cell = s2rst.CellId.from_point(p)
print(cell.to_token())           # e.g. "808f7c"
print(cell.level())              # 30 (leaf)

# Walk up to a coarser level.
parent = cell.parent_at_level(10)
print(parent.to_debug_string())  # face/childpath form

# Build a circular cap (disc) of 10 km angular radius around the point.
radius = s2rst.Angle.from_radians(10.0 / 6371.0)   # 10 km / earth radius
cap = s2rst.Cap.from_center_angle(p, radius)
print(cap.area())                                   # steradians

Type checking

The package ships PEP 561 type stubs (py.typed + _core.pyi) and is recognised as a typed package by mypy and pyright.

License

Licensed under the Apache License, Version 2.0.

s2rst is an independent port and is not affiliated with, endorsed by, or sponsored by Google.

Metadata

Release files for s2rst 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for s2rst 0.5.0
File Size Uploaded Provenance Actions
s2rst-0.5.0.tar.gz 1.1 MB Without provenance Details for s2rst-0.5.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for s2rst 0.5.0
File Actions
s2rst-0.5.0-cp39-abi3-win_arm64.whl CPython 3.9 abi3 Windows ARM64 Details for s2rst-0.5.0-cp39-abi3-win_arm64.whl
s2rst-0.5.0-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details for s2rst-0.5.0-cp39-abi3-win_amd64.whl
s2rst-0.5.0-cp39-abi3-musllinux_1_2_x86_64.whl CPython 3.9 abi3 Linux musl 1.2+ x86-64 Details for s2rst-0.5.0-cp39-abi3-musllinux_1_2_x86_64.whl
s2rst-0.5.0-cp39-abi3-musllinux_1_2_aarch64.whl CPython 3.9 abi3 Linux musl 1.2+ ARM64 Details for s2rst-0.5.0-cp39-abi3-musllinux_1_2_aarch64.whl
s2rst-0.5.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-64 Details for s2rst-0.5.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
s2rst-0.5.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.9 abi3 Linux glibc 2.17+ ARM64 Details for s2rst-0.5.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
s2rst-0.5.0-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details for s2rst-0.5.0-cp39-abi3-macosx_11_0_arm64.whl
s2rst-0.5.0-cp39-abi3-macosx_10_12_x86_64.whl CPython 3.9 abi3 macOS 10.12+ x86-64 Details for s2rst-0.5.0-cp39-abi3-macosx_10_12_x86_64.whl

Total release size: 13.4 MB

Release files / s2rst-0.5.0.tar.gz

Download URL s2rst-0.5.0.tar.gz
Size 1.1 MB
Tags Source
SHA-256 checksum
How to use checksums
22f905baa45b2c2c96c1f3194b16bab7bdf44ab1248c377602e93364609cc187
BLAKE2b-256 checksum
How to use checksums
be60f477df34498b38f86781bd99040368311e8a8a9b6389500534a065a50594
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / s2rst-0.5.0-cp39-abi3-win_arm64.whl

Download URL s2rst-0.5.0-cp39-abi3-win_arm64.whl
Size 1.3 MB
Tags CPython 3.9 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
8e74a44234ac36e762c25ca00eb7bca8d09c503428029de055c5dd57668d806a
BLAKE2b-256 checksum
How to use checksums
619e0073e962b22287a6a5ed51c10fd02f97df24b946590abd545820492d42c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / s2rst-0.5.0-cp39-abi3-win_amd64.whl

Download URL s2rst-0.5.0-cp39-abi3-win_amd64.whl
Size 1.4 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
76bcdb5fc0061efa1cb5d8d427b39df437f08677937dfcf03cf0105491a6c28d
BLAKE2b-256 checksum
How to use checksums
25a1dbd363570f898c882fc01324ea51e8b4f5c5c2bf469be5176adb8bc4c009
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / s2rst-0.5.0-cp39-abi3-musllinux_1_2_x86_64.whl

Download URL s2rst-0.5.0-cp39-abi3-musllinux_1_2_x86_64.whl
Size 1.8 MB
Tags CPython 3.9 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
8124aa6be9d7acd506e175e035c2d09ac291828e23d1e605e2074015b3d1d0b4
BLAKE2b-256 checksum
How to use checksums
a2799600cc78754d83541e5eb7d1c3bb7ce61072cfa21e7098f3690543e74333
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / s2rst-0.5.0-cp39-abi3-musllinux_1_2_aarch64.whl

Download URL s2rst-0.5.0-cp39-abi3-musllinux_1_2_aarch64.whl
Size 1.7 MB
Tags CPython 3.9 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
5b5e18a0879cecc0adbec4c55930958b00a676dd4ada75cf60d1f353d09e83ec
BLAKE2b-256 checksum
How to use checksums
4706210d80d07560da815635e2774065980ca939f8ca0ec98dcae30791acb343
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / s2rst-0.5.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL s2rst-0.5.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.6 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
046c43ab203a5e6f1956d00517b330868b7df4a81b21b96620f870ee06e404c3
BLAKE2b-256 checksum
How to use checksums
d877e5937da8c83fbf7a8a10270083721f4751c6f01953cd776237fae7128741
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / s2rst-0.5.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL s2rst-0.5.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 1.5 MB
Tags CPython 3.9 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
b6bbb950250846af6d7490619f08f2d9df7fd047c459f526034ef93a42dddea0
BLAKE2b-256 checksum
How to use checksums
9ca708b120a28c317d2a4ad15bdcdfe89554606cb82d4a94298ba094c9a745bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / s2rst-0.5.0-cp39-abi3-macosx_11_0_arm64.whl

Download URL s2rst-0.5.0-cp39-abi3-macosx_11_0_arm64.whl
Size 1.4 MB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
8d23cc36b8219465e46fca783690181e0a83f2eafadc04b7278e674b0348b2a0
BLAKE2b-256 checksum
How to use checksums
236309c8881f8700817e225b2a96c3d5f3f559d143a56d06b6a0181dc0536c6a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / s2rst-0.5.0-cp39-abi3-macosx_10_12_x86_64.whl

Download URL s2rst-0.5.0-cp39-abi3-macosx_10_12_x86_64.whl
Size 1.5 MB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
a7891745585961feac244a5314d9c6ffee1dc408f4f5fd5f03c114df107f5808
BLAKE2b-256 checksum
How to use checksums
08444f12a7b8ac0bb1311d0c9897a0fc66946f17f2634fde3e4ede6008087b45
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for s2rst 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page