Skip to content

[Python] Export CEL Policy compiler and YAML parser module to OSS - #138

Open
copybara-service[bot] wants to merge 1 commit into
mainfrom
test_1014822063
Open

copybara-service[bot] wants to merge 1 commit into
mainfrom
test_1014822063

Conversation

@copybara-service

Copy link
Copy Markdown

[Python] Export CEL Policy compiler and YAML parser module to OSS

Stop linking cel_policy against cel_pybind_lib, so it no longer carries
its own copy of the PyCelEnv and protobuf descriptor state, and loads cel
dynamically instead:

  • cel.Env exposes its compiler through a private _compiler_capsule()
    PyCapsule, which shares ownership of the env.
  • cel_compiler_capsule.h holds the shared capsule name and helpers
    (MakeCelCompilerCapsule, GetCelCompiler).
  • CelPolicyValidationResult builds and caches the compiled expression once,
    using env.deserialize(), because a CheckedExpr message can't be passed
    directly between separately built shared libraries.

Also adds Bazel/Copybara/Windows test support: the yaml-cpp dependency,
export of policy/**, and runfiles-relative testdata paths.

Stop linking `cel_policy` against `cel_pybind_lib`, so it no longer carries
its own copy of the PyCelEnv and protobuf descriptor state, and loads `cel`
dynamically instead:

- `cel.Env` exposes its compiler through a private `_compiler_capsule()`
  PyCapsule, which shares ownership of the env.
- `cel_compiler_capsule.h` holds the shared capsule name and helpers
  (`MakeCelCompilerCapsule`, `GetCelCompiler`).
- `CelPolicyValidationResult` builds and caches the compiled expression once,
  using `env.deserialize()`, because a CheckedExpr message can't be passed
  directly between separately built shared libraries.

Also adds Bazel/Copybara/Windows test support: the yaml-cpp dependency,
export of policy/**, and runfiles-relative testdata paths.

PiperOrigin-RevId: 1014822063
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant