skillfed

xdsl

xDSL

xdsl v0.69.0 514.2K downloads/30d#6,239 on PyPI580
Permissive license Apache License v2.0 with LLVM Exceptions Active released

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 xdsl

uv

uv add xdsl

poetry

poetry add xdsl

Installing 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

Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14

Tags

python compiler frameworkSSA intermediate representationMLIR interoperabilityDSL compiler constructionIR optimization passespython native compilerabstract syntax tree builder
compiler-infrastructuremlir-compatibledsl-framework

More Build Tools packages