Skip to content

Commit 60f2a08

Browse files
dmitriplotnikovcopybara-github
authored andcommitted
Rename py_cel_extension to cel_extension
PiperOrigin-RevId: 868369366
1 parent 370e0a2 commit 60f2a08

16 files changed

Lines changed: 65 additions & 65 deletions

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ expr = cel_env.compile("my_func(1)")
233233
#### Defining a custom extension in C++
234234

235235
To define a custom extension in C++, define a class extending
236-
`cel_python::PyCelExtension`. There are two methods you will need to implement:
236+
`cel_python::CelExtension`. There are two methods you will need to implement:
237237
`ConfigureCompiler` and `ConfigureRuntime`. The implementations of these methods
238238
use the same API as extensions written for the C++ CEL runtime. In fact,
239239
extensions written for the C++ runtime can be used unchanged with PyCEL - you
@@ -297,7 +297,7 @@ absl::Status ConfigureRuntime(cel::RuntimeBuilder& runtime_builder,
297297
}
298298
```
299299

300-
Once you have the custom subclass of `cel_python::PyCelExtension`, add this line
300+
Once you have the custom subclass of `cel_python::CelExtension`, add this line
301301
to turn this class into a Python module:
302302

303303
```cpp

custom_ext/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pybind_extension(
1212
],
1313
deps = [
1414
"//py_cel",
15-
"//py_cel:py_cel_extension",
15+
"//py_cel:cel_extension",
1616
"//py_cel:status_macros",
1717
"@com_google_absl//absl/base:nullability",
1818
"@com_google_absl//absl/status",

custom_ext/sample_cel_ext.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include "runtime/function_adapter.h"
2424
#include "runtime/runtime_builder.h"
2525
#include "runtime/runtime_options.h"
26-
#include "py_cel/py_cel_extension.h"
26+
#include "py_cel/cel_extension.h"
2727
#include "py_cel/status_macros.h"
2828
#include "google/protobuf/arena.h"
2929
#include "google/protobuf/descriptor.h"
@@ -63,10 +63,10 @@ static absl::StatusOr<StringValue> Translate(
6363

6464
} // namespace
6565

66-
class SampleCelExtension : public cel_python::PyCelExtension {
66+
class SampleCelExtension : public cel_python::CelExtension {
6767
public:
6868
explicit SampleCelExtension()
69-
: cel_python::PyCelExtension("sample.cel.cpp.ext") {}
69+
: cel_python::CelExtension("sample.cel.cpp.ext") {}
7070

7171
absl::Status ConfigureCompiler(
7272
cel::CompilerBuilder& compiler_builder,

py_cel/BUILD

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ pybind_extension(
4545
],
4646
visibility = ["//visibility:public"],
4747
deps = [
48-
":py_cel_extension",
48+
":cel_extension",
4949
":status_macros",
5050
"@com_google_absl//absl/base",
5151
"@com_google_absl//absl/base:no_destructor",
@@ -95,8 +95,8 @@ pybind_extension(
9595

9696
# For pybind11-based CEL extensions.
9797
pybind_library(
98-
name = "py_cel_extension",
99-
hdrs = ["py_cel_extension.h"],
98+
name = "cel_extension",
99+
hdrs = ["cel_extension.h"],
100100
visibility = ["//visibility:public"],
101101
deps = [
102102
"@com_google_absl//absl/status",
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ namespace cel_python {
3737

3838
// Base class used for pybind11-based extensions. It is not instantiable from
3939
// Python.
40-
class PyCelExtension {
40+
class CelExtension {
4141
public:
42-
explicit PyCelExtension(std::string name) : name_(std::move(name)) {};
43-
virtual ~PyCelExtension() = default;
42+
explicit CelExtension(std::string name) : name_(std::move(name)) {};
43+
virtual ~CelExtension() = default;
4444

4545
virtual absl::Status ConfigureCompiler(
4646
cel::CompilerBuilder& compiler_builder,
@@ -59,7 +59,7 @@ class PyCelExtension {
5959
std::string name_;
6060
};
6161

62-
#define PY_CEL_MODULE_NAME "py_cel"
62+
#define CEL_MODULE_NAME "py_cel"
6363

6464
// Macro for defining a pybind11 module for a CEL extension. The macro takes two
6565
// arguments: the name of the module and the name of the extension class. It
@@ -70,16 +70,16 @@ class PyCelExtension {
7070
//
7171
// Example:
7272
//
73-
// class SampleCelExtension : public cel_python::PyCelExtension {
73+
// class SampleCelExtension : public cel_python::CelExtension {
7474
// ...
7575
// };
7676
//
7777
// CEL_EXTENSION_MODULE(sample_cel_ext, SampleCelExtension);
7878
//
7979
#define CEL_EXTENSION_MODULE(module_name, class_name) \
8080
PYBIND11_MODULE(module_name, m) { \
81-
pybind11::module_::import(PY_CEL_MODULE_NAME); \
82-
pybind11::class_<class_name, cel_python::PyCelExtension>(m, #class_name) \
81+
pybind11::module_::import(CEL_MODULE_NAME); \
82+
pybind11::class_<class_name, cel_python::CelExtension>(m, #class_name) \
8383
.def(pybind11::init<>()); \
8484
}
8585

py_cel/ext/BUILD

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pybind_extension(
1212
],
1313
visibility = ["//visibility:public"],
1414
deps = [
15-
"//py_cel:py_cel_extension",
15+
"//py_cel:cel_extension",
1616
"@com_google_absl//absl/status",
1717
"@com_google_cel_cpp//compiler",
1818
"@com_google_cel_cpp//extensions:bindings_ext",
@@ -30,7 +30,7 @@ pybind_extension(
3030
],
3131
visibility = ["//visibility:public"],
3232
deps = [
33-
"//py_cel:py_cel_extension",
33+
"//py_cel:cel_extension",
3434
"@com_google_absl//absl/status",
3535
"@com_google_cel_cpp//checker:type_checker_builder",
3636
"@com_google_cel_cpp//compiler",
@@ -51,7 +51,7 @@ pybind_extension(
5151
],
5252
visibility = ["//visibility:public"],
5353
deps = [
54-
"//py_cel:py_cel_extension",
54+
"//py_cel:cel_extension",
5555
"//py_cel:status_macros",
5656
"@com_google_absl//absl/base:nullability",
5757
"@com_google_absl//absl/status",
@@ -84,7 +84,7 @@ pybind_extension(
8484
],
8585
visibility = ["//visibility:public"],
8686
deps = [
87-
"//py_cel:py_cel_extension",
87+
"//py_cel:cel_extension",
8888
"@com_google_absl//absl/status",
8989
"@com_google_cel_cpp//compiler",
9090
"@com_google_cel_cpp//compiler:optional",
@@ -105,7 +105,7 @@ pybind_extension(
105105
],
106106
visibility = ["//visibility:public"],
107107
deps = [
108-
"//py_cel:py_cel_extension",
108+
"//py_cel:cel_extension",
109109
"@com_google_absl//absl/status",
110110
"@com_google_cel_cpp//compiler",
111111
"@com_google_cel_cpp//extensions:proto_ext",
@@ -123,7 +123,7 @@ pybind_extension(
123123
],
124124
visibility = ["//visibility:public"],
125125
deps = [
126-
"//py_cel:py_cel_extension",
126+
"//py_cel:cel_extension",
127127
"@com_google_absl//absl/status",
128128
"@com_google_cel_cpp//compiler",
129129
"@com_google_cel_cpp//extensions:strings",

py_cel/ext/ext_bindings.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515
#include "absl/status/status.h"
1616
#include "compiler/compiler.h"
1717
#include "extensions/bindings_ext.h"
18-
#include "py_cel/py_cel_extension.h"
18+
#include "py_cel/cel_extension.h"
1919
#include "google/protobuf/descriptor.h"
2020

2121
namespace cel_python {
2222

23-
class ExtBindings : public PyCelExtension {
23+
class ExtBindings : public CelExtension {
2424
public:
25-
explicit ExtBindings() : PyCelExtension("cel.lib.ext.cel.bindings") {}
25+
explicit ExtBindings() : CelExtension("cel.lib.ext.cel.bindings") {}
2626

2727
absl::Status ConfigureCompiler(
2828
cel::CompilerBuilder& compiler_builder,

py_cel/ext/ext_encoders.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@
1818
#include "extensions/encoders.h"
1919
#include "runtime/runtime_builder.h"
2020
#include "runtime/runtime_options.h"
21-
#include "py_cel/py_cel_extension.h"
21+
#include "py_cel/cel_extension.h"
2222
#include "google/protobuf/descriptor.h"
2323

2424
namespace cel_python {
2525

26-
class ExtEncoders : public PyCelExtension {
26+
class ExtEncoders : public CelExtension {
2727
public:
28-
explicit ExtEncoders() : PyCelExtension("cel.lib.ext.encoders") {}
28+
explicit ExtEncoders() : CelExtension("cel.lib.ext.encoders") {}
2929

3030
absl::Status ConfigureCompiler(
3131
cel::CompilerBuilder& compiler_builder,

py_cel/ext/ext_math.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@
1818
#include "extensions/math_ext_decls.h"
1919
#include "runtime/runtime_builder.h"
2020
#include "runtime/runtime_options.h"
21-
#include "py_cel/py_cel_extension.h"
21+
#include "py_cel/cel_extension.h"
2222
#include "py_cel/status_macros.h"
2323
#include "google/protobuf/descriptor.h"
2424

2525
namespace cel_python {
2626

27-
class ExtMath : public PyCelExtension {
27+
class ExtMath : public CelExtension {
2828
public:
29-
explicit ExtMath() : PyCelExtension("cel.lib.ext.math") {}
29+
explicit ExtMath() : CelExtension("cel.lib.ext.math") {}
3030

3131
absl::Status ConfigureCompiler(
3232
cel::CompilerBuilder& compiler_builder,

py_cel/ext/ext_optional.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@
1818
#include "runtime/optional_types.h"
1919
#include "runtime/runtime_builder.h"
2020
#include "runtime/runtime_options.h"
21-
#include "py_cel/py_cel_extension.h"
21+
#include "py_cel/cel_extension.h"
2222
#include "google/protobuf/descriptor.h"
2323

2424
namespace cel_python {
2525

26-
class ExtOptional : public PyCelExtension {
26+
class ExtOptional : public CelExtension {
2727
public:
28-
explicit ExtOptional() : PyCelExtension("cel.lib.optional") {}
28+
explicit ExtOptional() : CelExtension("cel.lib.optional") {}
2929

3030
absl::Status ConfigureCompiler(
3131
cel::CompilerBuilder& compiler_builder,

0 commit comments

Comments
 (0)