Skip to content

Clean-up and new API gen method#44

Merged
mballance merged 4 commits intomainfrom
mballance/pytest
Jan 2, 2026
Merged

Clean-up and new API gen method#44
mballance merged 4 commits intomainfrom
mballance/pytest

Conversation

@mballance
Copy link
Member

Remove dependency on pytypeworks package. Add support for generating SV classes from JSON

Signed-off-by: Matthew Ballance <matt.ballance@gmail.com>
The tests reference hdlsim_dvflow but the fixture was named pyhdl_dvflow,
causing fixture not found errors in CI.
Signed-off-by: Matthew Ballance <matt.ballance@gmail.com>
- Implement JSON-based API definition format with comprehensive schema
- Add format detection supporting JSON (now), YAML/TOML (future)
- Create Python class generator from JSON specs
- Add command-line tool for Python generation from JSON
- Implement --spec/-s parameter (replaces --json/-j, backward compatible)
- Add --spec-fmt parameter for explicit format specification
- Support both inline spec strings and file paths in DFM tasks
- Validate .json extension for spec file paths
- Add JSON Schema (Draft 7) with editor integration support
- Publish schema to docs root for easy reference

New files:
- src/hdl_if/impl/call/api_def_from_json.py - JSON parser
- src/hdl_if/impl/call/gen_py_class.py - Python class generator
- scripts/gen_py_from_json.py - Command-line tool
- doc/pyhdl-if.schema.json - JSON Schema specification
- doc/JSON_API_GENERATION.md - User documentation
- doc/SCHEMA_README.md - Schema usage guide

Testing:
- 50 unit tests (13 spec format, 15 schema, 10 JSON, 12 filtering)
- 3 integration tests with Verilator
- All tests pass, no regressions
- Backward compatibility maintained (--json/-j still works)

Documentation:
- IMPLEMENTATION_SUMMARY.md - Technical overview
- JSON_SCHEMA_SUMMARY.md - Schema details
- SPEC_FORMAT_SUMMARY.md - Format support details
@mballance mballance merged commit 362338e into main Jan 2, 2026
18 checks passed
@mballance mballance deleted the mballance/pytest branch January 2, 2026 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant