xdsl
xDSL
What it is and what it does
xDSL is a Python-native compiler framework that lets you define, assemble, and optimize custom intermediate representations (IRs) using a unified SSA-based data structure. It draws inspiration from MLIR (the LLVM project's compiler infrastructure) but runs entirely in Python, making it accessible for rapid prototyping and experimentation. The framework provides Pythonic APIs to work with regions, basic blocks, and SSA values, enabling you to write generic analyses and transformation passes that work across different IR levels.
The main use case is building domain-specific language (DSL) compilers and compiler infrastructure without leaving Python. You can prototype a complete compiler stack, layer custom IRs for abstraction-specific optimizations, and then interoperate with MLIR's backend for code generation. Dependencies are minimal (immutabledict, ordered-set, typing-extensions), and the package is actively maintained with support for modern Python versions.
Use it for:
- Prototype a custom compiler for a domain-specific language entirely in Python before committing to C++
- Build multi-level IR stacks with abstraction-specific optimization passes for scientific computing or database workloads
- Analyze and transform programs using generic SSA-based passes that work across different IR dialects
- Integrate Python-based compiler development with MLIR's optimization and code generation pipeline
- Develop and test compiler passes iteratively using Python scripts without recompilation
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
xDSL is a Python framework for building compiler infrastructure using SSA-based intermediate representations (IRs) with seamless MLIR interoperability.
Yes, if you are building compiler infrastructure or DSLs and want to prototype in Python with MLIR compatibility. The framework is actively maintained, has low install friction, and is permissively licensed. Not necessary if you only need to consume compiled code or work with existing compilers.
Install
xdsl on PyPI
pip
pip install xdsluv
uv add xdslpoetry
poetry add xdslInstalling xdsl
Before you install
Low install friction with three lightweight runtime dependencies. Actively maintained with a release 24 days ago and recent commits; supports Python 3.10 through 3.14.
License in practice
Apache License v2.0 with LLVM Exceptions is permissive; you can use xDSL in commercial and proprietary projects with minimal restrictions.
Quickstart
pip install xdsl
from xdsl.ir import MLContext
from xdsl.dialects.builtin import ModuleOp
ctx = MLContext()
module = ModuleOp([])
Requires Python 3.10 or later. Type checking with Pyright requires experimental TypeForm feature enabled in pyproject.toml.
Verify before relying
- Whether MLIR version 22.1.2 is still current or if newer versions are now supported
- Performance characteristics when handling large IR graphs or complex optimization passes
- Maturity level of the GUI, JAX, and RISC-V subprojects relative to core IR functionality
Package facts
| License | Apache License v2.0 with LLVM Exceptions (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — immutabledict, ordered-set, typing-extensions |
| Maintenance | actively maintained — 24 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 514,154/month — #6,239 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: xdsl-0.69.0-py3-none-any.whl
Tags
More Build Tools packages
Provides reusable utilities for Python…
permissive · top 100 on PyPI
tqdmWraps any iterable to display a real-time…
copyleft · top 100 on PyPI
pippip is the standard installer for Python…
permissive · top 100 on PyPI
hatchlingHatchling is a standards-compliant Python build…
permissive · top 100 on PyPI
grpcio-toolsGenerates Python gRPC service stubs and message…
permissive · top 1,000 on PyPI
pre-commitpre-commit is a framework for installing and…
permissive · top 1,000 on PyPI
flydslFlyDSL is a Python DSL and embedded MLIR…
permissive · top 15,000 on PyPI
tosa-toolsTOSA Tools provides serialization, reference…
permissive · top 15,000 on PyPI
llvmlitellvmlite provides a lightweight Python binding…
permissive · top 1,000 on PyPI
apache-tvm-ffiProvides a stable, minimal C ABI and FFI for…
permissive · top 5,000 on PyPI
onnx-ironnx-ir provides an in-memory intermediate…
permissive · top 5,000 on PyPI
systemrdl-compilerParses and elaborates SystemRDL 2.0 register…
permissive · top 15,000 on PyPI
siliconcompilerSiliconCompiler is a modular hardware build…
permissive · top 15,000 on PyPI
nvidia-cutlass-dsl-libs-baseProvides Python interfaces for writing…
unclear · top 5,000 on PyPI
nvidia-cutlass-dslProvides a Python native interface for writing…
unclear · top 5,000 on PyPI
pyvexPyVEX provides Python bindings to libVEX,…
copyleft · top 15,000 on PyPI