pyslang
Python bindings for slang, a library for compiling SystemVerilog
What it is and what it does
pyslang is a Python interface to the slang SystemVerilog compiler, a high-performance front end for hardware design language processing. It allows you to load and inspect the syntax tree of SystemVerilog files, evaluate expressions in a scripting context, and access detailed information about modules, ports, declarations, and types. The underlying slang library handles lexing, parsing, type checking, and elaboration of SystemVerilog code with emphasis on compliance and robustness.
You use pyslang when you need to programmatically analyze or transform SystemVerilog designs—for example, extracting module hierarchies, validating code structure, generating reports, or building custom linting and refactoring tools. It has no runtime dependencies and is distributed as precompiled wheels for common platforms, making installation straightforward on supported Python versions.
Use it for:
- Extract and inspect module hierarchies, port lists, and signal declarations from existing SystemVerilog designs.
- Build custom linting or code-quality tools that need to understand SystemVerilog syntax and semantics.
- Generate SystemVerilog code or documentation by traversing and analyzing the parsed syntax tree.
- Evaluate SystemVerilog expressions and constraints in a scripting context without a full simulator.
- Integrate SystemVerilog parsing into editor plugins or language servers for real-time syntax checking.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
pyslang provides Python bindings to parse, analyze, and elaborate SystemVerilog code, exposing the underlying slang compiler's syntax tree and evaluation capabilities for programmatic inspection and manipulation.
Yes, if you work with SystemVerilog and need programmatic access to parsing and analysis. The package is actively maintained, has no known vulnerabilities, carries a permissive MIT license, and offers precompiled wheels for modern Python on major platforms. Medium install friction is acceptable given the complexity of compiling a C++ SystemVerilog parser. Not necessary if you only need command-line compilation or linting.
Install
pyslang on PyPI
pip
pip install pyslanguv
uv add pyslangpoetry
poetry add pyslangInstalling pyslang
Before you install
Medium friction: precompiled wheels available for multiple Python versions on macOS (arm64, universal2), Linux (aarch64, x86_64), and Windows (amd64). Maintenance is active with recent releases and steady repository activity.
License in practice
MIT license permits commercial and private use, modification, and distribution with minimal restrictions—only requiring preservation of copyright and license notices. No notable constraints for most use cases.
Quickstart
pip install pyslang
import pyslang
tree = pyslang.SyntaxTree.fromFile('design.sv')
mod = tree.root.members[0]
print(mod.header.name.value)
Requires a SystemVerilog source file to parse.
Verify before relying
- Exact minimum Python version not specified in metadata; wheels available but earliest version unclear.
- Performance characteristics and memory usage on large projects not quantified in the fact sheet.
- Completeness of SystemVerilog feature coverage beyond the reference to sv-lang.com/language-support.html.
Package facts
| License | Copyright (c) 2015-2026 Michael Popoloski Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in… (full text in the JSON record) (permissive) |
| Python support | not specified |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 91 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 455,517/month — #6,556 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pyslang-11.0.0-cp310-cp310-macosx_11_0_arm64.whl; pyslang-11.0.0-cp310-cp310-macosx_11_0_universal2.whl; pyslang-11.0.0-cp310-cp310-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl; pyslang-11.0.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; pyslang-11.0.0-cp310-cp310-win_amd64.whl; pyslang-11.0.0-cp311-cp311-macosx_11_0_arm64.whl; pyslang-11.0.0-cp311-cp311-macosx_11_0_universal2.whl; pyslang-11.0.0-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl; pyslang-11.0.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; pyslang-11.0.0-cp311-cp311-win_amd64.whl; pyslang-11.0.0-cp312-cp312-macosx_11_0_arm64.whl; pyslang-11.0.0-cp312-cp312-macosx_11_0_universal2.whl; pyslang-11.0.0-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl; pyslang-11.0.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; pyslang-11.0.0-cp312-cp312-win_amd64.whl; pyslang-11.0.0-cp313-cp313-macosx_11_0_arm64.whl; pyslang-11.0.0-cp313-cp313-macosx_11_0_universal2.whl; pyslang-11.0.0-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl; pyslang-11.0.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; pyslang-11.0.0-cp313-cp313-win_amd64.whl
Keywords: slang, verilog, systemverilog, parsing, compiler, eda
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
svqlParses SystemVerilog modules and exposes their…
permissive · top 15,000 on PyPI
tree-sitter-verilogProvides a SystemVerilog grammar parser for…
permissive · top 5,000 on PyPI
amalgam-langAmalgam is a Python wrapper that lets you call…
agpl · top 15,000 on PyPI
pydevicetreeParses, queries, and modifies Devicetree Source…
permissive · top 15,000 on PyPI
peakrdl-regblockCompiles SystemRDL register descriptions into…
copyleft · top 15,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
peakrdl-cliPeakRDL is a command-line tool that generates…
copyleft · top 15,000 on PyPI
dvsimDVSim is a Python-based build and run system…
permissive · top 15,000 on PyPI
peakrdlPeakRDL is a control and status register (CSR)…
copyleft · top 15,000 on PyPI