--- id: xdsl version: "0.69.0" license: Apache License v2.0 with LLVM Exceptions license_treatment: permissive maintenance: active --- # xdsl — xDSL License: permissive · Maintenance: active · Downloads: 514.2K/mo ## 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 above — 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 pip install xdsl uv add xdsl 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_current - Install friction: low - Maintenance: active - Downloads: 514.2K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags python compiler framework, SSA intermediate representation, MLIR interoperability, DSL compiler construction, IR optimization passes, python native compiler, abstract syntax tree builder, compiler-infrastructure, mlir-compatible, dsl-framework [View on SkillFed](https://skillfed.io/packages/xdsl) · [View on PyPI](https://pypi.org/project/xdsl/)