Install & Compatibility
Where this runs
tested against v0.66.0 · 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
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.202s · 42MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 2.8s · import 0.194s · 42MB
38MB installed
● package 38MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
IR builtins
✓ from xdsl.ir import Block, Region, Operation, SSAValue
✗ from xdsl import Block
Top-level imports are not available; use xdsl.ir submodule.
MLIR type conversion (legacy)
✓ from xdsl.interpreters.mlir import MLIRConverter
✗ from xdsl.mlir import MLIRConverter
MLIR converter moved to xdsl.interpreters.mlir.
Construct an MLIR-like module with a function containing an add operation.
from xdsl.ir import Block, Region, Operation, SSAValue
from xdsl.dialects.builtin import ModuleOp, IntegerType, FunctionType
from xdsl.dialects import arith, func
# Create a simple function: i32 add
int32 = IntegerType(32)
func_type = FunctionType.from_lists([int32, int32], [int32])
# Build region with add operation
block = Block.from_ops([
arith.Addi(SSAValue(0), SSAValue(1)),
func.Return()
])
region = Region(block)
# Wrap in FunctionOp
func_op = func.FuncOp("add", func_type, region)
module = ModuleOp([func_op])
print(module)
Debug
Known issues
breakingIn version 0.60.0, the entire IR API was refactored. Operations now require explicit operands and results; the old mutable operation pattern is removed.fixUse Block.from_ops() with SSAValue references and explicit operands. See migration guide.
affects: <0.60.0 => >=0.60.0
deprecatedThe xdsl.util module is deprecated; use xdsl.utils or xdsl.ir utilities instead.fixReplace xdsl.util imports with xdsl.utils equivalents.
affects: >=0.60.0
gotchaSSAValue indices are positional and must match the block's arguments. A common mistake is to assume SSAValue(0) refers to the first operation's result; it refers to the first block argument.fixEnsure block arguments are defined first, then use SSAValue(index) where index corresponds to the argument list order.
affects: all
Errors
Common errors & fixes
AttributeError: module 'xdsl' has no attribute 'ir'
Import path is wrong; the package does not expose submodules at top level.
fixUse `from xdsl.ir import Block, Region, Operation, SSAValue`.
ValueError: Operation must have at least one operand or result
Creating an operation without specifying operands and results in the new API (post 0.60).
fixPass operands and result_types when constructing an operation: `arith.Addi(operands=[...], result_types=[...])` or use helper methods.
TypeError: cannot instantiate 'Block' with positional arguments
Block no longer accepts operations as positional arguments in newer versions.
fixUse `Block.from_ops([op1, op2])` or `Block(ops=[op1, op2])` keyword argument.
Upgrade
Version history
0.66.0latest on PyPI · released Jun 5, 2026
Audit
Dependencies
No dependency data recorded yet.