# Copyright 2010-2025 Google LLC # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # Description: python wrapping of (some of) the code in ../, plus # some generic utilities for SWIG python. load("@pip_deps//:requirements.bzl", "requirement") load("@pybind11_bazel//:build_defs.bzl", "pybind_extension") load("@rules_cc//cc:cc_library.bzl", "cc_library") load("@rules_python//python:py_library.bzl", "py_library") load("@rules_python//python:py_test.bzl", "py_test") cc_library( name = "sorted_interval_list_doc", hdrs = ["sorted_interval_list_doc.h"], visibility = ["//visibility:public"], ) pybind_extension( name = "sorted_interval_list", srcs = ["sorted_interval_list.cc"], visibility = ["//visibility:public"], deps = [ ":sorted_interval_list_doc", "//ortools/util:sorted_interval_list", "@abseil-cpp//absl/strings", ], ) py_test( name = "sorted_interval_list_test", srcs = ["sorted_interval_list_test.py"], deps = [ ":sorted_interval_list", requirement("absl-py"), ], ) cc_library( name = "py_solve_interrupter_lib", srcs = ["py_solve_interrupter.cc"], hdrs = ["py_solve_interrupter.h"], # This library is not meant to be consumed end users; only by C++ code of # Clif libraries that needs a SolverInterrupter. visibility = [ "//ortools/math_opt/core/python:__subpackages__", "//ortools/math_opt/python:__subpackages__", ], deps = [ "//ortools/util:solve_interrupter", "@abseil-cpp//absl/base:core_headers", "@abseil-cpp//absl/base:nullability", "@abseil-cpp//absl/log", "@abseil-cpp//absl/synchronization", ], ) cc_library( name = "py_solve_interrupter_testing_lib", testonly = True, srcs = ["py_solve_interrupter_testing.cc"], hdrs = ["py_solve_interrupter_testing.h"], deps = [ ":py_solve_interrupter_lib", "@abseil-cpp//absl/base:nullability", ], ) pybind_extension( name = "pybind_solve_interrupter", srcs = ["pybind_solve_interrupter.cc"], # This library is not meant to be consumed end users; only pybind11 code # that needs a SolverInterrupter. visibility = ["//visibility:public"], deps = [":py_solve_interrupter_lib"], ) pybind_extension( name = "pybind_solve_interrupter_testing", testonly = True, srcs = ["pybind_solve_interrupter_testing.cc"], visibility = ["//visibility:public"], deps = [":py_solve_interrupter_testing_lib"], ) py_test( name = "pybind_solve_interrupter_test", srcs = ["pybind_solve_interrupter_test.py"], deps = [ ":pybind_solve_interrupter", ":pybind_solve_interrupter_testing", requirement("absl-py"), ], ) py_library( name = "solve_interrupter", srcs = ["solve_interrupter.py"], visibility = ["//visibility:public"], deps = [ ":py_solve_interrupter_lib", ":pybind_solve_interrupter", requirement("absl-py"), ], ) py_test( name = "solve_interrupter_test", srcs = ["solve_interrupter_test.py"], deps = [ ":py_solve_interrupter_testing_lib", ":pybind_solve_interrupter_testing", ":solve_interrupter", requirement("absl-py"), ], )