Skip to content

pybind11 wrapper #522

Open
Open

Description

@deustis

The repo README indicates future support for pybind is planned but I wasn't able to find an issue tracking this --

https://github.com/google/s2geometry/tree/master?tab=readme-ov-file#apiabi-stability

The Python API is particularly unstable, and it is planned that the SWIGged API will be replaced by a pybind11 version with more Pythonic names and more complete functionality.

Any indication on when this might become available?

Activity

  1. jmr commented on Jan 6, 2026

    @jmr
    Member

    Hello!

    When I wrote that three years ago, we had moved from swig to clif internally at Google. I assumed we would eventually release the clif bindings, or maybe the generated pybind11 bindings.

    Now clif is unmaintained, and nanobind seems to be the new pybind11, so I'm not sure what to do.

    Do you have a suggestion? Or maybe @rwgk?

  2. rwgk commented on Jan 6, 2026

    @rwgk

    Roughly:

    • nanobind has more runtime optimizations but fewer features than pybind11.
    • If the nanobind feature set works for you, use it, but nanobind is explicitly not meant to be a full replacement for pybind11.
  3. jmr commented on Jan 6, 2026

    @jmr
    Member

    Thanks. Is there a good way to avoid maintaining both clif bindings and pybind11/nanobind ones? Is the clif output close to usable as a starting point for pybind11 bindings?

  4. rwgk commented on Jan 6, 2026

    @rwgk

    Thanks. Is there a good way to avoid maintaining both clif bindings and pybind11/nanobind ones? Is the clif output close to usable as a starting point for pybind11 bindings?

    I don't think so, but I don't know what the current state is of clif inside Google (I switched companies).

    These days, I'd probably just ask my favorite LLM to convert the clif bindings to pybind11 or nanobind. I expect it'll probably do a reasonable job that can be finished with a small amount of manual fix-ups.

    Maybe you can help it by giving the LLM the output of help(yourmodule), so that it can "see" the built bindings.

  5. deustis commented on Jan 6, 2026

    @deustis
    ContributorAuthor

    We happen to use pybind11 at my current company (Aurora Innovation) and it works well for us! I'd be happy with any of those options though. I was mainly curious to understand if I should be avoiding the current Python SWIG wrappers because some new/better Python API is forthcoming.

  6. deustis commented on Jan 7, 2026

    @deustis
    ContributorAuthor

    BTW, I'd be open to contributing a PR for the pybind option if that helps. I'm less familiar with the other Python binding libraries but could give any of those a shot if they are preferred.

    BTW, former Googler here. I worked on Google Maps from 2005 to 2013! Jesse you're name looks really familiar although I don't recall if we crossed paths!

  7. jmr commented on Jan 7, 2026

    @jmr
    Member

    I'd be open to contributing a PR for the pybind option if that helps.

    Yes, that would be great.

    BTW, former Googler here. I worked on Google Maps from 2005 to 2013!

    I recognize your name from maps and speech.

  8. deustis commented on Jan 8, 2026

    @deustis
    ContributorAuthor

    Hi there, I'm working with my open source team to get the contributor agreement signed. But in the meantime, hoping to get some feedback to see if I'm on the right track here:
    #524

  9. changed the title [-]Pybind wrapper for s2[/-] [+]pybind11 wrapper[/+] on Jan 23, 2026
  10. added a commit that references this issue on Jan 23, 2026
  11. added a commit that references this issue on Jan 23, 2026
  12. added a commit that references this issue on Mar 19, 2026
  13. deustis commented on Apr 24, 2026

    @deustis
    ContributorAuthor

    @jmr, are you in touch with the maintainer of the current PyPI s2geometry package?:
    https://pypi.org/project/s2geometry/

    The maintainer is listed as @figroc:
    https://github.com/figroc

    We're getting close to feature parity on the SWIG bindings, and I'm thinking we'll want to publish the new library as a new major version of that s2geometry package.

  14. figroc commented on Apr 25, 2026

    @figroc

    @deustis I've added this repo as a Trusted Publisher in #406.

  15. jmr commented on Apr 27, 2026

    @jmr
    Member

    We're getting close to feature parity on the SWIG bindings, and I'm thinking we'll want to publish the new library as a new major version of that s2geometry package.

    It doesn't look like we're that close, but getting there. We should have a compat layer to avoid breaking everyone.

    #583

    I would also also give the new code some bake time before making a release.

  16. added a commit that references this issue on May 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions