{"id":2679,"library":"pycep-parser","title":"pycep-parser","description":"pycep-parser is a Python library designed to parse Azure Bicep files, leveraging the Lark parsing library. As of version 0.7.0, it supports a wide range of Bicep language features including various functions, decorators, typed variables, and import/extension elements. The project maintains an active development cycle with regular updates, typically every few months, adding new Bicep syntax support and ensuring compatibility with recent Python versions.","status":"active","version":"0.7.0","language":"en","source_language":"en","source_url":"https://github.com/gruebel/pycep","tags":["bicep","parser","azure","arm-templates","dsl"],"install":[{"cmd":"pip install pycep-parser","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Runtime environment. Requires Python >=3.10.","package":"Python","optional":false},{"reason":"Core parsing engine used by pycep-parser.","package":"Lark","optional":false}],"imports":[{"symbol":"BicepParser","correct":"from pycep.parser.bicep import BicepParser"}],"quickstart":{"code":"from pycep.parser.bicep import BicepParser\n\n# Initialize the Bicep parser\nparser = BicepParser()\n\n# Define your Bicep content as a string\nbicep_content = \"\"\"\nresource storage 'Microsoft.Storage/storageAccounts@2021-09-01' = {\n  name: 'mystorageaccount'\n  location: resourceGroup().location\n  sku: {\n    name: 'Standard_LRS'\n  }\n  kind: 'StorageV2'\n}\n\noutput storageName string = storage.name\n\"\"\"\n\ntry:\n    # Parse the Bicep content into an Abstract Syntax Tree (AST)\n    ast = parser.parse(bicep_content)\n    print(\"Bicep content parsed successfully. AST:\")\n    print(ast.pretty())\n\n    # You can now traverse the 'ast' object to inspect the Bicep structure.\n    # For example, to get the type of the root element:\n    # print(f\"Root element type: {ast.data}\")\nexcept Exception as e:\n    print(f\"Error parsing Bicep content: {e}\")","lang":"python","description":"This quickstart demonstrates how to initialize the BicepParser and parse a simple Bicep content string into an Abstract Syntax Tree (AST). The `ast.pretty()` method provides a human-readable representation of the parsed structure."},"warnings":[{"fix":"Upgrade Python to 3.9 or higher, or restrict `pycep-parser` version to `<0.6.1`.","message":"Support for Python 3.8 was officially dropped with version 0.6.1. Users on Python 3.8 must either upgrade their Python environment or pin `pycep-parser` to a version older than 0.6.1.","severity":"breaking","affected_versions":">=0.6.1"},{"fix":"Upgrade Python to 3.8 or higher, or restrict `pycep-parser` version to `<0.5.1`.","message":"Support for Python 3.7 was officially dropped with version 0.5.1. Users on Python 3.7 must either upgrade their Python environment or pin `pycep-parser` to a version older than 0.5.1.","severity":"breaking","affected_versions":">=0.5.1"},{"fix":"Be aware of the underlying `Lark` dependency. If encountering unexpected parsing behavior, check the `Lark` version and its documentation, or the grammar used by `pycep-parser`.","message":"The `pycep-parser` library relies on `Lark` as its underlying parsing engine. While typically installed as a dependency, changes or specific versions of `Lark` could potentially influence parsing behavior or introduce subtle differences in the generated AST. It's recommended to consult `Lark`'s documentation for advanced parsing scenarios or debugging.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-10T00:00:00.000Z","next_check":"2026-07-09T00:00:00.000Z"}