Registry / azure / pycep-parser

pycep-parser

JSON →
library0.7.1pypypi✓ verified 24d ago

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.

pip install pycep-parser
INSTALL
IMPORT
SIG · PYCEP-PARSER
P
pycep-parser
azurepythonv0.7.1
Install
2.4s avg
Import
274ms
Disk
20MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.7.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.288s · 21.9MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.4s · import 0.260s · 23MB
20MB installed
● package 20MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

BicepParser
from pycep import BicepParser
from pycep.parser.bicep import BicepParser

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.

from pycep.parser.bicep import BicepParser # Initialize the Bicep parser parser = BicepParser() # Define your Bicep content as a string bicep_content = """ resource storage 'Microsoft.Storage/storageAccounts@2021-09-01' = { name: 'mystorageaccount' location: resourceGroup().location sku: { name: 'Standard_LRS' } kind: 'StorageV2' } output storageName string = storage.name """ try: # Parse the Bicep content into an Abstract Syntax Tree (AST) ast = parser.parse(bicep_content) print("Bicep content parsed successfully. AST:") print(ast.pretty()) # You can now traverse the 'ast' object to inspect the Bicep structure. # For example, to get the type of the root element: # print(f"Root element type: {ast.data}") except Exception as e: print(f"Error parsing Bicep content: {e}")
Debug
Known issues
breakingSupport 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.
fix
Upgrade Python to 3.9 or higher, or restrict `pycep-parser` version to `<0.6.1`.
affects: >=0.6.1
breakingSupport 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.
fix
Upgrade Python to 3.8 or higher, or restrict `pycep-parser` version to `<0.5.1`.
affects: >=0.5.1
gotchaThe `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.
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`.
affects: All
Upgrade
Version history
0.7.1latest on PyPI · released Aug 9, 2026
Audit
Dependencies
PythonrequiredRuntime environment. Requires Python >=3.10.
LarkrequiredCore parsing engine used by pycep-parser.
Agent activity
47 hits · last 30 days
node
38
OpenAI (training)
1
Resources
pycep-parser — pip install pycep-parser · libregistry