Skip to content

API: auto-add top files + compile-order printout (0.3.0.dev1) - #13

Merged
pevhall merged 4 commits into
pevhall:devfrom
ZoocB:dev
Jul 30, 2026
Merged

pevhall merged 4 commits into
pevhall:devfrom
ZoocB:dev

Conversation

@ZoocB

@ZoocB ZoocB commented Jul 19, 2026

Copy link
Copy Markdown
Contributor
  • top_file auto-add — analyse(top_file=...) now adds a file that isn't in
    the config (type inferred from extension) instead of erroring, so testbench tops
    needn't be listed.
    hdldepends.analyse("hdldeps.yaml", top_file="sim/tb.vhd")

  • Compile-order printout on AnalysisResult — get the CLI's tree-indented
    listing from the API, as text or to stdout.
    result.print_compile_order() / text = result.format_compile_order()

ZoocB added 4 commits July 18, 2026 12:32
analyse(top_file=...) now parses and adds a top file not listed in the
config instead of raising "not in the project", inferring the file type
from its extension (new config.add_top_file_by_path / TOP_FILE_EXT_TYPES).
This restores the old --top-file-type behaviour so a testbench top level
need not be added to the config just to produce a basic compile order.

Adds Resolver.verilog_include_dirs so an auto-added Verilog top can
resolve its `include directives against the project's search dirs.
Bump __version__ from 0.2.0 to the PEP 440 development release 0.3.0.dev0
and add a CHANGELOG section for the top_file auto-add fix. The config-schema
version (HDL_DEPENDS_VERSION_NUM) is independent and unchanged.
Add AnalysisResult.format_compile_order() -> str and
AnalysisResult.print_compile_order(), giving API callers the same
human-readable, tree-indented listing the CLI prints. AnalysisResult now
retains the resolved SourceFile order in a non-serialised `source_files`
field (to_dict()/JSON output unchanged); the shared rendering moves to
output.format_compile_order, which output.print_compile_order and the CLI
now delegate to.

Add examples/python_api (analyse_example.py + a small VHDL project) as a
runnable walkthrough of the API -- the compile-order printout and the
top_file auto-add -- exercised by test_examples.py.
CHANGELOG section for the AnalysisResult compile-order printout API.
@pevhall
pevhall merged commit e4eacd5 into pevhall:dev Jul 30, 2026
4 checks passed
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.

2 participants