Skip to main content

pysvlang

Python bindings for svlang, a pure-Rust IEEE 1800-2023 SystemVerilog front end: filelists, preprocessor, a lossless concrete syntax tree, elaboration, compiler checks and a word-level RTL netlist.

The wheels are self-contained native extensions built with PyO3 and maturin. There is no C++ build and nothing else to install; one abi3 wheel per platform works on every Python from 3.9 on.

Status: alpha. The API below is the first slice (parse, diagnostics, tree walking, hierarchy, netlist summary) and may change before 1.0.

Use

import pysvlang

comp = pysvlang.Compilation(
    ["rtl/top.sv", "rtl/fifo.sv"],
    include_dirs=["rtl/include"],
    defines={"SYNTHESIS": None, "DEPTH": 16},
    top=["top"],
    params={"WIDTH": 32},
)
# Or simulator-style arguments, -f filelists included:
# comp = pysvlang.Compilation.from_args(["-f", "files.f", "-top", "top"])

for d in comp.diagnostics():
    print(d)                       # rtl/top.sv:12:5: error: ...

for tree in comp.trees:
    for mod in tree.root.find_all("ModuleDecl"):
        print(mod.child("Name").bare_text, mod.location)

print("\n".join(comp.hierarchy()))

nl = comp.lower_netlist(top="top")
print(nl.top, len(nl.inputs), len(nl.states))
print(nl.dump())

The syntax tree is lossless: tree.file_text() rebuilds the source byte for byte, and every Token carries its leading_trivia (whitespace, comments, directives). Node kinds are strings such as "ModuleDecl" or "ProceduralBlock"; pysvlang.SYNTAX_KINDS and pysvlang.TOKEN_KINDS list them all, and asking for a kind that does not exist raises ValueError.

lower_netlist() raises pysvlang.LowerError when the design has errors or uses constructs outside the synthesizable/formal subset. The exception's diagnostics list says why, and unsupported tells the two cases apart.

Parsing, checking and lowering release the GIL, so several compilations can run in threads at once.

Build from source

Needs Rust 1.85 or later and Python 3.9 or later.

cd crates/svlang-py
python -m venv .venv && . .venv/bin/activate
pip install maturin pytest
maturin develop --release
pytest tests

maturin build --release writes a wheel to target/wheels/.

Releasing

The Python workflow builds and tests the wheels on every change. Pushing a tag pysvlang-vX.Y.Z, where X.Y.Z is the workspace version in the root Cargo.toml, also publishes the wheels and sdist to PyPI through trusted publishing (repository mayurkubavat/svlang, workflow python.yml, environment pypi).

License

Apache-2.0, like svlang.

Metadata

Release files for pysvlang 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pysvlang 0.1.0
File Size Uploaded Provenance Actions
pysvlang-0.1.0.tar.gz 470.5 kB With provenance Details for pysvlang-0.1.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for pysvlang 0.1.0
File Actions
pysvlang-0.1.0-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details for pysvlang-0.1.0-cp39-abi3-win_amd64.whl
pysvlang-0.1.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-64 Details for pysvlang-0.1.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
pysvlang-0.1.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.9 abi3 Linux glibc 2.17+ ARM64 Details for pysvlang-0.1.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
pysvlang-0.1.0-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details for pysvlang-0.1.0-cp39-abi3-macosx_11_0_arm64.whl
pysvlang-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl CPython 3.9 abi3 macOS 10.12+ x86-64 Details for pysvlang-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl

Total release size: 8.7 MB

Release files / pysvlang-0.1.0.tar.gz

Download URL pysvlang-0.1.0.tar.gz
Size 470.5 kB
Tags Source
SHA-256 checksum
How to use checksums
3a87f049b81569c1f188859bcfb8e612131cb6e310b5a7255dc203d624ac50de
BLAKE2b-256 checksum
How to use checksums
603a687d7de3147a4c73d5c29523e57b80152e0b710cae400ad002a20ffc3241
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

Release files / pysvlang-0.1.0-cp39-abi3-win_amd64.whl

Download URL pysvlang-0.1.0-cp39-abi3-win_amd64.whl
Size 1.7 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
3aae7439bbfc0d9e3c5a201ba7305e96cc37a16e08f69b1ad5ae96ead115e827
BLAKE2b-256 checksum
How to use checksums
28563c2e2aee60a585fd631edb6961e3d8aac5189956c56eb990063b70a21237
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

Release files / pysvlang-0.1.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL pysvlang-0.1.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 1.8 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
3b8d46c6540b3f06798012822fcffc5d2dc3efc43308b370770743fa4ff8f914
BLAKE2b-256 checksum
How to use checksums
645670c4f2a2496650609f5ce49235bcab90597f0a67f673bc09c9d130f9a983
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

Release files / pysvlang-0.1.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL pysvlang-0.1.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 1.6 MB
Tags CPython 3.9 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
a75317221df77ff195309249646650f20ebe5e2017b3d8a0b780ef0ddcf8f9c2
BLAKE2b-256 checksum
How to use checksums
2ecaa53c8c00c139052ba5aa7311baa33daf5360ecf94b4e08e8cbd458c173b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

Release files / pysvlang-0.1.0-cp39-abi3-macosx_11_0_arm64.whl

Download URL pysvlang-0.1.0-cp39-abi3-macosx_11_0_arm64.whl
Size 1.6 MB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
312f35e365553a7b3f23b7fdbbf25705cb92fe7875f5fc657ed8a3f4b88fcc62
BLAKE2b-256 checksum
How to use checksums
beae6d2c192fb01de61e45ae90b5c25aeae3d6367ac08a4a27de731ca2740ef2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

Release files / pysvlang-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl

Download URL pysvlang-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl
Size 1.7 MB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
0125fc783b7ec233de138dfad10d9ff9d252a8e36c01a681709d21cbd1d6606f
BLAKE2b-256 checksum
How to use checksums
985d281664a1b897ac6c89800c566aec043169ed96eb833e34f940130893badb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

Security for pysvlang 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for pysvlang-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 14, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page