{"id":31316753,"url":"https://github.com/chobie/mimicel","last_synced_at":"2026-03-13T00:32:45.257Z","repository":{"id":296802930,"uuid":"990644630","full_name":"chobie/mimicel","owner":"chobie","description":"Common Expression Language Engine for Python","archived":false,"fork":false,"pushed_at":"2025-06-07T17:15:04.000Z","size":294,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"develop","last_synced_at":"2025-09-26T03:24:35.218Z","etag":null,"topics":["cel","common-expression-language"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chobie.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-26T12:23:01.000Z","updated_at":"2025-06-07T17:15:09.000Z","dependencies_parsed_at":"2025-06-02T14:21:36.184Z","dependency_job_id":"e7b1d299-31a8-44bf-8a1d-ff1de72ba992","html_url":"https://github.com/chobie/mimicel","commit_stats":null,"previous_names":["chobie/mimicel"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/chobie/mimicel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chobie%2Fmimicel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chobie%2Fmimicel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chobie%2Fmimicel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chobie%2Fmimicel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chobie","download_url":"https://codeload.github.com/chobie/mimicel/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chobie%2Fmimicel/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30451579,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-12T21:31:01.033Z","status":"ssl_error","status_checked_at":"2026-03-12T21:30:43.161Z","response_time":114,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cel","common-expression-language"],"created_at":"2025-09-25T11:42:48.883Z","updated_at":"2026-03-13T00:32:45.244Z","avatar_url":"https://github.com/chobie.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mimicel: Common Expression Language Engine\n\nMimicel is a personal project of the Common Expression Language python implementation, built with the help of generative AI.\n\n## Beginning (2025 Golden Week)\n\nDuring Golden Week, I spent some time doing development in a different, more playful way than usual.  \nI needed a policy engine, but none of the existing Python implementations of CEL passed the official Conformance Tests.  \nSince Gemini Pro had just become available, I started experimenting with it for code generation and testing.\n\nAfter about 10 days of experimentation using Gemmini for testing, I managed to get much of CEL working.\nIf written in the usual way, a library of this scale and complexity would probably take three to six months to build.\n\nHow far can we go when combining the Language Definition, Conformance Tests, existing code, and generative AI?\n\n\u003e **Note**: Golden Week is a major holiday period in Japan, lasting about 10 days from late April to early May.\n\n## GOAL\n\n* Verify the creation and maintenance of software artifacts using AI\n* Gain practical knowledge on how to maintain consistency across complex contexts with AI\n* Provide a CEL-compliant evaluation engine\n\n## Not Goal\n\n* To keep traditional open-source development style\n\nHowever, I may return to a conventional development process at some point.\n\n## Current Status: Developer Preview\n\nAs of May 2025, the engine passes the core set of conformance tests:\n\n| Filename              | Status     | Comment                                        |\n|-----------------------|------------|------------------------------------------------|\n| plumbing.textproto    | ✅ Passed  |                                                |\n| basic.textproto       | ✅ Passed  |                                                |\n| comparisons.textproto | ✅ Passed  |                                                |\n| conversions.textproto | ✅ Passed  |                                                |\n| dynamic.textproto     | ✅ Passed  |                                                |\n| enums.textproto       | ✅ Passed  |                                                |\n| fields.textproto      | ✅ Passed  |                                                |\n| fp_math.textproto     | ✅ Passed  |                                                |\n| integer_math.textproto| ✅ Passed  |                                                |\n| lists.textproto       | ✅ Passed  |                                                |\n| logic.textproto       | ✅ Passed  | The `left_error` and `right_error` are skipped |\n| macros.textproto      | ✅ Passed  |                                                |\n| namespace.textproto   | ✅ Passed  |                                                |\n| parse.textproto       | ✅ Passed  |                                                |\n| proto2.textproto      | ✅ Passed  |                                                |\n| proto3.textproto      | ✅ Passed  |                                                |\n| string.textproto      | ✅ Passed  |                                                |\n| timestamps.textproto  | ✅ Passed  |                                                |\n| unknowns.textproto    | ✅ Passed  |                                                |\n\n\nIt passes the basic tests excluding extension-related ones, making Mimic a CEL-compliant engine.\n\n```\n# requirements: java\ncurl -o third_party/antlr4/antlr-4.13.2-complete.jar https://www.antlr.org/download/antlr-4.13.2-complete.jar\nbazel run //conformance:run_basic_test\n```\n\n...Of course, this only means it slipped through the gaps in the Conformance Test coverage,  \nand does not imply it's production-ready.\n\nCurrently, the focus is on improving design consistency, as well as enhancing the reliability and robustness of the library.\n\n## Setup\n\n⚠️ **Important**: The installation of mimicel requires additional steps beyond `pip install`. The library depends on Protocol Buffer definitions that must be generated separately.\n\n### Prerequisites\n\nBefore installing mimicel, ensure you have:\n- Python 3.8 or later\n- protoc (Protocol Buffer compiler) - Install via `pip install grpcio-tools` or from [protobuf releases](https://github.com/protocolbuffers/protobuf/releases)\n\n### Installation Steps\n\n#### Step 1: Install mimicel\n\nUsing pip:\n```bash\npip install mimicel\n```\n\nUsing uv package manager:\n```bash\nuv add mimicel\n```\n\n#### Step 2: Generate required Protocol Buffer files\n\n**This step is mandatory!** Mimicel depends on CEL protocol buffer definitions that are not included in the package and must be generated manually.\n\n##### Option A: Using the provided setup script (Recommended)\n\nA convenience script is provided in the mimicel repository. Copy and run it in your project directory:\n\n```bash\n# If you cloned the mimicel repo:\ncp path/to/mimicel/setup_cel_protos.sh ./\nchmod +x setup_cel_protos.sh\n./setup_cel_protos.sh\n\n# Or download directly:\ncurl -O https://raw.githubusercontent.com/chobie/mimicel/main/setup_cel_protos.sh\nchmod +x setup_cel_protos.sh\n./setup_cel_protos.sh\n```\n\n##### Option B: Manual generation\n\nIf you prefer to generate the files manually:\n\nIf you’re using Bazel, you can use the following command to make use of the proto files generated from `cel-spec`.\n\n```\nbazel build '@cel-spec//proto/cel/expr:cel_expr_py_proto'\ncp -r bazel-bin/external/cel-spec+/proto/cel/expr/_virtual_imports/python_proto/cel .\n```\n\nIf you want to generate them manually, you can do so by running the following command.\n\n```bash\ngit clone https://github.com/google/cel-spec\ngit clone https://github.com/googleapis/googleapis\n\nprotoc -I=./cel-spec/proto -I=./googleapis/ \\\n       --python_out=./ \\\n      --mypy_out=./ \\\n       ./cel-spec/proto/cel/expr/syntax.proto \\\n       ./cel-spec/proto/cel/expr/checked.proto \\\n       ./cel-spec/proto/cel/expr/eval.proto \\\n       ./cel-spec/proto/cel/expr/value.proto \\\n       ./cel-spec/proto/cel/expr/explain.proto \\\n       ./cel-spec/proto/cel/expr/conformance/test/simple.proto \\\n       ./cel-spec/proto/cel/expr/conformance/test/suite.proto \\\n       ./cel-spec/proto/cel/expr/conformance/conformance_service.proto \\\n       ./cel-spec/proto/cel/expr/conformance/env_config.proto \\\n       ./cel-spec/proto/cel/expr/conformance/proto2/test_all_types.proto \\\n       ./cel-spec/proto/cel/expr/conformance/proto2/test_all_types_extensions.proto \\\n       ./cel-spec/proto/cel/expr/conformance/proto3/test_all_types.proto \\\n       ./googleapis/google/rpc/status.proto \\\n       ./googleapis/google/rpc/code.proto\n```\n\nAs of now, cel-spec does not provide pre-generated Protocol Buffers artifacts for Python. For googleapis, you can use the googleapis-common-protos package.\nCurrently, you need to generate the Protocol Buffers artifacts from cel-spec yourself.\n\n### Verifying Installation\n\nAfter completing the setup, test your installation with this simple script:\n\n```python\nimport mimicel as cel\n\n# Create a simple environment\nenv, err = cel.new_env()\nif err is not None:\n    print(f\"Failed to create environment: {err}\")\nelse:\n    print(\"Success! Mimicel is properly installed.\")\n    \n    # Test a simple expression\n    ast, issue = env.compile(\"1 + 1\")\n    if issue is None:\n        program, _ = env.program(ast)\n        result, _, _ = program.eval({})\n        print(f\"1 + 1 = {result}\")\n```\n\n### Troubleshooting\n\n#### Error: `ModuleNotFoundError: No module named 'cel'`\n\nThis is the most common error and indicates that the CEL protocol buffer files haven't been generated. Make sure you've completed Step 2 of the installation process.\n\n#### Error: `protoc-gen-mypy: program not found`\n\nIf you encounter this error when using the manual generation method with `--mypy_out`, you can either:\n1. Install mypy-protobuf: `pip install mypy-protobuf`\n2. Or simply omit the `--mypy_out` flag from the protoc command\n\n#### Generated files in wrong location\n\nEnsure the proto files are generated in your project's Python path. The generated `cel` directory should be at the same level as your Python scripts or in a location that's in your `PYTHONPATH`.\n\n## Examples\n\nThe API design follows the style of `go-cel`, so for basic use cases, it should be fairly straightforward to use.\n\n```python\nimport mimicel as cel\n\nenv, err = cel.new_env(\n    cel.Variable(\"a\", cel.IntType),\n    cel.Variable(\"b\", cel.StringType),\n    cel.Function(\"hello\",\n                 cel.Overload(\"hello_str\",\n                              [cel.StringType],\n                              cel.StringType\n)))\n\nif err is not None:\n    raise err\n\nast, issue = env.compile(\"b.startsWith('Hello')\")\nif issue is not None:\n    raise issue\n\nprogram, err = env.program(ast)\nif err is not None:\n    raise err\n\nout, detail, err = program.eval({\n    'a': 15,\n    'b': \"Hello World\",\n})\nprint(out)\n```\n\n# Architecture\n\n`mimicel/__init__.py` is the CEL frontend designed and implemented by a human.\nThe rest of the code was generated using generative AI. Since much of that output is difficult to use as-is, the frontend was manually designed and implemented.\n\nThe backend generated by the AI passes the standard CEL Conformance Tests.\nHowever, there are admittedly many incomplete parts in the implementation.\nImproving reliability will be a key focus going forward.\n\nAdvanced use cases are not yet well-supported.\nYou can access internal code via modules like mimicel.api, but since the APIs are subject to significant change, their use is not recommended.\n\n## Contribution Guidelines\n\nThis project is an experimental open-source initiative leveraging generative AI.\nPlease feel free to share your great prompts and techniques.\n\n* Test code can be written manually.\n  * critically important for maintenance, so I prefer not to rely on AI-generated test code.  \n* It is recommended to let AI read and interpret the code rather than trying to analyze it seriously yourself.\n  * Much of this source code was generated by AI. There is little consistency in the design.\n* For library code, use of output generated by AI is recommended.\n  * If the conformance tests pass, I often adopt bold or experimental changes.\n\nThis project is not so much a conventional OSS activity,  \nbut more of a game-like challenge to explore what's possible with modern tooling.  \n\n## License\n\n* Apache License 2.0\n\n## Disclaimer\n\nAs everyone knows, this software is provided \"AS IS\" with no warranties of any kind.  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchobie%2Fmimicel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchobie%2Fmimicel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchobie%2Fmimicel/lists"}