promql-parser
Decision gist · record as of 2026-08-14
Yes, if you need to parse or manipulate PromQL queries in Python. The package is actively maintained, has no known vulnerabilities, supports Python >=3.8, and requires no runtime dependencies. Medium install friction (prebuilt wheels for common platforms) is a minor trade-off for a specialized tool with a clear use case.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python >=3.8; prebuilt wheels available for Python 3.10–3.11 on Linux, macOS, and Windows.
- Medium install friction due to compiled wheels; prebuilt binaries available for Python 3.10–3.11 on common platforms.
- Active maintenance with latest release 67 days ago.
License · maintenance · safety
(unclear)
last release 2026-06-08 (67 days) · last repo commit 2026-08-01 · 29 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 430,452 downloads/mo, #6,727 on PyPI
Alternatives
Verify before relying
pip install promql-parser
import promql_parser
ast = promql_parser.parse('prometheus_http_requests_total{code="200", job="prometheus"}')
print(ast.prettify())- Whether the Rust implementation is vendored or requires a separate build toolchain for platforms without prebuilt wheels.
- Whether PyPy support (listed in classifiers) is fully tested or aspirational.
- License details: license_spdx and license_raw are both null despite MIT being mentioned in the description.
What it is and what it does
promql-parser is a Python binding to a Rust-based PromQL parser that converts Prometheus query expressions into an inspectable AST. It lets you parse queries like `rate(http_requests_total{job="api"}[5m])` into structured objects (VectorSelector, MatrixSelector, Call, AggregateExpr, BinaryExpr) that you can examine, walk depth-first, or transform into new expressions. The package also includes duration helpers to parse and format time intervals.
Typical workflows involve parsing a PromQL string, inspecting its structure to extract metric names or matchers, walking the tree to collect information, or transforming nodes to rewrite queries. The AST can be converted back to PromQL string form. No runtime dependencies are required beyond Python itself.
Use it for
- Extract metric names and label matchers from Prometheus queries for validation or analysis.
- Rewrite or transform PromQL expressions programmatically (e.g., rename metrics, adjust time ranges).
- Build tooling that inspects or validates Prometheus query syntax before execution.
- Walk query trees to collect metadata or enforce query patterns in monitoring systems.
- Parse duration strings from PromQL into Python timedelta objects.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need to parse or manipulate PromQL queries in Python.
The package is actively maintained, has no known vulnerabilities, supports Python >=3.8, and requires no runtime dependencies. Medium install friction (prebuilt wheels for common platforms) is a minor trade-off for a specialized tool with a clear use case.
Install
promql-parser on PyPI
Before you install
Medium install friction due to compiled wheels; prebuilt binaries available for Python 3.10–3.11 on common platforms. Active maintenance with latest release 67 days ago.
Requires Python >=3.8; prebuilt wheels available for Python 3.10–3.11 on Linux, macOS, and Windows.
Quickstart
pip install promql-parser
import promql_parser
ast = promql_parser.parse('prometheus_http_requests_total{code="200", job="prometheus"}')
print(ast.prettify())
Verify before relying
- Whether the Rust implementation is vendored or requires a separate build toolchain for platforms without prebuilt wheels.
- Whether PyPy support (listed in classifiers) is fully tested or aspirational.
- License details: license_spdx and license_raw are both null despite MIT being mentioned in the description.
Package facts
| License | Not declared unclear |
| Python support | Supports the current Python release >=3.8 |
| Install friction | Medium. Platform-specific wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 67 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 430,452 / month, #6,727 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyProgramming Language :: Rust |
Evidence: promql_parser-0.10.0-cp310-cp310-macosx_10_12_x86_64.whl; promql_parser-0.10.0-cp310-cp310-macosx_11_0_arm64.whl; promql_parser-0.10.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; promql_parser-0.10.0-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl; promql_parser-0.10.0-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl; promql_parser-0.10.0-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl; promql_parser-0.10.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; promql_parser-0.10.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl; promql_parser-0.10.0-cp310-cp310-musllinux_1_2_aarch64.whl; promql_parser-0.10.0-cp310-cp310-musllinux_1_2_armv7l.whl; promql_parser-0.10.0-cp310-cp310-musllinux_1_2_i686.whl; promql_parser-0.10.0-cp310-cp310-musllinux_1_2_x86_64.whl; promql_parser-0.10.0-cp310-cp310-win32.whl; promql_parser-0.10.0-cp310-cp310-win_amd64.whl; promql_parser-0.10.0-cp311-cp311-macosx_10_12_x86_64.whl; promql_parser-0.10.0-cp311-cp311-macosx_11_0_arm64.whl; promql_parser-0.10.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; promql_parser-0.10.0-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl; promql_parser-0.10.0-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl; promql_parser-0.10.0-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “promql parser”
- promql-parserParses Prometheus query language (PromQL) expressions into a…
- awslabs.cloudwatch-mcp-serverExposes CloudWatch metrics, logs, alarms, and PromQL queries through…
- mcp-grafanaAn MCP server that exposes Grafana dashboards, datasources, and query…
Give your agent the search over MCP, or paste the wish link into any chat.
More Monitoring packages
Wraps any iterable to display a real-time progress bar in the terminal or Jupyter notebook, showing iteration count, elapsed time, and estimated time remaining.
Provides generated Python code for OpenTelemetry semantic conventions, enabling standardized attribute naming and constant definitions for instrumentation and telemetry collection.
Install it if you are using OpenTelemetry and want to follow semantic conventions correctly.
Provides the reference implementation of the OpenTelemetry API for collecting and exporting traces, metrics, and logs from Python applications.
Provides the abstract API and interfaces for OpenTelemetry instrumentation in Python, defining how to emit traces, metrics, and logs without tying code to a specific SDK implementation.
Exports OpenTelemetry observability data to an OpenTelemetry Collector using Protobuf-encoded messages over HTTP.
Install it if you are using OpenTelemetry in Python and need to send data to a Collector over HTTP.
Provides automatic instrumentation commands and programmatic APIs to inject distributed tracing into Python applications without code changes, detecting and instrumenting packages used by your program.
Install it if you need distributed tracing without code changes and have compatible instrumented packages in your environment.
See also syntaqlite · luaparser · cql2 · hogql-parser-rs · pygeofilter · astor · jsonata-python · scim2-filter-parser · gast · PyMeta3