Skip to content

Commit 3433e98

Browse files
dmitriplotnikovcopybara-github
authored andcommitted
Rename py_cel to cel_expr_python
PiperOrigin-RevId: 868298923
1 parent 370e0a2 commit 3433e98

53 files changed

Lines changed: 207 additions & 207 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# CEL Python Wrapper (PyCEL)
1+
# CEL Python Wrapper (cel.expr.python)
22

33
This is a Python wrapper for the CEL C++ implementation.
44

@@ -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

py_cel/BUILD renamed to cel_expr_python/BUILD

Lines changed: 6 additions & 6 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",
@@ -117,10 +117,10 @@ cc_library(
117117
)
118118

119119
py_test(
120-
name = "py_cel_test",
121-
srcs = ["py_cel_test.py"],
120+
name = "cel_test",
121+
srcs = ["cel_test.py"],
122122
deps = [
123-
":py_cel",
123+
":cel",
124124
"//testing:proto2_test_all_types_py_pb2",
125125
"@com_google_absl_py//absl/testing:absltest",
126126
"@com_google_protobuf//:protobuf",
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 "cel_expr_python.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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@
2323
from google.protobuf import duration_pb2 as duration_pb
2424
from google.protobuf import timestamp_pb2 as timestamp_pb
2525
from absl.testing import absltest
26-
from py_cel import py_cel as cel
26+
from cel_expr_python import cel
2727
from cel.expr.conformance.proto2 import test_all_types_pb2 as test_all_types_pb
2828

2929

30-
class PyCelTest(absltest.TestCase):
30+
class CelTest(absltest.TestCase):
3131

3232
def setUp(self):
3333
super().setUp()
@@ -604,7 +604,7 @@ def testDynType_nonCelType(self):
604604
res = self._eval("var_dyn", {"var_dyn": self})
605605
self.assertEqual(res.type(), cel.Type.ERROR)
606606
self.assertIn(
607-
"Non-CEL value type for 'var_dyn': PyCelTest",
607+
"Non-CEL value type for 'var_dyn': CelTest",
608608
res.value(),
609609
)
610610

@@ -804,7 +804,7 @@ def FindFileContainingSymbol(self, symbol_name: str): # pylint: disable=invalid
804804
raise LookupError("Could not find file containing symbol: %s" % symbol_name)
805805

806806

807-
class PyCelWithoutProtoSupportTest(absltest.TestCase):
807+
class CelWithoutProtoSupportTest(absltest.TestCase):
808808
"""Test that the environment can be created without proto support."""
809809

810810
def setUp(self):
Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ pybind_extension(
88
"ext_bindings.cc",
99
],
1010
data = [
11-
"//py_cel",
11+
"//cel_expr_python:cel",
1212
],
1313
visibility = ["//visibility:public"],
1414
deps = [
15-
"//py_cel:py_cel_extension",
15+
"//cel_expr_python:cel_extension",
1616
"@com_google_absl//absl/status",
1717
"@com_google_cel_cpp//compiler",
1818
"@com_google_cel_cpp//extensions:bindings_ext",
@@ -26,11 +26,11 @@ pybind_extension(
2626
"ext_encoders.cc",
2727
],
2828
data = [
29-
"//py_cel",
29+
"//cel_expr_python:cel",
3030
],
3131
visibility = ["//visibility:public"],
3232
deps = [
33-
"//py_cel:py_cel_extension",
33+
"//cel_expr_python:cel_extension",
3434
"@com_google_absl//absl/status",
3535
"@com_google_cel_cpp//checker:type_checker_builder",
3636
"@com_google_cel_cpp//compiler",
@@ -47,12 +47,12 @@ pybind_extension(
4747
"ext_math.cc",
4848
],
4949
data = [
50-
"//py_cel",
50+
"//cel_expr_python:cel",
5151
],
5252
visibility = ["//visibility:public"],
5353
deps = [
54-
"//py_cel:py_cel_extension",
55-
"//py_cel:status_macros",
54+
"//cel_expr_python:cel_extension",
55+
"//cel_expr_python:status_macros",
5656
"@com_google_absl//absl/base:nullability",
5757
"@com_google_absl//absl/status",
5858
"@com_google_absl//absl/status:statusor",
@@ -80,11 +80,11 @@ pybind_extension(
8080
"ext_optional.cc",
8181
],
8282
data = [
83-
"//py_cel",
83+
"//cel_expr_python:cel",
8484
],
8585
visibility = ["//visibility:public"],
8686
deps = [
87-
"//py_cel:py_cel_extension",
87+
"//cel_expr_python:cel_extension",
8888
"@com_google_absl//absl/status",
8989
"@com_google_cel_cpp//compiler",
9090
"@com_google_cel_cpp//compiler:optional",
@@ -101,11 +101,11 @@ pybind_extension(
101101
"ext_proto.cc",
102102
],
103103
data = [
104-
"//py_cel",
104+
"//cel_expr_python:cel",
105105
],
106106
visibility = ["//visibility:public"],
107107
deps = [
108-
"//py_cel:py_cel_extension",
108+
"//cel_expr_python:cel_extension",
109109
"@com_google_absl//absl/status",
110110
"@com_google_cel_cpp//compiler",
111111
"@com_google_cel_cpp//extensions:proto_ext",
@@ -119,11 +119,11 @@ pybind_extension(
119119
"ext_string.cc",
120120
],
121121
data = [
122-
"//py_cel",
122+
"//cel_expr_python:cel",
123123
],
124124
visibility = ["//visibility:public"],
125125
deps = [
126-
"//py_cel:py_cel_extension",
126+
"//cel_expr_python:cel_extension",
127127
"@com_google_absl//absl/status",
128128
"@com_google_cel_cpp//compiler",
129129
"@com_google_cel_cpp//extensions:strings",
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 "cel_expr_python/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,
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 "cel_expr_python/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,
Lines changed: 4 additions & 4 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"
22-
#include "py_cel/status_macros.h"
21+
#include "cel_expr_python/cel_extension.h"
22+
#include "cel_expr_python/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,
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 "cel_expr_python/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,
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/proto_ext.h"
18-
#include "py_cel/py_cel_extension.h"
18+
#include "cel_expr_python/cel_extension.h"
1919
#include "google/protobuf/descriptor.h"
2020

2121
namespace cel_python {
2222

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

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

0 commit comments

Comments
 (0)