{"id":48374188,"url":"https://github.com/pybind/pybind11_abseil","last_synced_at":"2026-04-05T17:44:32.547Z","repository":{"id":45756129,"uuid":"213958621","full_name":"pybind/pybind11_abseil","owner":"pybind","description":"Pybind11 bindings for the Abseil C++ Common Libraries","archived":false,"fork":false,"pushed_at":"2026-04-03T16:16:25.000Z","size":266,"stargazers_count":26,"open_issues_count":8,"forks_count":20,"subscribers_count":8,"default_branch":"master","last_synced_at":"2026-04-05T17:44:24.801Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pybind.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-10-09T15:44:24.000Z","updated_at":"2026-04-03T16:16:30.000Z","dependencies_parsed_at":"2024-01-03T19:29:19.769Z","dependency_job_id":"c09e1e5a-889b-4dc7-9290-9974e21268b8","html_url":"https://github.com/pybind/pybind11_abseil","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/pybind/pybind11_abseil","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pybind%2Fpybind11_abseil","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pybind%2Fpybind11_abseil/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pybind%2Fpybind11_abseil/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pybind%2Fpybind11_abseil/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pybind","download_url":"https://codeload.github.com/pybind/pybind11_abseil/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pybind%2Fpybind11_abseil/sbom","scorecard":{"id":751139,"data":{"date":"2025-08-11","repo":{"name":"github.com/pybind/pybind11_abseil","commit":"c55fdc9c53d26af70fa8c2314a683abef62fa3f0"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.5,"checks":[{"name":"Code-Review","score":1,"reason":"Found 3/29 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/actions.yml:1","Warn: no topLevel permission defined: .github/workflows/amd64_linux_bazel.yml:1","Warn: no topLevel permission defined: .github/workflows/amd64_linux_cmake.yml:1","Warn: no topLevel permission defined: .github/workflows/amd64_macos_bazel.yml:1","Warn: no topLevel permission defined: .github/workflows/amd64_macos_cmake.yml:1","Warn: no topLevel permission defined: .github/workflows/amd64_windows_bazel.yml:1","Warn: no topLevel permission defined: .github/workflows/amd64_windows_cmake.yml:1","Warn: no topLevel permission defined: .github/workflows/arm64_macos_bazel.yml:1","Warn: no topLevel permission defined: .github/workflows/arm64_macos_cmake.yml:1","Warn: no topLevel permission defined: .github/workflows/pre-commit.yml:1","Warn: no topLevel permission defined: .github/workflows/ubuntu-build.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/actions.yml:27: update your workflow using https://app.stepsecurity.io/secureworkflow/pybind/pybind11_abseil/actions.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/actions.yml:31: update your workflow using https://app.stepsecurity.io/secureworkflow/pybind/pybind11_abseil/actions.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/amd64_linux_bazel.yml:33: update your workflow using https://app.stepsecurity.io/secureworkflow/pybind/pybind11_abseil/amd64_linux_bazel.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/amd64_linux_bazel.yml:37: update your workflow using https://app.stepsecurity.io/secureworkflow/pybind/pybind11_abseil/amd64_linux_bazel.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/amd64_linux_bazel.yml:44: update your workflow using https://app.stepsecurity.io/secureworkflow/pybind/pybind11_abseil/amd64_linux_bazel.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/amd64_linux_bazel.yml:72: update your workflow using https://app.stepsecurity.io/secureworkflow/pybind/pybind11_abseil/amd64_linux_bazel.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/amd64_linux_cmake.yml:27: update your workflow using https://app.stepsecurity.io/secureworkflow/pybind/pybind11_abseil/amd64_linux_cmake.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/amd64_linux_cmake.yml:29: update your workflow using https://app.stepsecurity.io/secureworkflow/pybind/pybind11_abseil/amd64_linux_cmake.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/amd64_linux_cmake.yml:74: update your workflow using https://app.stepsecurity.io/secureworkflow/pybind/pybind11_abseil/amd64_linux_cmake.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/amd64_macos_bazel.yml:33: update your workflow using https://app.stepsecurity.io/secureworkflow/pybind/pybind11_abseil/amd64_macos_bazel.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/amd64_macos_bazel.yml:35: update your workflow using https://app.stepsecurity.io/secureworkflow/pybind/pybind11_abseil/amd64_macos_bazel.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/amd64_macos_bazel.yml:40: update your workflow using https://app.stepsecurity.io/secureworkflow/pybind/pybind11_abseil/amd64_macos_bazel.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/amd64_macos_bazel.yml:74: update your workflow using https://app.stepsecurity.io/secureworkflow/pybind/pybind11_abseil/amd64_macos_bazel.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/amd64_macos_cmake.yml:26: update your workflow using https://app.stepsecurity.io/secureworkflow/pybind/pybind11_abseil/amd64_macos_cmake.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/amd64_macos_cmake.yml:28: update your workflow using https://app.stepsecurity.io/secureworkflow/pybind/pybind11_abseil/amd64_macos_cmake.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/amd64_macos_cmake.yml:71: update your workflow using https://app.stepsecurity.io/secureworkflow/pybind/pybind11_abseil/amd64_macos_cmake.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/amd64_windows_bazel.yml:41: update your workflow using https://app.stepsecurity.io/secureworkflow/pybind/pybind11_abseil/amd64_windows_bazel.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/amd64_windows_bazel.yml:43: update your workflow using https://app.stepsecurity.io/secureworkflow/pybind/pybind11_abseil/amd64_windows_bazel.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/amd64_windows_bazel.yml:75: update your workflow using https://app.stepsecurity.io/secureworkflow/pybind/pybind11_abseil/amd64_windows_bazel.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/amd64_windows_cmake.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/pybind/pybind11_abseil/amd64_windows_cmake.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/amd64_windows_cmake.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/pybind/pybind11_abseil/amd64_windows_cmake.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/amd64_windows_cmake.yml:69: update your workflow using https://app.stepsecurity.io/secureworkflow/pybind/pybind11_abseil/amd64_windows_cmake.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/arm64_macos_bazel.yml:33: update your workflow using https://app.stepsecurity.io/secureworkflow/pybind/pybind11_abseil/arm64_macos_bazel.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/arm64_macos_bazel.yml:35: update your workflow using https://app.stepsecurity.io/secureworkflow/pybind/pybind11_abseil/arm64_macos_bazel.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/arm64_macos_bazel.yml:40: update your workflow using https://app.stepsecurity.io/secureworkflow/pybind/pybind11_abseil/arm64_macos_bazel.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/arm64_macos_bazel.yml:74: update your workflow using https://app.stepsecurity.io/secureworkflow/pybind/pybind11_abseil/arm64_macos_bazel.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/arm64_macos_cmake.yml:26: update your workflow using https://app.stepsecurity.io/secureworkflow/pybind/pybind11_abseil/arm64_macos_cmake.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/arm64_macos_cmake.yml:28: update your workflow using https://app.stepsecurity.io/secureworkflow/pybind/pybind11_abseil/arm64_macos_cmake.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/arm64_macos_cmake.yml:71: update your workflow using https://app.stepsecurity.io/secureworkflow/pybind/pybind11_abseil/arm64_macos_cmake.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/pre-commit.yml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/pybind/pybind11_abseil/pre-commit.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/pre-commit.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/pybind/pybind11_abseil/pre-commit.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/pre-commit.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/pybind/pybind11_abseil/pre-commit.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ubuntu-build.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/pybind/pybind11_abseil/ubuntu-build.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ubuntu-build.yml:46: update your workflow using https://app.stepsecurity.io/secureworkflow/pybind/pybind11_abseil/ubuntu-build.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ubuntu-build.yml:48: update your workflow using https://app.stepsecurity.io/secureworkflow/pybind/pybind11_abseil/ubuntu-build.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ubuntu-build.yml:55: update your workflow using https://app.stepsecurity.io/secureworkflow/pybind/pybind11_abseil/ubuntu-build.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ubuntu-build.yml:84: update your workflow using https://app.stepsecurity.io/secureworkflow/pybind/pybind11_abseil/ubuntu-build.yml/master?enable=pin","Warn: pipCommand not pinned by hash: scripts/build_and_run_tests_cmake.sh:74","Warn: pipCommand not pinned by hash: .github/workflows/actions.yml:51","Warn: pipCommand not pinned by hash: .github/workflows/amd64_linux_cmake.yml:38","Warn: pipCommand not pinned by hash: .github/workflows/amd64_macos_cmake.yml:39","Warn: chocoCommand not pinned by hash: .github/workflows/amd64_windows_bazel.yml:52","Warn: pipCommand not pinned by hash: .github/workflows/arm64_macos_cmake.yml:39","Info:   0 out of  33 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   4 third-party GitHubAction dependencies pinned","Info:   0 out of   5 pipCommand dependencies pinned","Info:   0 out of   1 chocoCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":9,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Warn: project license file does not contain an FSF or OSI license."],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":0,"reason":"Project has not signed or included provenance with any releases.","details":["Warn: release artifact v202402.0 not signed: https://api.github.com/repos/pybind/pybind11_abseil/releases/142374686","Warn: release artifact v202402.0 does not have provenance: https://api.github.com/repos/pybind/pybind11_abseil/releases/142374686"],"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 3 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-22T20:25:14.664Z","repository_id":45756129,"created_at":"2025-08-22T20:25:14.664Z","updated_at":"2025-08-22T20:25:14.664Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31444702,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-05T15:22:31.103Z","status":"ssl_error","status_checked_at":"2026-04-05T15:22:00.205Z","response_time":75,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":"2026-04-05T17:44:32.487Z","updated_at":"2026-04-05T17:44:32.537Z","avatar_url":"https://github.com/pybind.png","language":"C++","readme":"# Pybind11 bindings for the Abseil C++ Common Libraries\n\nGithub-CI:\n| OS \\ Build system | Bazel | CMake |\n|:------- | :---: | :---: |\n| Linux (`amd64`) | [![Build Status][amd64_linux_bazel_status]][amd64_linux_bazel_link] | [![Build Status][amd64_linux_cmake_status]][amd64_linux_cmake_link] |\n| MacOS (`amd64`) | [![Build Status][amd64_macos_bazel_status]][amd64_macos_bazel_link] | [![Build Status][amd64_macos_cmake_status]][amd64_macos_cmake_link] |\n| MacOS (`arm64`) | [![Build Status][arm64_macos_bazel_status]][arm64_macos_bazel_link] | [![Build Status][arm64_macos_cmake_status]][arm64_macos_cmake_link] |\n| Windows (`amd64`) | [![Build Status][amd64_windows_bazel_status]][amd64_windows_bazel_link] | [![Build Status][amd64_windows_cmake_status]][amd64_windows_cmake_link] |\n\n[amd64_linux_bazel_status]: ./../../actions/workflows/amd64_linux_bazel.yml/badge.svg\n[amd64_linux_bazel_link]: ./../../actions/workflows/amd64_linux_bazel.yml\n[amd64_macos_bazel_status]: ./../../actions/workflows/amd64_macos_bazel.yml/badge.svg\n[amd64_macos_bazel_link]: ./../../actions/workflows/amd64_macos_bazel.yml\n[arm64_macos_bazel_status]: ./../../actions/workflows/arm64_macos_bazel.yml/badge.svg\n[arm64_macos_bazel_link]: ./../../actions/workflows/arm64_macos_bazel.yml\n[amd64_windows_bazel_status]: ./../../actions/workflows/amd64_windows_bazel.yml/badge.svg\n[amd64_windows_bazel_link]: ./../../actions/workflows/amd64_windows_bazel.yml\n\n[amd64_linux_cmake_status]: ./../../actions/workflows/amd64_linux_cmake.yml/badge.svg\n[amd64_linux_cmake_link]: ./../../actions/workflows/amd64_linux_cmake.yml\n[amd64_macos_cmake_status]: ./../../actions/workflows/amd64_macos_cmake.yml/badge.svg\n[amd64_macos_cmake_link]: ./../../actions/workflows/amd64_macos_cmake.yml\n[arm64_macos_cmake_status]: ./../../actions/workflows/arm64_macos_cmake.yml/badge.svg\n[arm64_macos_cmake_link]: ./../../actions/workflows/arm64_macos_cmake.yml\n[amd64_windows_cmake_status]: ./../../actions/workflows/amd64_windows_cmake.yml/badge.svg\n[amd64_windows_cmake_link]: ./../../actions/workflows/amd64_windows_cmake.yml\n\n## Overview\n\nThese adapters make Abseil types work with Pybind11 bindings. For more\ninformation on using Pybind11, see\ng3doc/third_party/pybind11/google3_utils/README.md.\n\nTo use the converters listed below, just include the header\nin the .cc file with your bindings:\n\n```cpp\n#include \"pybind11_abseil/absl_casters.h\"\n```\n\n## Installation\n\npybind11_abseil can be built with Bazel or CMake. Instructions for both are below.\n\n### Bazel\n\nIn your BUILD file:\n\n```bzl\nload(\"@pybind11_bazel//:build_defs.bzl\", \"pybind_extension\")\n```\n\n#### Bzlmod\n\nYou can depend on the Bazel module and dependencies via one of the following\ncommands in your MODULE.bazel:\n\nTo depend on a release:\n\n```bzl\nbazel_dep(\n    name = \"pybind11_abseil\",\n    version = \"\u003cselected_version\u003e\",\n)\n```\n\nTo depend on floating `master`:\n\n```bzl\nhttp_archive = use_repo_rule(\"@bazel_tools//tools/build_defs/repo:http.bzl\", \"http_archive\")\n\nhttp_archive(\n  name = \"pybind11_bazel\",\n  strip_prefix = \"pybind11_bazel-master\",\n  urls = [\"https://github.com/pybind/pybind11_bazel/archive/refs/heads/master.tar.gz\"],\n)\n\nhttp_archive(\n  name = \"pybind11\",\n  build_file = \"@pybind11_bazel//:pybind11-BUILD.bazel\",\n  strip_prefix = \"pybind11-master\",\n  urls = [\"https://github.com/pybind/pybind11/archive/refs/heads/master.tar.gz\"],\n)\n\nhttp_archive(\n  name = \"pybind11_abseil\",\n  strip_prefix = \"pybind11_abseil-master\",\n  urls = [\"https://github.com/pybind/pybind11_abseil/archive/refs/heads/master.tar.gz\"],\n)\n```\n\n#### WORKSPACE\n\nBazel workspace support is deprecated and will be removed at a later date.\n\nYou will need to depend on `pybind11`, `pybind11_bazel`(see\n[doc](https://github.com/pybind/pybind11_bazel#installation), and on\n`pybind11_abseil`), e.g.\n\n```bzl\nhttp_archive(\n  name = \"pybind11_bazel\",\n  strip_prefix = \"pybind11_bazel-master\",\n  urls = [\"https://github.com/pybind/pybind11_bazel/archive/refs/heads/master.tar.gz\"],\n)\n\nhttp_archive(\n  name = \"pybind11\",\n  build_file = \"@pybind11_bazel//:pybind11-BUILD.bazel\",\n  strip_prefix = \"pybind11-master\",\n  urls = [\"https://github.com/pybind/pybind11/archive/refs/heads/master.tar.gz\"],\n)\n\nhttp_archive(\n  name = \"pybind11_abseil\",\n  strip_prefix = \"pybind11_abseil-master\",\n  urls = [\"https://github.com/pybind/pybind11_abseil/archive/refs/heads/master.tar.gz\"],\n)\n```\n\n### CMake\n\nIn your project, add a FetchContent for pybind11_abseil. This will also fetch\nthe appropriate versions of Abseil and pybind11 which your project can use\n(eliminating the need for submoduling Abseil or using find_package).\n\nAdd the following to your CMakeLists.txt:\n\n```cmake\ninclude(FetchContent)\nFetchContent_Declare {\n  pybind11_abseil\n  GIT_REPOSITORY https://github.com/pybind/pybind11_abseil.git\n  GIT_TAG master\n}\nFetchContent_MakeAvailable(pybind11 abseil-cpp pybind11_abseil)\n```\n\nTo install the package so that it is accessible from system Python, run cmake\nwith the flag `-DCMAKE_INSTALL_PYDIR` set to a directory on your PYTHONPATH and\nsubsequently run `make install`. This also works on projects that include\npybind11_abseil via FetchContent.\n\n## absl::Duration\n\n`absl::Duration` objects are converted to/ from python datetime.timedelta objects.\nTherefore, C code cannot mutate any datetime.timedelta objects from python.\n\n## absl::Time\n\n`absl::Time` objects are converted to/from python datetime.datetime objects.\nAdditionally, datetime.date objects can be converted to `absl::Time` objects.\nC code cannot mutate any datetime.datetime objects from python.\n\nPython date objects effectively truncate the time to 0 (i.e., midnight).\nPython time objects are not supported because `absl::Time` would implicitly\nassume a year, which could be confusing.\n\n### Time zones\n\nPython `datetime` objects include timezone information, while\n`absl::Time` does not. When converting from Python to C++, if a timezone is\nspecified then it will be used to determine the `absl::Time` instant. If no\ntimezone is specified by the Python `datetime` object, the local timezone is\nassumed.\n\nWhen converting back from C++ to Python, the resultant time will be presented in\nthe local timezone and the `tzinfo` property set on the `datetime` object to\nreflect that. This means that the caller may receive a datetime formatted\nin a different timezone to the one they passed in. To handle this safely, the\ncaller should take care to check the `tzinfo` of any returned `datetime`s.\n\n## absl::CivilTime\n\n`absl::CivilTime` objects are converted to/from Python datetime.datetime\nobjects. Fractional Python datetime components are truncated when converting to\nless granular C++ types, and time zone information is ignored.\n\n## absl::Span\n\n### Loading\n\nSome python types can be loaded (Python-\u003eC++) without copying or converting the\nlist, while some require copying/ converting the list. The non-converting load\nmethods will be tried first, and, if the span elements are const, the converting\nload methods will be tried next.\n\nArguments cast to a span with *non-const* elements can never be copied/converted.\nTo prevent an argument cast to a span with *const* elements from being copied or\nconverted, mark it as `noconvert()` (see go/pybind11-non-converting-arguments).\n\nThe following python types can be loaded *without* copying or converting:\n\n- Numpy array (or anything else that supports [buffer protocol](\n  https://docs.python.org/3/c-api/buffer.htm)) =\u003e `Span\u003c{const or non-const} T\u003e`\n  if *all* of the following conditions are satisfied:\n  - The buffer is 1-D.\n  - T is a numeric type.\n  - The array dtype matches T exactly.\n  - If T is not const, the buffer allows writing.\n  - The stride does not indicate to skip elements or go in reverse order.\n- [Opaque](https://pybind11.readthedocs.io/en/stable/advanced/cast/stl.html#making-opaque-types) `std::vector\u003cT\u003e` =\u003e `Span\u003c{const or non-const} T\u003e`.\n  - T can be any type, including converted or pointer types, but must\n    match exactly between C++ and python.\n  - Opaque vectors are *not* currently compatible with the smart holder.\n\nThe following python types must be copied/converted to be loaded:\n\n- Python sequence of elements that require conversion (numbers, strings,\n  datetimes, etc) =\u003e `Span\u003cconst T\u003e`.\n  - The elements will be copied/ converted, so that conversion must be legal.\n  - T *cannot* be a pointer.\n- Python sequence of elements that do *not* require conversion (ie, classes\n  wrapped with py::class_) =\u003e `Span\u003cconst T\u003e` (elements *will* be copied) or\n  `Span\u003c{const or non-const} T* const\u003e` (elements will *not* be copied).\n\nSpecifically, this conversion will *fail* if any of the following are true:\n\n- `noconvert()` was specified (see go/pybind11-non-converting-arguments).\n- The element conversion is not allowed (eg, floating point to integer).\n- The sequence is being loaded into a `Span\u003c{non-const} T\u003e` or\n  `Span\u003c{const or non-const} T* {non-const}\u003e`.\n- The elements require conversion *and* the sequence is being loaded into a\n  `Span\u003cT*\u003e` (regardless of any `const`s; the element caster which owns the\n  converted value would be destroyed before `load` is complete, resulting in\n  dangling references).\n- The span is nested (ie, `absl::Span\u003cabsl::Span\u003cT\u003e\u003e`, regardless of any `const`s).\n\nNote: These failure conditions only apply to *converted* python types.\n\n### Casting\n\nSpans are cast (C++-\u003ePython) with the standard list caster, which always\nconverts the list. This could be changed in the future (eg, using\n[buffer protocol](https://pybind11.readthedocs.io/en/stable/advanced/pycpp/numpy.html#buffer-protocol)\n) but generally using spans as return values is not recommended.\n\n## absl::string_view\n\nSupported exactly the same way pybind11 supports `std::string_view`.\n\n## absl::optional\n\nSupported exactly the same way pybind11 supports `std::optional`.\n\n## absl::flat_hash_map and absl::btree_map\n\nSupported exactly the same way pybind11 supports `std::map`.\n\n## absl::flat_hash_set\n\nSupported exactly the same way pybind11 supports `std::set`.\n\n## absl::Status[Or]\n\nTo use the Status[Or] casters:\n\n1. Include the header file `pybind11_abseil/status_casters.h`\n   in the .cc file with your bindings.\n1. Call `pybind11::google::ImportStatusModule();` in your `PYBIND11_MODULE`\n   definition.\n\n(For use outside google3:\nThe path used for the `status` module may be changed by altering the value of\n`PYBIND11_ABSEIL_STATUS_MODULE_PATH` defined in `import_status_module.h`.)\n\nBy default, an ok status will be converted into `None`, and a non-ok status will\nraise a `status.StatusNotOk` exception. This has a `status` attribute which can\nbe used to access the status object and check the code/ message.\n\nTo get a `status.Status` object rather than having an exception thrown, pass\neither the `Status` object or a function returning a `Status` to\n`pybind11::google::DoNotThrowStatus` before casting or binding. This works with\nreferences and pointers to `absl::Status` objects too.\n\nIt isn't possible to specify separate return value policies for a `StatusOr`\nobject and its payload. Since `StatusOr` is processed and not ever actually\nrepresented in Python, the return value policy applies to the payload. E.g., if\nyou return a `StatusOr\u003cMyObject*\u003e` (note the `*` is inside the `StatusOr`) with\na take_ownership return val policy and the status is OK (i.e., it has a payload)\n, Python will take ownership of that payload and free it when it is garbage\ncollected.\n\nHowever, if you return a `StatusOr\u003cMyObject\u003e*` (note: the `*` is outside the\n`StatusOr` rather than inside it now) with a `take_ownership` return val policy,\nPython does not take ownership of the `StatusOr` and will not free it (because\nagain, that policy applies to `MyObject`, not `StatusOr`).\n\nSee `status_utils.cc` in this directory for details about what methods are\navailable in wrapped `absl::Status` objects.\n\nExample:\n\n```cpp\n#include \"pybind11_abseil/status_casters.h\"\n\nabsl::Status StatusReturningFunction() {\n  return absl::Status(...);\n}\n\npybind11::object StatusHandlingFunction() {\n  return pybind11::cast(pybind11::google::DoNotThrowStatus(StatusReturningFunction()));\n}\n\nPYBIND11_MODULE(test_bindings, m) {\n  pybind11::google::ImportStatusModule();\n\n  m.def(\"return_status\", \u0026StatusReturningFunction,\n        \"Return None if StatusCode is OK, otherwise raise an error.\");\n  m.def(\"make_status\", google::DoNotThrowStatus(\u0026StatusReturningFunction),\n        \"Return a wrapped status object without raising an error.\");\n  m.def(\"status_handling_function\", \u0026StatusHandlingFunction,\n        \"Same effect as make_status, but cast is done internally.\");\n};\n```\n\nPython:\n\n```python\nfrom pybind11_abseil import status\nimport test_bindings\n\nmy_status = make_status()\nif my_status.code():\n  ...\n\ntry:\n  return_status()\nexcept status.StatusNotOk as e:\n  print(e.status)\n```\n\n### absl::StatusOr\n\n`absl::StatusOr` objects behave exactly like `absl::Status` objects, except:\n\n- There is no support for passing `StatusOr` objects. You can only return them.\n- Instead of returning None or a wrapped status with OK, this casts and\n  returns the payload when there is no error.\n\nAs with `absl::Status`, the default behavior is to throw an error when casting\na non-ok status. You may pass a `StatusOr` object or `StatusOr` returning\nfunction to `pybind11::google::DoNotThrowStatus` in exactly the same way as with\n`absl::Status` to change this behavior.\n\n`absl::StatusOr` objects must be returned by value (not reference or pointer).\nWhy? Because the implementation takes advantage of the fact that python is a\ndynamically typed language to cast and return the payload *or* the\n`absl::Status` object (or raise an exeception). Python has no concept of a\n`absl::StatusOr` object, so it's also impossible to apply the\nreturn_value_policy to a `absl::StatusOr`. Therefore returning a reference or\npointer to a `absl::StatusOr` is meaningless.\n\nPointers *can* be used as the payload type, and the return_value_policy will\nbe applied to the payload if the status is OK. However, references cannot be\nused as the payload type, because that's a restriction on `absl::StatusOr` in\ngeneral, not pybind11 (see https://yaqs/5903163345338368).\n\nThis can handle any type of payload that pybind knows about. unique_ptrs (i.e.,\n`absl::StatusOr\u003cstd::unique_ptr\u003c...\u003e\u003e`) to wrapped classes or structs (i.e., any\ntype which you created bindings for using `pybind11::class_\u003c...\u003e`) can be used,\nbut unique_ptrs to converted types (e.g., `int`, `string`, `absl::Time`,\n`absl::Duration`, etc.) cannot be used.\n\n### absl::StatusCode\n\nThe `status` module provides `pybind11::enum_` bindings for `absl::StatusCode`.\nThese use python constant style, e.g. `status.StatusCode.OK`,\n`status.StatusCode.CANCELLED`, etc.\n\nWarning: Pybind enums are their own type, and will never compare equally to\nintegers due to being a different type, regardless of their value. In particular\n, note that the [status proto](http://google3/util/task/status.proto)\n`code` field is an integer, so it will never directly compare as equal to a\n`StatusCode`. To fix this, convert an integer to a `StatusCode` or vice-versa.\n\n```python\nstatus_code = 0  # An integer.\n\nif status_code == status.StatusCode.OK:  # Wrong: always evaluates to false.\n  ...\n\nif status.StatusCode(status_code) == status.StatusCode.OK:  # Correct.\n  ...\n\nif status_code == int(status.StatusCode.OK):  # Also correct.\n  ...\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpybind%2Fpybind11_abseil","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpybind%2Fpybind11_abseil","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpybind%2Fpybind11_abseil/lists"}