{"id":21037,"library":"circt","title":"CIRCT Python Bindings","description":"CIRCT (Circuit IR Compilers and Tools) Python bindings for interacting with MLIR-based hardware compilation tools. Current version 1.145.1. Released roughly monthly.","status":"active","version":"1.145.1","language":"python","source_language":"en","source_url":"https://github.com/llvm/circt","tags":["circt","mlir","hardware","compiler","ir"],"install":[{"cmd":"pip install circt","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"Submodules are accessed via circt.ir, circt.dialect, etc., not direct import.","wrong":"import circt.ir","symbol":"circt","correct":"import circt"},{"note":"Module is in circt.ir, not top-level.","wrong":"from circt import Module","symbol":"Module","correct":"from circt.ir import Module"}],"quickstart":{"code":"import circt\nfrom circt.ir import Context, Location, Module\n\nwith Context() as ctx:\n    loc = Location.unknown(ctx)\n    module = Module.parse(ctx, '''\nmodule {\n  func.func @main() -> i32 {\n    %0 = arith.constant 42 : i32\n    return %0 : i32\n  }\n}\n''')\n    print(module)\n","lang":"python","description":"Create and print an MLIR module using CIRCT's IR bindings."},"warnings":[{"fix":"Pin circt version in requirements.txt and check with MLIR version.","message":"CIRCT uses MLIR's Python bindings with breaking changes across versions. Ensure circt version matches the MLIR version used.","severity":"breaking","affected_versions":">=1.0"},{"fix":"Replace imports from circt.support with circt.ir.","message":"The 'circt.support' module is deprecated; use 'circt.ir' directly.","severity":"deprecated","affected_versions":">=1.20"},{"fix":"Always use 'with circt.ir.Context() as ctx:' block.","message":"Context creation is mandatory before any IR operations; forgetting leads to cryptic errors.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use 'from circt.ir import Module'.","cause":"Module is in circt.ir, not top-level.","error":"ImportError: cannot import name 'Module' from 'circt'"},{"fix":"Use 'with Context():' block to ensure single active context.","cause":"Multiple Context instances without proper cleanup.","error":"RuntimeError: Cannot create context: another context is already active"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}