Contributing
Development Setup
Clone the repository and install in editable mode:
git clone https://github.com/glenzac/svblock.git
cd svblock
pip install -e ".[dev,sphinx]"
Running Tests
The test suite includes 174 tests covering the parser, model, layout, renderer, CLI, themes, and end-to-end snapshot tests.
# Run all tests
pytest
# Run a specific test file
pytest tests/test_parser.py
# Run a single test by name
pytest tests/test_parser.py -k test_simple_module
# Run with verbose output
pytest -v
Linting
The project uses ruff for linting:
ruff check src/ tests/
Type Checking
Type hints are enforced with mypy:
mypy src/svblock/ --ignore-missing-imports
Snapshot Tests
End-to-end tests compare rendered SVG output against golden reference files in
tests/snapshots/. If you make changes to the renderer or layout engine that
intentionally change the output:
Run the snapshot update script:
python tests/update_snapshots.pyReview the diffs in
tests/snapshots/to verify the changes are correct.Commit the updated snapshots with your code changes.
Test Fixtures
Test fixtures are .sv files in tests/fixtures/ that cover a range of
SystemVerilog patterns:
simple_module.sv– minimal 3-port moduleannotated_module.sv– explicit@symgroup annotationsbus_ports.sv– parametric bus widthsclock_reset.sv– heuristic clock/reset detectionactive_low.sv– active-low signal detectioninterface_ports.sv– interfaces with modportslarge_module.sv– complex multi-group moduleparams.sv– various parameter typesmultidim_array.sv– multi-dimensional arraysnon_ansi.sv– non-ANSI port styleno_ports.sv– empty module edge casepartial_annotations.sv– mixed annotated/unannotated portstype_params.sv– parametric types
Project Structure
See Architecture for a detailed overview of the codebase organization and pipeline design.