diff --git a/MODULE.bazel b/MODULE.bazel new file mode 100644 index 0000000..3c250bd --- /dev/null +++ b/MODULE.bazel @@ -0,0 +1,84 @@ +module( + name = "pybind11_abseil", + version = "head", +) + +bazel_dep( + name = "bazel_skylib", + version = "1.5.0", +) + +bazel_dep( + name = "abseil-cpp", + version = "20240116.0", + repo_name = "com_google_absl", +) + +bazel_dep( + name = "rules_cc", + version = "0.0.9", +) + +bazel_dep( + name = "rules_python", + version = "0.31.0", +) + +bazel_dep( + name = "platforms", + version = "0.0.8" +) + +http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + +http_archive( + name = "pybind11_bazel", + strip_prefix = "pybind11_bazel-master", + urls = ["https://github.com/pybind/pybind11_bazel/archive/refs/heads/master.tar.gz"], +) + +http_archive( + name = "pybind11", + build_file = "@pybind11_bazel//:pybind11.BUILD", + strip_prefix = "pybind11-master", + urls = ["https://github.com/pybind/pybind11/archive/refs/heads/master.tar.gz"], +) + +#### DEV ONLY DEPENDENCIES BELOW HERE #### + +SUPPORTED_PYTHON_VERSIONS = [ + "3.12", + "3.11", + "3.10", + "3.9", + "3.8" +] + +DEFAULT_PYTHON = "3.11" + +python = use_extension("@rules_python//python/extensions:python.bzl", "python", dev_dependency=True) +[ + python.toolchain( + python_version = version, + is_default = version == DEFAULT_PYTHON, + ) + for version in SUPPORTED_PYTHON_VERSIONS +] + +use_repo( + python, + python = "python_versions", +) + +pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip", dev_dependency=True) +[ + pip.parse( + hub_name = "pypi", + python_version = version, + requirements_lock = "//pybind11_abseil/requirements:requirements_lock_" + version.replace('.','_') + ".txt", + ) + for version in SUPPORTED_PYTHON_VERSIONS + +] + +use_repo(pip, "pypi") diff --git a/README.md b/README.md index 3a6ce08..7adb348 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,21 @@ pybind11_abseil can be built with Bazel or CMake. Instructions for both are belo ### Bazel +#### Bzlmod + +You can depend on the Bazel module and dependencies via a single command in your MODULE.bazel: + +``` +bazel_dep( + name = "pybind11_abseil", + version = "selected_version", +) +``` + +#### WORKSPACE + +Bazel workspace support is deprecated and will be removed at a later date. + You will need to depend on `pybind11`, `pybind11_bazel`(see [doc](https://github.com/pybind/pybind11_bazel#installation), and on `pybind11_abseil`, e.g. diff --git a/WORKSPACE b/WORKSPACE index aa7d951..073250c 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -8,6 +8,13 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") # On Mac, run curl -L https://github.com/<...>.tar.gz | shasum -a 256 # and update the sha256 with the result. +################################################################################ +# +# WORKSPACE is being deprecated in favor of the new Bazelmod dependency system +# It will be removed at some point in the future. +# +################################################################################ + ## `bazel_skylib` (PINNED) http_archive( name = "bazel_skylib", # 2023-05-31T19:24:07Z @@ -27,6 +34,61 @@ http_archive( ], ) +http_archive( + name = "rules_python", + sha256 = "c68bdc4fbec25de5b5493b8819cfc877c4ea299c0dcb15c244c5a00208cde311", + strip_prefix = "rules_python-0.31.0", + url = "https://github.com/bazelbuild/rules_python/releases/download/0.31.0/rules_python-0.31.0.tar.gz", +) + +load("@rules_python//python:repositories.bzl", "py_repositories", "python_register_multi_toolchains") + +py_repositories() + +load("@rules_python//python/pip_install:repositories.bzl", "pip_install_dependencies") + +pip_install_dependencies() + +DEFAULT_PYTHON = "3.11" + +python_register_multi_toolchains( + name = "python", + default_version = DEFAULT_PYTHON, + python_versions = [ + "3.12", + "3.11", + "3.10", + "3.9", + "3.8" + ], +) + +load("@python//:pip.bzl", "multi_pip_parse") + +multi_pip_parse( + name = "pypi", + default_version = DEFAULT_PYTHON, + python_interpreter_target = { + "3.12": "@python_3_12_host//:python", + "3.11": "@python_3_11_host//:python", + "3.10": "@python_3_10_host//:python", + "3.9": "@python_3_9_host//:python", + "3.8": "@python_3_8_host//:python", + }, + requirements_lock = { + "3.12": "//pybind11_abseil/requirements:requirements_lock_3_12.txt", + "3.11": "//pybind11_abseil/requirements:requirements_lock_3_11.txt", + "3.10": "//pybind11_abseil/requirements:requirements_lock_3_10.txt", + "3.9": "//pybind11_abseil/requirements:requirements_lock_3_9.txt", + "3.8": "//pybind11_abseil/requirements:requirements_lock_3_8.txt", + }, +) + +load("@pypi//:requirements.bzl", "install_deps") + +install_deps() + + ## `pybind11_bazel` (FLOATING) # https://github.com/pybind/pybind11_bazel http_archive( @@ -52,6 +114,3 @@ http_archive( # sha256 = "832e2f309c57da9c1e6d4542dedd34b24e4192ecb4d62f6f4866a737454c9970", # urls = ["https://github.com/pybind/pybind11/archive/refs/tags/v2.10.4.tar.gz"], ) - -load("@pybind11_bazel//:python_configure.bzl", "python_configure") -python_configure(name = "local_config_python") diff --git a/WORKSPACE.bzlmod b/WORKSPACE.bzlmod new file mode 100644 index 0000000..8caebc7 --- /dev/null +++ b/WORKSPACE.bzlmod @@ -0,0 +1 @@ +# Present for cross-compatibility between MODULE.bazel and WORKSPACE diff --git a/pybind11_abseil/BUILD b/pybind11_abseil/BUILD index 4cff8b7..791c245 100644 --- a/pybind11_abseil/BUILD +++ b/pybind11_abseil/BUILD @@ -32,7 +32,7 @@ cc_library( visibility = ["//visibility:public"], deps = [ "@com_google_absl//absl/status", - "@local_config_python//:python_headers", # buildcleaner: keep + "@rules_python//python/cc:current_py_cc_headers", # buildcleaner: keep ], ) @@ -42,7 +42,7 @@ cc_library( visibility = ["//visibility:private"], deps = [ ":ok_status_singleton_lib", - "@local_config_python//:python_headers", # buildcleaner: keep + "@rules_python//python/cc:current_py_cc_headers", # buildcleaner: keep ], ) @@ -52,7 +52,7 @@ cc_binary( linkshared = 1, deps = [ ":ok_status_singleton_pyinit_google3", - "@local_config_python//:python_headers", # buildcleaner: keep + "@rules_python//python/cc:current_py_cc_headers", # buildcleaner: keep ], ) @@ -155,7 +155,7 @@ cc_binary( linkshared = 1, deps = [ ":status_pyinit_google3", - "@local_config_python//:python_headers", # buildcleaner: keep + "@rules_python//python/cc:current_py_cc_headers", # buildcleaner: keep ], ) diff --git a/pybind11_abseil/compat/BUILD b/pybind11_abseil/compat/BUILD index de52b56..9cbe963 100644 --- a/pybind11_abseil/compat/BUILD +++ b/pybind11_abseil/compat/BUILD @@ -13,7 +13,7 @@ cc_library( "@com_google_absl//absl/log:absl_check", "@com_google_absl//absl/log:absl_log", "@com_google_absl//absl/strings", - "@local_config_python//:python_headers", # buildcleaner: keep + "@rules_python//python/cc:current_py_cc_headers", # buildcleaner: keep ], ) @@ -26,7 +26,7 @@ cc_library( ":py_base_utilities", "@com_google_absl//absl/container:flat_hash_map", "@com_google_absl//absl/status", - "@local_config_python//:python_headers", # buildcleaner: keep + "@rules_python//python/cc:current_py_cc_headers", # buildcleaner: keep ], ) @@ -42,6 +42,6 @@ cc_library( "@com_google_absl//absl/log:absl_check", "@com_google_absl//absl/log:absl_log", "@com_google_absl//absl/status", - "@local_config_python//:python_headers", # buildcleaner: keep + "@rules_python//python/cc:current_py_cc_headers", # buildcleaner: keep ], ) diff --git a/pybind11_abseil/cpp_capsule_tools/BUILD b/pybind11_abseil/cpp_capsule_tools/BUILD index b594711..4138343 100644 --- a/pybind11_abseil/cpp_capsule_tools/BUILD +++ b/pybind11_abseil/cpp_capsule_tools/BUILD @@ -13,7 +13,7 @@ cc_library( "@com_google_absl//absl/status", "@com_google_absl//absl/status:statusor", "@com_google_absl//absl/strings", - "@local_config_python//:python_headers", # buildcleaner: keep + "@rules_python//python/cc:current_py_cc_headers", # buildcleaner: keep ], ) @@ -24,7 +24,7 @@ cc_library( deps = [ ":void_ptr_from_capsule", "@com_google_absl//absl/status:statusor", - "@local_config_python//:python_headers", # buildcleaner: keep + "@rules_python//python/cc:current_py_cc_headers", # buildcleaner: keep ], ) @@ -33,7 +33,7 @@ cc_library( hdrs = ["make_shared_ptr_capsule.h"], visibility = ["//visibility:public"], deps = [ - "@local_config_python//:python_headers", # buildcleaner: keep + "@rules_python//python/cc:current_py_cc_headers", # buildcleaner: keep ], ) @@ -44,6 +44,6 @@ cc_library( deps = [ ":void_ptr_from_capsule", "@com_google_absl//absl/status:statusor", - "@local_config_python//:python_headers", # buildcleaner: keep + "@rules_python//python/cc:current_py_cc_headers", # buildcleaner: keep ], ) diff --git a/pybind11_abseil/requirements/BUILD b/pybind11_abseil/requirements/BUILD new file mode 100644 index 0000000..23c97f9 --- /dev/null +++ b/pybind11_abseil/requirements/BUILD @@ -0,0 +1,39 @@ +package( + default_visibility = ["//visibility:private"], +) + +load("@python//3.12:defs.bzl", compile_pip_requirements_3_12 = "compile_pip_requirements") +load("@python//3.11:defs.bzl", compile_pip_requirements_3_11 = "compile_pip_requirements") +load("@python//3.10:defs.bzl", compile_pip_requirements_3_10 = "compile_pip_requirements") +load("@python//3.9:defs.bzl", compile_pip_requirements_3_9 = "compile_pip_requirements") +load("@python//3.8:defs.bzl", compile_pip_requirements_3_8 = "compile_pip_requirements") + +compile_pip_requirements_3_12( + name = "requirements_3_12", + src = "requirements.in", + requirements_txt = "requirements_lock_3_12.txt", +) + +compile_pip_requirements_3_11( + name = "requirements_3_11", + src = "requirements.in", + requirements_txt = "requirements_lock_3_11.txt", +) + +compile_pip_requirements_3_10( + name = "requirements_3_10", + src = "requirements.in", + requirements_txt = "requirements_lock_3_10.txt", +) + +compile_pip_requirements_3_9( + name = "requirements_3_9", + src = "requirements.in", + requirements_txt = "requirements_lock_3_9.txt", +) + +compile_pip_requirements_3_8( + name = "requirements_3_8", + src = "requirements.in", + requirements_txt = "requirements_lock_3_8.txt", +) diff --git a/requirements.txt b/pybind11_abseil/requirements/requirements.in similarity index 100% rename from requirements.txt rename to pybind11_abseil/requirements/requirements.in diff --git a/pybind11_abseil/requirements/requirements_lock_3_10.txt b/pybind11_abseil/requirements/requirements_lock_3_10.txt new file mode 100644 index 0000000..f166698 --- /dev/null +++ b/pybind11_abseil/requirements/requirements_lock_3_10.txt @@ -0,0 +1,48 @@ +# +# This file is autogenerated by pip-compile with Python 3.10 +# by the following command: +# +# bazel run //pybind11_abseil/requirements:requirements_3_10.update +# +absl-py==2.1.0 \ + --hash=sha256:526a04eadab8b4ee719ce68f204172ead1027549089702d99b9059f129ff1308 \ + --hash=sha256:7820790efbb316739cde8b4e19357243fc3608a152024288513dd968d7d959ff + # via -r pybind11_abseil/requirements/requirements.in +numpy==1.26.4 \ + --hash=sha256:03a8c78d01d9781b28a6989f6fa1bb2c4f2d51201cf99d3dd875df6fbd96b23b \ + --hash=sha256:08beddf13648eb95f8d867350f6a018a4be2e5ad54c8d8caed89ebca558b2818 \ + --hash=sha256:1af303d6b2210eb850fcf03064d364652b7120803a0b872f5211f5234b399f20 \ + --hash=sha256:1dda2e7b4ec9dd512f84935c5f126c8bd8b9f2fc001e9f54af255e8c5f16b0e0 \ + --hash=sha256:2a02aba9ed12e4ac4eb3ea9421c420301a0c6460d9830d74a9df87efa4912010 \ + --hash=sha256:2e4ee3380d6de9c9ec04745830fd9e2eccb3e6cf790d39d7b98ffd19b0dd754a \ + --hash=sha256:3373d5d70a5fe74a2c1bb6d2cfd9609ecf686d47a2d7b1d37a8f3b6bf6003aea \ + --hash=sha256:47711010ad8555514b434df65f7d7b076bb8261df1ca9bb78f53d3b2db02e95c \ + --hash=sha256:4c66707fabe114439db9068ee468c26bbdf909cac0fb58686a42a24de1760c71 \ + --hash=sha256:50193e430acfc1346175fcbdaa28ffec49947a06918b7b92130744e81e640110 \ + --hash=sha256:52b8b60467cd7dd1e9ed082188b4e6bb35aa5cdd01777621a1658910745b90be \ + --hash=sha256:60dedbb91afcbfdc9bc0b1f3f402804070deed7392c23eb7a7f07fa857868e8a \ + --hash=sha256:62b8e4b1e28009ef2846b4c7852046736bab361f7aeadeb6a5b89ebec3c7055a \ + --hash=sha256:666dbfb6ec68962c033a450943ded891bed2d54e6755e35e5835d63f4f6931d5 \ + --hash=sha256:675d61ffbfa78604709862923189bad94014bef562cc35cf61d3a07bba02a7ed \ + --hash=sha256:679b0076f67ecc0138fd2ede3a8fd196dddc2ad3254069bcb9faf9a79b1cebcd \ + --hash=sha256:7349ab0fa0c429c82442a27a9673fc802ffdb7c7775fad780226cb234965e53c \ + --hash=sha256:7ab55401287bfec946ced39700c053796e7cc0e3acbef09993a9ad2adba6ca6e \ + --hash=sha256:7e50d0a0cc3189f9cb0aeb3a6a6af18c16f59f004b866cd2be1c14b36134a4a0 \ + --hash=sha256:95a7476c59002f2f6c590b9b7b998306fba6a5aa646b1e22ddfeaf8f78c3a29c \ + --hash=sha256:96ff0b2ad353d8f990b63294c8986f1ec3cb19d749234014f4e7eb0112ceba5a \ + --hash=sha256:9fad7dcb1aac3c7f0584a5a8133e3a43eeb2fe127f47e3632d43d677c66c102b \ + --hash=sha256:9ff0f4f29c51e2803569d7a51c2304de5554655a60c5d776e35b4a41413830d0 \ + --hash=sha256:a354325ee03388678242a4d7ebcd08b5c727033fcff3b2f536aea978e15ee9e6 \ + --hash=sha256:a4abb4f9001ad2858e7ac189089c42178fcce737e4169dc61321660f1a96c7d2 \ + --hash=sha256:ab47dbe5cc8210f55aa58e4805fe224dac469cde56b9f731a4c098b91917159a \ + --hash=sha256:afedb719a9dcfc7eaf2287b839d8198e06dcd4cb5d276a3df279231138e83d30 \ + --hash=sha256:b3ce300f3644fb06443ee2222c2201dd3a89ea6040541412b8fa189341847218 \ + --hash=sha256:b97fe8060236edf3662adfc2c633f56a08ae30560c56310562cb4f95500022d5 \ + --hash=sha256:bfe25acf8b437eb2a8b2d49d443800a5f18508cd811fea3181723922a8a82b07 \ + --hash=sha256:cd25bcecc4974d09257ffcd1f098ee778f7834c3ad767fe5db785be9a4aa9cb2 \ + --hash=sha256:d209d8969599b27ad20994c8e41936ee0964e6da07478d6c35016bc386b66ad4 \ + --hash=sha256:d5241e0a80d808d70546c697135da2c613f30e28251ff8307eb72ba696945764 \ + --hash=sha256:edd8b5fe47dab091176d21bb6de568acdd906d1887a4584a15a9a96a1dca06ef \ + --hash=sha256:f870204a840a60da0b12273ef34f7051e98c3b5961b61b0c2c1be6dfd64fbcd3 \ + --hash=sha256:ffa75af20b44f8dba823498024771d5ac50620e6915abac414251bd971b4529f + # via -r pybind11_abseil/requirements/requirements.in diff --git a/pybind11_abseil/requirements/requirements_lock_3_11.txt b/pybind11_abseil/requirements/requirements_lock_3_11.txt new file mode 100644 index 0000000..9127dc3 --- /dev/null +++ b/pybind11_abseil/requirements/requirements_lock_3_11.txt @@ -0,0 +1,48 @@ +# +# This file is autogenerated by pip-compile with Python 3.11 +# by the following command: +# +# bazel run //pybind11_abseil/requirements:requirements_3_11.update +# +absl-py==2.1.0 \ + --hash=sha256:526a04eadab8b4ee719ce68f204172ead1027549089702d99b9059f129ff1308 \ + --hash=sha256:7820790efbb316739cde8b4e19357243fc3608a152024288513dd968d7d959ff + # via -r pybind11_abseil/requirements/requirements.in +numpy==1.26.4 \ + --hash=sha256:03a8c78d01d9781b28a6989f6fa1bb2c4f2d51201cf99d3dd875df6fbd96b23b \ + --hash=sha256:08beddf13648eb95f8d867350f6a018a4be2e5ad54c8d8caed89ebca558b2818 \ + --hash=sha256:1af303d6b2210eb850fcf03064d364652b7120803a0b872f5211f5234b399f20 \ + --hash=sha256:1dda2e7b4ec9dd512f84935c5f126c8bd8b9f2fc001e9f54af255e8c5f16b0e0 \ + --hash=sha256:2a02aba9ed12e4ac4eb3ea9421c420301a0c6460d9830d74a9df87efa4912010 \ + --hash=sha256:2e4ee3380d6de9c9ec04745830fd9e2eccb3e6cf790d39d7b98ffd19b0dd754a \ + --hash=sha256:3373d5d70a5fe74a2c1bb6d2cfd9609ecf686d47a2d7b1d37a8f3b6bf6003aea \ + --hash=sha256:47711010ad8555514b434df65f7d7b076bb8261df1ca9bb78f53d3b2db02e95c \ + --hash=sha256:4c66707fabe114439db9068ee468c26bbdf909cac0fb58686a42a24de1760c71 \ + --hash=sha256:50193e430acfc1346175fcbdaa28ffec49947a06918b7b92130744e81e640110 \ + --hash=sha256:52b8b60467cd7dd1e9ed082188b4e6bb35aa5cdd01777621a1658910745b90be \ + --hash=sha256:60dedbb91afcbfdc9bc0b1f3f402804070deed7392c23eb7a7f07fa857868e8a \ + --hash=sha256:62b8e4b1e28009ef2846b4c7852046736bab361f7aeadeb6a5b89ebec3c7055a \ + --hash=sha256:666dbfb6ec68962c033a450943ded891bed2d54e6755e35e5835d63f4f6931d5 \ + --hash=sha256:675d61ffbfa78604709862923189bad94014bef562cc35cf61d3a07bba02a7ed \ + --hash=sha256:679b0076f67ecc0138fd2ede3a8fd196dddc2ad3254069bcb9faf9a79b1cebcd \ + --hash=sha256:7349ab0fa0c429c82442a27a9673fc802ffdb7c7775fad780226cb234965e53c \ + --hash=sha256:7ab55401287bfec946ced39700c053796e7cc0e3acbef09993a9ad2adba6ca6e \ + --hash=sha256:7e50d0a0cc3189f9cb0aeb3a6a6af18c16f59f004b866cd2be1c14b36134a4a0 \ + --hash=sha256:95a7476c59002f2f6c590b9b7b998306fba6a5aa646b1e22ddfeaf8f78c3a29c \ + --hash=sha256:96ff0b2ad353d8f990b63294c8986f1ec3cb19d749234014f4e7eb0112ceba5a \ + --hash=sha256:9fad7dcb1aac3c7f0584a5a8133e3a43eeb2fe127f47e3632d43d677c66c102b \ + --hash=sha256:9ff0f4f29c51e2803569d7a51c2304de5554655a60c5d776e35b4a41413830d0 \ + --hash=sha256:a354325ee03388678242a4d7ebcd08b5c727033fcff3b2f536aea978e15ee9e6 \ + --hash=sha256:a4abb4f9001ad2858e7ac189089c42178fcce737e4169dc61321660f1a96c7d2 \ + --hash=sha256:ab47dbe5cc8210f55aa58e4805fe224dac469cde56b9f731a4c098b91917159a \ + --hash=sha256:afedb719a9dcfc7eaf2287b839d8198e06dcd4cb5d276a3df279231138e83d30 \ + --hash=sha256:b3ce300f3644fb06443ee2222c2201dd3a89ea6040541412b8fa189341847218 \ + --hash=sha256:b97fe8060236edf3662adfc2c633f56a08ae30560c56310562cb4f95500022d5 \ + --hash=sha256:bfe25acf8b437eb2a8b2d49d443800a5f18508cd811fea3181723922a8a82b07 \ + --hash=sha256:cd25bcecc4974d09257ffcd1f098ee778f7834c3ad767fe5db785be9a4aa9cb2 \ + --hash=sha256:d209d8969599b27ad20994c8e41936ee0964e6da07478d6c35016bc386b66ad4 \ + --hash=sha256:d5241e0a80d808d70546c697135da2c613f30e28251ff8307eb72ba696945764 \ + --hash=sha256:edd8b5fe47dab091176d21bb6de568acdd906d1887a4584a15a9a96a1dca06ef \ + --hash=sha256:f870204a840a60da0b12273ef34f7051e98c3b5961b61b0c2c1be6dfd64fbcd3 \ + --hash=sha256:ffa75af20b44f8dba823498024771d5ac50620e6915abac414251bd971b4529f + # via -r pybind11_abseil/requirements/requirements.in diff --git a/pybind11_abseil/requirements/requirements_lock_3_12.txt b/pybind11_abseil/requirements/requirements_lock_3_12.txt new file mode 100644 index 0000000..7ed545e --- /dev/null +++ b/pybind11_abseil/requirements/requirements_lock_3_12.txt @@ -0,0 +1,48 @@ +# +# This file is autogenerated by pip-compile with Python 3.12 +# by the following command: +# +# bazel run //pybind11_abseil/requirements:requirements_3_12.update +# +absl-py==2.1.0 \ + --hash=sha256:526a04eadab8b4ee719ce68f204172ead1027549089702d99b9059f129ff1308 \ + --hash=sha256:7820790efbb316739cde8b4e19357243fc3608a152024288513dd968d7d959ff + # via -r pybind11_abseil/requirements/requirements.in +numpy==1.26.4 \ + --hash=sha256:03a8c78d01d9781b28a6989f6fa1bb2c4f2d51201cf99d3dd875df6fbd96b23b \ + --hash=sha256:08beddf13648eb95f8d867350f6a018a4be2e5ad54c8d8caed89ebca558b2818 \ + --hash=sha256:1af303d6b2210eb850fcf03064d364652b7120803a0b872f5211f5234b399f20 \ + --hash=sha256:1dda2e7b4ec9dd512f84935c5f126c8bd8b9f2fc001e9f54af255e8c5f16b0e0 \ + --hash=sha256:2a02aba9ed12e4ac4eb3ea9421c420301a0c6460d9830d74a9df87efa4912010 \ + --hash=sha256:2e4ee3380d6de9c9ec04745830fd9e2eccb3e6cf790d39d7b98ffd19b0dd754a \ + --hash=sha256:3373d5d70a5fe74a2c1bb6d2cfd9609ecf686d47a2d7b1d37a8f3b6bf6003aea \ + --hash=sha256:47711010ad8555514b434df65f7d7b076bb8261df1ca9bb78f53d3b2db02e95c \ + --hash=sha256:4c66707fabe114439db9068ee468c26bbdf909cac0fb58686a42a24de1760c71 \ + --hash=sha256:50193e430acfc1346175fcbdaa28ffec49947a06918b7b92130744e81e640110 \ + --hash=sha256:52b8b60467cd7dd1e9ed082188b4e6bb35aa5cdd01777621a1658910745b90be \ + --hash=sha256:60dedbb91afcbfdc9bc0b1f3f402804070deed7392c23eb7a7f07fa857868e8a \ + --hash=sha256:62b8e4b1e28009ef2846b4c7852046736bab361f7aeadeb6a5b89ebec3c7055a \ + --hash=sha256:666dbfb6ec68962c033a450943ded891bed2d54e6755e35e5835d63f4f6931d5 \ + --hash=sha256:675d61ffbfa78604709862923189bad94014bef562cc35cf61d3a07bba02a7ed \ + --hash=sha256:679b0076f67ecc0138fd2ede3a8fd196dddc2ad3254069bcb9faf9a79b1cebcd \ + --hash=sha256:7349ab0fa0c429c82442a27a9673fc802ffdb7c7775fad780226cb234965e53c \ + --hash=sha256:7ab55401287bfec946ced39700c053796e7cc0e3acbef09993a9ad2adba6ca6e \ + --hash=sha256:7e50d0a0cc3189f9cb0aeb3a6a6af18c16f59f004b866cd2be1c14b36134a4a0 \ + --hash=sha256:95a7476c59002f2f6c590b9b7b998306fba6a5aa646b1e22ddfeaf8f78c3a29c \ + --hash=sha256:96ff0b2ad353d8f990b63294c8986f1ec3cb19d749234014f4e7eb0112ceba5a \ + --hash=sha256:9fad7dcb1aac3c7f0584a5a8133e3a43eeb2fe127f47e3632d43d677c66c102b \ + --hash=sha256:9ff0f4f29c51e2803569d7a51c2304de5554655a60c5d776e35b4a41413830d0 \ + --hash=sha256:a354325ee03388678242a4d7ebcd08b5c727033fcff3b2f536aea978e15ee9e6 \ + --hash=sha256:a4abb4f9001ad2858e7ac189089c42178fcce737e4169dc61321660f1a96c7d2 \ + --hash=sha256:ab47dbe5cc8210f55aa58e4805fe224dac469cde56b9f731a4c098b91917159a \ + --hash=sha256:afedb719a9dcfc7eaf2287b839d8198e06dcd4cb5d276a3df279231138e83d30 \ + --hash=sha256:b3ce300f3644fb06443ee2222c2201dd3a89ea6040541412b8fa189341847218 \ + --hash=sha256:b97fe8060236edf3662adfc2c633f56a08ae30560c56310562cb4f95500022d5 \ + --hash=sha256:bfe25acf8b437eb2a8b2d49d443800a5f18508cd811fea3181723922a8a82b07 \ + --hash=sha256:cd25bcecc4974d09257ffcd1f098ee778f7834c3ad767fe5db785be9a4aa9cb2 \ + --hash=sha256:d209d8969599b27ad20994c8e41936ee0964e6da07478d6c35016bc386b66ad4 \ + --hash=sha256:d5241e0a80d808d70546c697135da2c613f30e28251ff8307eb72ba696945764 \ + --hash=sha256:edd8b5fe47dab091176d21bb6de568acdd906d1887a4584a15a9a96a1dca06ef \ + --hash=sha256:f870204a840a60da0b12273ef34f7051e98c3b5961b61b0c2c1be6dfd64fbcd3 \ + --hash=sha256:ffa75af20b44f8dba823498024771d5ac50620e6915abac414251bd971b4529f + # via -r pybind11_abseil/requirements/requirements.in diff --git a/pybind11_abseil/requirements/requirements_lock_3_8.txt b/pybind11_abseil/requirements/requirements_lock_3_8.txt new file mode 100644 index 0000000..83be303 --- /dev/null +++ b/pybind11_abseil/requirements/requirements_lock_3_8.txt @@ -0,0 +1,40 @@ +# +# This file is autogenerated by pip-compile with Python 3.8 +# by the following command: +# +# bazel run //pybind11_abseil/requirements:requirements_3_8.update +# +absl-py==2.1.0 \ + --hash=sha256:526a04eadab8b4ee719ce68f204172ead1027549089702d99b9059f129ff1308 \ + --hash=sha256:7820790efbb316739cde8b4e19357243fc3608a152024288513dd968d7d959ff + # via -r pybind11_abseil/requirements/requirements.in +numpy==1.24.4 \ + --hash=sha256:04640dab83f7c6c85abf9cd729c5b65f1ebd0ccf9de90b270cd61935eef0197f \ + --hash=sha256:1452241c290f3e2a312c137a9999cdbf63f78864d63c79039bda65ee86943f61 \ + --hash=sha256:222e40d0e2548690405b0b3c7b21d1169117391c2e82c378467ef9ab4c8f0da7 \ + --hash=sha256:2541312fbf09977f3b3ad449c4e5f4bb55d0dbf79226d7724211acc905049400 \ + --hash=sha256:31f13e25b4e304632a4619d0e0777662c2ffea99fcae2029556b17d8ff958aef \ + --hash=sha256:4602244f345453db537be5314d3983dbf5834a9701b7723ec28923e2889e0bb2 \ + --hash=sha256:4979217d7de511a8d57f4b4b5b2b965f707768440c17cb70fbf254c4b225238d \ + --hash=sha256:4c21decb6ea94057331e111a5bed9a79d335658c27ce2adb580fb4d54f2ad9bc \ + --hash=sha256:6620c0acd41dbcb368610bb2f4d83145674040025e5536954782467100aa8835 \ + --hash=sha256:692f2e0f55794943c5bfff12b3f56f99af76f902fc47487bdfe97856de51a706 \ + --hash=sha256:7215847ce88a85ce39baf9e89070cb860c98fdddacbaa6c0da3ffb31b3350bd5 \ + --hash=sha256:79fc682a374c4a8ed08b331bef9c5f582585d1048fa6d80bc6c35bc384eee9b4 \ + --hash=sha256:7ffe43c74893dbf38c2b0a1f5428760a1a9c98285553c89e12d70a96a7f3a4d6 \ + --hash=sha256:80f5e3a4e498641401868df4208b74581206afbee7cf7b8329daae82676d9463 \ + --hash=sha256:95f7ac6540e95bc440ad77f56e520da5bf877f87dca58bd095288dce8940532a \ + --hash=sha256:9667575fb6d13c95f1b36aca12c5ee3356bf001b714fc354eb5465ce1609e62f \ + --hash=sha256:a5425b114831d1e77e4b5d812b69d11d962e104095a5b9c3b641a218abcc050e \ + --hash=sha256:b4bea75e47d9586d31e892a7401f76e909712a0fd510f58f5337bea9572c571e \ + --hash=sha256:b7b1fc9864d7d39e28f41d089bfd6353cb5f27ecd9905348c24187a768c79694 \ + --hash=sha256:befe2bf740fd8373cf56149a5c23a0f601e82869598d41f8e188a0e9869926f8 \ + --hash=sha256:c0bfb52d2169d58c1cdb8cc1f16989101639b34c7d3ce60ed70b19c63eba0b64 \ + --hash=sha256:d11efb4dbecbdf22508d55e48d9c8384db795e1b7b51ea735289ff96613ff74d \ + --hash=sha256:dd80e219fd4c71fc3699fc1dadac5dcf4fd882bfc6f7ec53d30fa197b8ee22dc \ + --hash=sha256:e2926dac25b313635e4d6cf4dc4e51c8c0ebfed60b801c799ffc4c32bf3d1254 \ + --hash=sha256:e98f220aa76ca2a977fe435f5b04d7b3470c0a2e6312907b37ba6068f26787f2 \ + --hash=sha256:ed094d4f0c177b1b8e7aa9cba7d6ceed51c0e569a5318ac0ca9a090680a6a1b1 \ + --hash=sha256:f136bab9c2cfd8da131132c2cf6cc27331dd6fae65f95f69dcd4ae3c3639c810 \ + --hash=sha256:f3a86ed21e4f87050382c7bc96571755193c4c1392490744ac73d660e8f564a9 + # via -r pybind11_abseil/requirements/requirements.in diff --git a/pybind11_abseil/requirements/requirements_lock_3_9.txt b/pybind11_abseil/requirements/requirements_lock_3_9.txt new file mode 100644 index 0000000..226c82a --- /dev/null +++ b/pybind11_abseil/requirements/requirements_lock_3_9.txt @@ -0,0 +1,48 @@ +# +# This file is autogenerated by pip-compile with Python 3.9 +# by the following command: +# +# bazel run //pybind11_abseil/requirements:requirements_3_9.update +# +absl-py==2.1.0 \ + --hash=sha256:526a04eadab8b4ee719ce68f204172ead1027549089702d99b9059f129ff1308 \ + --hash=sha256:7820790efbb316739cde8b4e19357243fc3608a152024288513dd968d7d959ff + # via -r pybind11_abseil/requirements/requirements.in +numpy==1.26.4 \ + --hash=sha256:03a8c78d01d9781b28a6989f6fa1bb2c4f2d51201cf99d3dd875df6fbd96b23b \ + --hash=sha256:08beddf13648eb95f8d867350f6a018a4be2e5ad54c8d8caed89ebca558b2818 \ + --hash=sha256:1af303d6b2210eb850fcf03064d364652b7120803a0b872f5211f5234b399f20 \ + --hash=sha256:1dda2e7b4ec9dd512f84935c5f126c8bd8b9f2fc001e9f54af255e8c5f16b0e0 \ + --hash=sha256:2a02aba9ed12e4ac4eb3ea9421c420301a0c6460d9830d74a9df87efa4912010 \ + --hash=sha256:2e4ee3380d6de9c9ec04745830fd9e2eccb3e6cf790d39d7b98ffd19b0dd754a \ + --hash=sha256:3373d5d70a5fe74a2c1bb6d2cfd9609ecf686d47a2d7b1d37a8f3b6bf6003aea \ + --hash=sha256:47711010ad8555514b434df65f7d7b076bb8261df1ca9bb78f53d3b2db02e95c \ + --hash=sha256:4c66707fabe114439db9068ee468c26bbdf909cac0fb58686a42a24de1760c71 \ + --hash=sha256:50193e430acfc1346175fcbdaa28ffec49947a06918b7b92130744e81e640110 \ + --hash=sha256:52b8b60467cd7dd1e9ed082188b4e6bb35aa5cdd01777621a1658910745b90be \ + --hash=sha256:60dedbb91afcbfdc9bc0b1f3f402804070deed7392c23eb7a7f07fa857868e8a \ + --hash=sha256:62b8e4b1e28009ef2846b4c7852046736bab361f7aeadeb6a5b89ebec3c7055a \ + --hash=sha256:666dbfb6ec68962c033a450943ded891bed2d54e6755e35e5835d63f4f6931d5 \ + --hash=sha256:675d61ffbfa78604709862923189bad94014bef562cc35cf61d3a07bba02a7ed \ + --hash=sha256:679b0076f67ecc0138fd2ede3a8fd196dddc2ad3254069bcb9faf9a79b1cebcd \ + --hash=sha256:7349ab0fa0c429c82442a27a9673fc802ffdb7c7775fad780226cb234965e53c \ + --hash=sha256:7ab55401287bfec946ced39700c053796e7cc0e3acbef09993a9ad2adba6ca6e \ + --hash=sha256:7e50d0a0cc3189f9cb0aeb3a6a6af18c16f59f004b866cd2be1c14b36134a4a0 \ + --hash=sha256:95a7476c59002f2f6c590b9b7b998306fba6a5aa646b1e22ddfeaf8f78c3a29c \ + --hash=sha256:96ff0b2ad353d8f990b63294c8986f1ec3cb19d749234014f4e7eb0112ceba5a \ + --hash=sha256:9fad7dcb1aac3c7f0584a5a8133e3a43eeb2fe127f47e3632d43d677c66c102b \ + --hash=sha256:9ff0f4f29c51e2803569d7a51c2304de5554655a60c5d776e35b4a41413830d0 \ + --hash=sha256:a354325ee03388678242a4d7ebcd08b5c727033fcff3b2f536aea978e15ee9e6 \ + --hash=sha256:a4abb4f9001ad2858e7ac189089c42178fcce737e4169dc61321660f1a96c7d2 \ + --hash=sha256:ab47dbe5cc8210f55aa58e4805fe224dac469cde56b9f731a4c098b91917159a \ + --hash=sha256:afedb719a9dcfc7eaf2287b839d8198e06dcd4cb5d276a3df279231138e83d30 \ + --hash=sha256:b3ce300f3644fb06443ee2222c2201dd3a89ea6040541412b8fa189341847218 \ + --hash=sha256:b97fe8060236edf3662adfc2c633f56a08ae30560c56310562cb4f95500022d5 \ + --hash=sha256:bfe25acf8b437eb2a8b2d49d443800a5f18508cd811fea3181723922a8a82b07 \ + --hash=sha256:cd25bcecc4974d09257ffcd1f098ee778f7834c3ad767fe5db785be9a4aa9cb2 \ + --hash=sha256:d209d8969599b27ad20994c8e41936ee0964e6da07478d6c35016bc386b66ad4 \ + --hash=sha256:d5241e0a80d808d70546c697135da2c613f30e28251ff8307eb72ba696945764 \ + --hash=sha256:edd8b5fe47dab091176d21bb6de568acdd906d1887a4584a15a9a96a1dca06ef \ + --hash=sha256:f870204a840a60da0b12273ef34f7051e98c3b5961b61b0c2c1be6dfd64fbcd3 \ + --hash=sha256:ffa75af20b44f8dba823498024771d5ac50620e6915abac414251bd971b4529f + # via -r pybind11_abseil/requirements/requirements.in diff --git a/pybind11_abseil/tests/BUILD b/pybind11_abseil/tests/BUILD index d516bfb..02d32d4 100644 --- a/pybind11_abseil/tests/BUILD +++ b/pybind11_abseil/tests/BUILD @@ -1,6 +1,7 @@ # Tests and examples for pybind11_abseil. load("@pybind11_bazel//:build_defs.bzl", "pybind_extension") +load("@pypi//:requirements.bzl", "requirement") licenses(["notice"]) @@ -21,6 +22,7 @@ py_test( data = [":cpp_capsule_tools_testing.so"], python_version = "PY3", srcs_version = "PY3", + deps = [requirement("absl_py")], ) cc_library( @@ -30,7 +32,7 @@ cc_library( "@com_google_absl//absl/log:absl_check", "@com_google_absl//absl/status", "@com_google_absl//absl/status:statusor", - "@local_config_python//:python_headers", # buildcleaner: keep + "@rules_python//python/cc:current_py_cc_headers", # buildcleaner: keep ], ) @@ -49,6 +51,7 @@ py_library( name = "status_testing_no_cpp_eh_test_lib", srcs = ["status_testing_no_cpp_eh_test_lib.py"], data = ["//pybind11_abseil:status.so"], + deps = [requirement("absl_py")], ) pybind_extension( @@ -71,6 +74,10 @@ py_test( data = [":absl_example.so"], python_version = "PY3", srcs_version = "PY3", + deps = [ + requirement("absl_py"), + requirement("numpy"), + ], ) py_test( @@ -79,6 +86,7 @@ py_test( data = ["//pybind11_abseil:ok_status_singleton.so"], python_version = "PY3", srcs_version = "PY3", + deps = [requirement("absl_py")], ) pybind_extension( @@ -106,6 +114,7 @@ py_test( data = ["//pybind11_abseil:status.so"], python_version = "PY3", srcs_version = "PY3", + deps = [requirement("absl_py")], ) pybind_extension( @@ -127,4 +136,5 @@ py_test( ], python_version = "PY3", srcs_version = "PY3", + deps = [requirement("absl_py")], ) diff --git a/scripts/build_and_run_tests_bazel.sh b/scripts/build_and_run_tests_bazel.sh index ef81c13..5e7b8c4 100755 --- a/scripts/build_and_run_tests_bazel.sh +++ b/scripts/build_and_run_tests_bazel.sh @@ -1,8 +1,7 @@ #!/bin/bash # The following scripts: -# - creates a virtualenv -# - installs the pip package dependencies +# - updates the frozen dependencies # - builds and runs tests set -e # exit when any command fails @@ -20,59 +19,6 @@ then exit 1 fi -VIRTUAL_ENV_BINARY=$(which virtualenv || true) -if [[ -z $VIRTUAL_ENV_BINARY || ! -x $VIRTUAL_ENV_BINARY ]] -then - echo -e -n '\e[1m\e[93m' - echo -n 'virtualenv command not found ' - echo -n '(try `python3 -m pip install virtualenv`, possibly as root). ' - echo -e 'Exiting...\e[0m' - exit 1 -fi - -is_in_virtual_env="false" -# if we are in a virtual_env, we will not create a new one inside. -if [[ "$VIRTUAL_ENV" != "" ]] -then - echo -e "\e[1m\e[93mVirtualenv already detected. We do not create a new one.\e[0m" - is_in_virtual_env="true" -fi - -echo -e "\e[33mRunning ${0} from $PWD\e[0m" -PYBIN=$(which python3 || true) -if [[ -z $PYBIN || ! -x $PYBIN ]] -then - echo -e '\e[1m\e[93mpython3 not found! Skip build and test.\e[0m' - exit 1 -fi - -PYVERSION=$($PYBIN -c 'import sys; print(".".join(map(str, sys.version_info[:3])))') - -VENV_DIR="./venv" - -if [[ $is_in_virtual_env == "false" ]]; then - if ! [ -d "$VENV_DIR" ]; then - echo "Installing..." - echo -e "\e[33mInstalling a virtualenv to $VENV_DIR. The setup is long the first time, please wait.\e[0m" - virtualenv -p $PYBIN $VENV_DIR - else - echo -e "\e[33mReusing virtualenv from $VENV_DIR.\e[0m" - fi - source $VENV_DIR/bin/activate -fi - -# We only exit the virtualenv if we created one. -function cleanup { - if [[ $is_in_virtual_env == "true" ]]; then - echo "Exiting virtualenv" - deactivate - fi -} -trap cleanup EXIT - -echo -e "\e[33mInstalling the requirements (use --noinstall to skip).\e[0m" -pip3 install --upgrade -r ./requirements.txt - echo "Building and testing in $PWD using 'python' (version $PYVERSION)." export PYTHON_BIN_PATH=`which python3` @@ -80,5 +26,8 @@ export PYTHON_LIB_PATH=`python3 -c "import sysconfig; print(sysconfig.get_path(' echo "Using PYTHON_BIN_PATH: $PYTHON_BIN_PATH" echo "Using PYTHON_LIB_PATH: $PYTHON_LIB_PATH" -BAZEL_CXXOPTS="-std=c++17" bazel test ... --test_output=errors "$@" -BAZEL_CXXOPTS="-std=c++20" bazel test ... --test_output=errors "$@" +BAZEL_CXXOPTS="-std=c++17" bazel test ... --test_output=errors "$@" --enable_bzlmod +BAZEL_CXXOPTS="-std=c++20" bazel test ... --test_output=errors "$@" --enable_bzlmod + +BAZEL_CXXOPTS="-std=c++17" bazel test ... --test_output=errors "$@" --noenable_bzlmod +BAZEL_CXXOPTS="-std=c++20" bazel test ... --test_output=errors "$@" --noenable_bzlmod diff --git a/scripts/build_and_run_tests_cmake.sh b/scripts/build_and_run_tests_cmake.sh index e9bc758..2f9de2f 100755 --- a/scripts/build_and_run_tests_cmake.sh +++ b/scripts/build_and_run_tests_cmake.sh @@ -71,7 +71,7 @@ function cleanup { trap cleanup EXIT echo -e "\e[33mInstalling the requirements (use --noinstall to skip).\e[0m" -pip3 install --upgrade -r ./requirements.txt +pip3 install --upgrade -r ./pybind11_abseil/requirements/requirements.in echo "Building and testing in $PWD using 'python' (version $PYVERSION)."