pygments-cedar
A Pygments lexer plugin for the Cedar policy language by AWS.
Installation
pip install pygments-cedar
Usage
Once installed, the lexer registers itself as a Pygments plugin. It is automatically available anywhere Pygments is used.
Command line
pygmentize -l cedar policy.cedar
Python
from pygments import highlight
from pygments.formatters import HtmlFormatter
from pygments.lexers import get_lexer_by_name
lexer = get_lexer_by_name("cedar")
code = '''
permit(
principal == User::"alice",
action == Action::"view",
resource == Photo::"VacationPhoto94.jpg"
);
'''
print(highlight(code, lexer, HtmlFormatter()))
Markdown (e.g. MkDocs, Sphinx)
Use the cedar language identifier in fenced code blocks:
```cedar
permit(
principal == User::"alice",
action == Action::"view",
resource == Photo::"VacationPhoto94.jpg"
);
```
Supported syntax
- Policy effects:
permit,forbid - Scope keywords:
principal,action,resource,context - Condition clauses:
when,unless - Operators:
in,has,like,is,if/then/else, logical (&&,||,!), comparison (==,!=,<,>,<=,>=) - Entity references:
Namespace::Type::"id" - Strings with escape sequences
- Integer literals (including negative)
- Line comments (
//) - Function/method calls
Development
Requires Python 3.13+ and uv.
uv sync
uv run pytest tests/ -v
License
BSD 2-Clause. See LICENSE for details.
Metadata
Release files for pygments-cedar 2026.5.13.post0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pygments_cedar-2026.5.13.post0.tar.gz | 2.2 kB | With provenance | Details for pygments_cedar-2026.5.13.post0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pygments_cedar-2026.5.13.post0-py3-none-any.whl | Python 3 | none | any | Details for pygments_cedar-2026.5.13.post0-py3-none-any.whl |
Total release size: 5.7 kB
Release files / pygments_cedar-2026.5.13.post0.tar.gz
| Download URL | pygments_cedar-2026.5.13.post0.tar.gz |
|---|---|
| Size | 2.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e0ae9365f6cd74cce020650be81ef73b6d655301c8776856c6c5e07ebba3d95b
|
|
BLAKE2b-256 checksum How to use checksums |
4d5dfa9ae17cce82a0de9763e8bb2a175a81492f09b62cc51ff784cc329054e5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 13, 2026.
Transparency logRelease files / pygments_cedar-2026.5.13.post0-py3-none-any.whl
| Download URL | pygments_cedar-2026.5.13.post0-py3-none-any.whl |
|---|---|
| Size | 3.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a34cc0f86388887b20341629a58b32c6167bbae881e78ad7598622fba5ee7f75
|
|
BLAKE2b-256 checksum How to use checksums |
2d80e3cfbca7c7a64f11b631aa4cb5eb534758ed25c088bf8a7d3035b79981a9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 13, 2026.
Transparency logSecurity for pygments-cedar 2026.5.13.post0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for pygments_cedar-2026.5.13.post0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 13, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.