From 4a5f0260da1770ca2eac10cffe6cf0d8835d29e3 Mon Sep 17 00:00:00 2001 From: Dmitri Plotnikov Date: Thu, 12 Feb 2026 08:33:56 -0800 Subject: [PATCH] Rename py_cel to cel_expr_python. Part II PiperOrigin-RevId: 869231554 --- README.md | 6 +++--- codelab/index.lab.md | 6 +++--- release/README.md | 2 +- release/build_wheel.sh | 18 ++++++------------ release/pyproject.toml | 2 +- release/setup.py | 37 +++++++++++++++++++++++++++++-------- 6 files changed, 43 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 0128b5e..f0f1876 100644 --- a/README.md +++ b/README.md @@ -236,9 +236,9 @@ To define a custom extension in C++, define a class extending `cel_python::CelExtension`. There are two methods you will need to implement: `ConfigureCompiler` and `ConfigureRuntime`. The implementations of these methods use the same API as extensions written for the C++ CEL runtime. In fact, -extensions written for the C++ runtime can be used unchanged with PyCEL - you -would just need to write a trivial wrapper class invoking the registration -functions defined by the C++ extension. +extensions written for the C++ runtime can be used unchanged with +cel-expr-python - you would just need to write a trivial wrapper class invoking +the registration functions defined by the C++ extension. ```cpp absl::Status ConfigureCompiler( diff --git a/codelab/index.lab.md b/codelab/index.lab.md index 1f89534..eb5ef2f 100644 --- a/codelab/index.lab.md +++ b/codelab/index.lab.md @@ -1,4 +1,4 @@ -# cel.expr.python (CEL for Python) Codelab: Fast, safe, embedded expressions +# cel-expr-python (CEL for Python) Codelab: Fast, safe, embedded expressions
@@ -24,7 +24,7 @@ lambda expressions. While CEL is commonly used for boolean decisions, it can also be used to construct more complex objects like JSON or protobuf messages. -### cel.expr.python - CEL runtime for Python +### cel-expr-python - CEL runtime for Python Cel.expr.python is a collection of Python APIs for compilation, validation and evaluation of CEL expressions. It also includes support for CEL extensions, written either in Python or C++. @@ -143,7 +143,7 @@ function bindings being used across the lifetime of a process (a common case). -Before we can start using cel.expr.python, let's install it in the Python environment: +Before we can start using cel-expr-python, let's install it in the Python environment: ``` pip install cel-expr-python ``` diff --git a/release/README.md b/release/README.md index 266062f..b0f64b8 100644 --- a/release/README.md +++ b/release/README.md @@ -19,7 +19,7 @@ To build the py_cel wheel locally for testing: Go to the parent directory of the one containing this file, e.g. ``` - cd py-cel-git-repo + cd cel-git-repo ``` - Update release version diff --git a/release/build_wheel.sh b/release/build_wheel.sh index e2c1cdd..c320f0f 100755 --- a/release/build_wheel.sh +++ b/release/build_wheel.sh @@ -1,19 +1,12 @@ #!/bin/bash set -e -# Version of pycel to build. +# Version of cel-expr-python to build. # IMPORTANT: Update this to the latest version before building. VERSION="0.0.1" - -# Find the installation directory of cibuildwheel -CIBWHEEL_DIR=$(pip show cibuildwheel | grep Location: | awk '{print $2}') -# Derive the cibuildwheel binary path from the site-packages directory. -# Example: "/.../lib/python3.11/site-packages" -> "/.../bin/cibuildwheel" -CIBWHEEL_BIN=$(echo "${CIBWHEEL_DIR}" | sed 's/\/lib\/python[0-9.]*\/site-packages/\/bin/')/cibuildwheel - SRC_DIR=$(pwd) -echo "PyCEL source directory: ${SRC_DIR}" +echo "cel-expr-python source directory: ${SRC_DIR}" TMP_DIR=$(mktemp -d) echo "Build directory: ${TMP_DIR}" @@ -22,16 +15,17 @@ pushd "${TMP_DIR}" cp -r "${SRC_DIR}"/{*,.*} . cp "${SRC_DIR}"/release/* . +rm -rf cel_expr_python/*_test.py -# Substitute $VERSION in pyproject.toml with the value of VRS. +# Substitute $VERSION in pyproject.toml with the value of VERSION. sed -i "s/\$VERSION/${VERSION}/g" pyproject.toml echo "Running cibuildwheel: ${CIBWHEEL_BIN}" -"${CIBWHEEL_BIN}" "$@" +python -m cibuildwheel "$@" echo "Copying generated wheels to ${SRC_DIR}/wheelhouse" mkdir -p "${SRC_DIR}"/wheelhouse -cp wheelhouse/cel-expr-python-*.whl "${SRC_DIR}"/wheelhouse/ +cp wheelhouse/cel_expr_python-*.whl "${SRC_DIR}"/wheelhouse/ echo "Cleaning up build directory: ${TMP_DIR}" rm -rf "${TMP_DIR}" diff --git a/release/pyproject.toml b/release/pyproject.toml index 2c79aad..aec894a 100644 --- a/release/pyproject.toml +++ b/release/pyproject.toml @@ -26,7 +26,7 @@ license = "Apache-2.0" [tool.setuptools.packages.find] where = ["."] -exclude = ["wheelhouse*", "conformance*", "custom_ext*"] +exclude = ["codelab*", "conformance*", "custom_ext*", "release*", "testing*", "wheelhouse*"] [tool.cibuildwheel] build = "cp311-* cp312-* cp313-*" diff --git a/release/setup.py b/release/setup.py index 4c848cb..1292f7c 100644 --- a/release/setup.py +++ b/release/setup.py @@ -107,15 +107,36 @@ def build_extension(self, ext): setuptools.setup( - name='py-cel', + name='cel-expr-python', ext_modules=[ - BazelExtension('py_cel.py_cel', '//py_cel:py_cel'), - BazelExtension('py_cel.ext.ext_bindings', '//py_cel/ext:ext_bindings'), - BazelExtension('py_cel.ext.ext_encoders', '//py_cel/ext:ext_encoders'), - BazelExtension('py_cel.ext.ext_math', '//py_cel/ext:ext_math'), - BazelExtension('py_cel.ext.ext_optional', '//py_cel/ext:ext_optional'), - BazelExtension('py_cel.ext.ext_proto', '//py_cel/ext:ext_proto'), - BazelExtension('py_cel.ext.ext_string', '//py_cel/ext:ext_string'), + BazelExtension( + 'cel_expr_python.cel', + '//cel_expr_python:cel', + ), + BazelExtension( + 'cel_expr_python.ext.ext_bindings', + '//cel_expr_python/ext:ext_bindings', + ), + BazelExtension( + 'cel_expr_python.ext.ext_encoders', + '//cel_expr_python/ext:ext_encoders', + ), + BazelExtension( + 'cel_expr_python.ext.ext_math', + '//cel_expr_python/ext:ext_math', + ), + BazelExtension( + 'cel_expr_python.ext.ext_optional', + '//cel_expr_python/ext:ext_optional', + ), + BazelExtension( + 'cel_expr_python.ext.ext_proto', + '//cel_expr_python/ext:ext_proto', + ), + BazelExtension( + 'cel_expr_python.ext.ext_string', + '//cel_expr_python/ext:ext_string', + ), ], cmdclass={'build_ext': BazelBuild}, zip_safe=False,