Skip to content

pybind: Add S2Point bindings - #524

Merged
jmr merged 1 commit into
google:masterfrom
deustis:deustis/pybind11_bazel_setup
Jan 23, 2026
Merged

jmr merged 1 commit into
google:masterfrom
deustis:deustis/pybind11_bazel_setup

Conversation

@deustis

@deustis deustis commented Jan 8, 2026 •

Copy link
Copy Markdown
Contributor

Initial Bazel configuration for Pybind11 and S2Point bindings.
#522

The S2 Geometry library is transitioning from SWIG-based bindings to pybind11-based bindings.

During this migration:

  • SWIG bindings (s2geometry): The current production bindings, built with CMake. Use import s2geometry to access these.
  • pybind11 bindings (s2geometry_pybind): The new bindings under development, built with Bazel. Use import s2geometry_pybind to access these.

Once the pybind11 bindings are feature-complete and stable, the SWIG bindings will be deprecated and the pybind11 package will be renamed to s2geometry to become the primary Python API.

This PR adds Bazel configuration for building and testing the bindings on the local toolchain. For distribution we'll need to generate a wheel for compatibility with different OS and python versions.

@google-cla

google-cla Bot commented Jan 8, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@deustis deustis mentioned this pull request Jan 8, 2026
@jmr

jmr commented Jan 8, 2026

Copy link
Copy Markdown
Member

Looks like a good start. I'll have a closer look tomorrow.

How much are you planning on wrapping?

@deustis

deustis commented Jan 8, 2026

Copy link
Copy Markdown
Contributor Author

Looks like a good start. I'll have a closer look tomorrow.

Great!

How much are you planning on wrapping?

For my purposes I mainly need S2Cell and its dependencies. But I'm happy to do more to get this to whatever you would consider a viable MVP. Open to suggestions there?

@deustis
deustis force-pushed the deustis/pybind11_bazel_setup branch from 6535f67 to 7b92d38 Compare January 8, 2026 16:55
Comment thread src/MODULE.bazel Outdated
Comment thread src/python/PYBIND_README.md Outdated
Comment thread src/python/PYBIND_README.md Outdated
Comment thread src/python/README.md Outdated
Comment thread src/python/README.md
Comment thread src/python/tests/s2point_test.py Outdated
Comment thread src/python/README.md Outdated
Comment thread src/python/bindings/BUILD.bazel Outdated
Comment thread src/python/bindings/BUILD.bazel Outdated
Comment thread src/python/tests/s2point_test.py Outdated
@deustis

deustis commented Jan 12, 2026

Copy link
Copy Markdown
Contributor Author

@jmr, I made most of the changes you suggested. Let me know what you prefer for the directory layout and how to organize the python modules and I'll make those changes as well.

@deustis
deustis requested a review from jmr January 12, 2026 17:00
@deustis

deustis commented Jan 16, 2026

Copy link
Copy Markdown
Contributor Author

@jmr, friendly ping? I'm looking for feedback on the directory layout and python modules (see above).

Comment thread src/MODULE.bazel
Comment thread src/python/tests/s2point_test.py Outdated
@deustis

deustis commented Jan 20, 2026

Copy link
Copy Markdown
Contributor Author

@jmr, I've flattened the directories and responded to your other comments. This should be ready for another round!

(Still waiting on the lawyers to sign that CLA...)

Comment thread .gitignore Outdated

@jmr jmr left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good modulo the two new comments/questions.

Oh, also add the CONTRIBUTORS stuff here.

@deustis
deustis force-pushed the deustis/pybind11_bazel_setup branch from be83d9c to f09da06 Compare January 22, 2026 22:55
@deustis

deustis commented Jan 22, 2026

Copy link
Copy Markdown
Contributor Author

Oh, also add the CONTRIBUTORS stuff here.

Done!

@deustis

deustis commented Jan 22, 2026

Copy link
Copy Markdown
Contributor Author

@jmr, I've made those changes. I also squashed all the commits to use my corp email from the CONTRIBUTORS files.

@jmr

jmr commented Jan 23, 2026

Copy link
Copy Markdown
Member

If I "squash and merge", it's only letting me use the noreply@github address. I assume you want the address from https://github.com/deustis/s2geometry/commit/f09da0646a6844c71441a1c73f5c4a433bd12fc6.patch.

Can you expand the commit message a bit? Here's what I had, feel free to change it.

pybind: Add S2Point bindings (#524)

Add pybind11 bindings for S2Point and bazel config.

This is the first step towards https://github.com/google/s2geometry/issues/522
(pybind11 wrapper)

I think then I can "rebase and merge".

@jmr jmr changed the title Initial Bazel configuration for Pybind11 and S2Point bindings pybind: Add S2Point bindings Jan 23, 2026
Add pybind11 bindings for S2Point and bazel config.

This is the first step towards google#522
(pybind11 wrapper)
@deustis
deustis force-pushed the deustis/pybind11_bazel_setup branch from f09da06 to 2b7ddcf Compare January 23, 2026 17:53
@deustis

deustis commented Jan 23, 2026 •

Copy link
Copy Markdown
Contributor Author

I've updated the commit description!

For the email address, I don't have a strong preference. I believe the CLA is satisfied either way. If you can carry through the aurora.tech email that would be slightly preferable but if not the noreply email address is okay too.

@jmr
jmr merged commit b39b3de into google:master Jan 23, 2026
15 of 16 checks passed
@jmr

jmr commented Jan 23, 2026

Copy link
Copy Markdown
Member

Thanks!

deustis added a commit to deustis/s2geometry that referenced this pull request Jan 28, 2026
Add pybind11 bindings for S1Interval.

Also add interface notes to the python README
deustis added a commit to deustis/s2geometry that referenced this pull request Jan 28, 2026
Add pybind11 bindings for S1Interval.

Also add interface notes to the python README
deustis added a commit to deustis/s2geometry that referenced this pull request Jan 28, 2026
Add pybind11 bindings for S1Interval.

Also add interface notes to the python README
deustis added a commit to deustis/s2geometry that referenced this pull request Jan 28, 2026
Add pybind11 bindings for S1Interval.

Also add interface notes to the python README
deustis added a commit to deustis/s2geometry that referenced this pull request Jan 28, 2026
Add pybind11 bindings for S1Interval.

Also add interface notes to the python README
deustis added a commit to deustis/s2geometry that referenced this pull request Jan 28, 2026
Add pybind11 bindings for S1Interval.

Also add interface notes to the python README
@deustis deustis mentioned this pull request Feb 22, 2026
jmr pushed a commit that referenced this pull request Mar 3, 2026
Add pybind11 bindings for S1Interval.

Also add interface notes to the python README.

(Part of a series of addressing #524.)
deustis added a commit to deustis/s2geometry that referenced this pull request Mar 5, 2026
Merge branch 'master' into deustis/r2_bindings.

Add pybind11 bindings for R1Interval, R2Point, and R2Rect.

(Part of a series of addressing google#524.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants