diff --git a/flake.lock b/flake.lock index 946349e..d0aecd5 100644 --- a/flake.lock +++ b/flake.lock @@ -20,11 +20,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1762233356, - "narHash": "sha256-cGS3lLTYusbEP/IJIWGgnkzIl+FA5xDvtiHyjalGr4k=", + "lastModified": 1763622513, + "narHash": "sha256-1jQnuyu82FpiSxowrF/iFK6Toh9BYprfDqfs4BB+19M=", "owner": "nixos", "repo": "nixpkgs", - "rev": "ca534a76c4afb2bdc07b681dbc11b453bab21af8", + "rev": "c58bc7f5459328e4afac201c5c4feb7c818d604b", "type": "github" }, "original": { @@ -36,11 +36,11 @@ }, "nixpkgs-unstable": { "locked": { - "lastModified": 1762111121, - "narHash": "sha256-4vhDuZ7OZaZmKKrnDpxLZZpGIJvAeMtK6FKLJYUtAdw=", + "lastModified": 1763421233, + "narHash": "sha256-Stk9ZYRkGrnnpyJ4eqt9eQtdFWRRIvMxpNRf4sIegnw=", "owner": "nixos", "repo": "nixpkgs", - "rev": "b3d51a0365f6695e7dd5cdf3e180604530ed33b4", + "rev": "89c2b2330e733d6cdb5eae7b899326930c2c0648", "type": "github" }, "original": { @@ -63,11 +63,11 @@ ] }, "locked": { - "lastModified": 1761781027, - "narHash": "sha256-YDvxPAm2WnxrznRqWwHLjryBGG5Ey1ATEJXrON+TWt8=", + "lastModified": 1763662255, + "narHash": "sha256-4bocaOyLa3AfiS8KrWjZQYu+IAta05u3gYZzZ6zXbT0=", "owner": "pyproject-nix", "repo": "build-system-pkgs", - "rev": "795a980d25301e5133eca37adae37283ec3c8e66", + "rev": "042904167604c681a090c07eb6967b4dd4dae88c", "type": "github" }, "original": { @@ -83,11 +83,11 @@ ] }, "locked": { - "lastModified": 1762427963, - "narHash": "sha256-CkPlAbIQ87wmjy5qHibfzk4DmMGBNqFer+lLfXjpP5M=", + "lastModified": 1763716960, + "narHash": "sha256-PUlomle4klGbnZr0wOn8z61Mbt7tXh6Yp3hZ9/CQkq0=", "owner": "nix-community", "repo": "pyproject.nix", - "rev": "4540ea004e04fcd12dd2738d51383d10f956f7b9", + "rev": "d6c61dbe0be75e2f4cf0efcdc62428175be4cfb5", "type": "github" }, "original": { @@ -131,11 +131,11 @@ ] }, "locked": { - "lastModified": 1761872265, - "narHash": "sha256-i25GRgp2vUOebY70L3NTAgkd+Pr1hnn5xM3qHxH0ONU=", + "lastModified": 1763659333, + "narHash": "sha256-J82tKGAOQ/mv8edogn86u7moTBjuncWj1ILe5mRzLAo=", "owner": "pyproject-nix", "repo": "uv2nix", - "rev": "74dfb62871be152ad3673b143b0cc56105a4f3c5", + "rev": "6d893fa1cdb7a4523bcab3d41e77ed06affb75c6", "type": "github" }, "original": { diff --git a/pyproject.toml b/pyproject.toml index 50842f6..f091315 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -63,6 +63,7 @@ nix = [ [project.scripts] dvsim = "dvsim.cli:main" +dvsim-admin = "dvsim.cli.admin:cli" ################ # BUILD-SYSTEM # diff --git a/src/dvsim/cli/__init__.py b/src/dvsim/cli/__init__.py new file mode 100644 index 0000000..b4a0e8b --- /dev/null +++ b/src/dvsim/cli/__init__.py @@ -0,0 +1,9 @@ +# Copyright lowRISC contributors (OpenTitan project). +# Licensed under the Apache License, Version 2.0, see LICENSE for details. +# SPDX-License-Identifier: Apache-2.0 + +"""DVSim CLI.""" + +from dvsim.cli.run import main + +__all__ = ("main",) diff --git a/src/dvsim/cli/admin.py b/src/dvsim/cli/admin.py new file mode 100644 index 0000000..dad3a9a --- /dev/null +++ b/src/dvsim/cli/admin.py @@ -0,0 +1,48 @@ +# Copyright lowRISC contributors (OpenTitan project). +# Licensed under the Apache License, Version 2.0, see LICENSE for details. +# SPDX-License-Identifier: Apache-2.0 + +"""DVSim CLI main entry point.""" + +from pathlib import Path + +import click + +from dvsim.report.data import ResultsSummary +from dvsim.report.generate import gen_block_report + + +@click.group() +def cli() -> None: + """DVSim Administration tool. + + Temporary tool for administration tasks for a DVSim project. The commands + here are experimental and may change at any time. As functionality + stabilises it will be moved over to the main `dvsim` command. + """ + + +@cli.group() +def report() -> None: + """Reporting helper commands.""" + + +@report.command() +@click.argument( + "json_path", + type=click.Path(exists=True, file_okay=True, dir_okay=False, path_type=Path), +) +@click.argument( + "output_dir", + type=click.Path(file_okay=False, dir_okay=True, path_type=Path), +) +def gen(json_path: Path, output_dir: Path) -> None: + """Generate a report from a existing results JSON.""" + from dvsim.report.generate import gen_summary_report + + results: ResultsSummary = ResultsSummary.load(path=json_path) + + gen_summary_report(summary=results, path=output_dir) + + for flow_result in results.flow_results.values(): + gen_block_report(flow_result, path=output_dir) diff --git a/src/dvsim/cli.py b/src/dvsim/cli/run.py similarity index 99% rename from src/dvsim/cli.py rename to src/dvsim/cli/run.py index 8868dc3..31f1b73 100644 --- a/src/dvsim/cli.py +++ b/src/dvsim/cli/run.py @@ -917,7 +917,3 @@ def main() -> None: if cfg.has_errors(): log.error("Errors were encountered in this run.") sys.exit(1) - - -if __name__ == "__main__": - main() diff --git a/uv.lock b/uv.lock index 6cda3d6..1c88fd7 100644 --- a/uv.lock +++ b/uv.lock @@ -1,5 +1,5 @@ version = 1 -revision = 3 +revision = 2 requires-python = ">=3.10" resolution-markers = [ "python_full_version >= '3.11'", @@ -35,15 +35,15 @@ wheels = [ [[package]] name = "blessed" -version = "1.24.0" +version = "1.25.0" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "jinxed", marker = "sys_platform == 'win32'" }, { name = "wcwidth" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/3d/43/a01951b548a8006f58a6e8f46a958f35405853305610f1f5e86578aab7c9/blessed-1.24.0.tar.gz", hash = "sha256:7822698616deb79dc8897215eef8ed56b6a3fc537dc08ffce2f2020697c6c0d4", size = 6746429, upload-time = "2025-11-16T19:17:18.486Z" } +sdist = { url = "https://files.pythonhosted.org/packages/33/cd/eed8b82f1fabcb817d84b24d0780b86600b5c3df7ec4f890bcbb2371b0ad/blessed-1.25.0.tar.gz", hash = "sha256:606aebfea69f85915c7ca6a96eb028e0031d30feccc5688e13fd5cec8277b28d", size = 6746381, upload-time = "2025-11-18T18:43:52.71Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/f4/88/d4681b7ff72b7f8fc01ec87534fc50bfdd2103b137e5acb9493884f06ef5/blessed-1.24.0-py3-none-any.whl", hash = "sha256:177d36ce89db91c8a61e9cf2085d5cedb6f1617dcc7c39b604bb474e2e192ec7", size = 95531, upload-time = "2025-11-16T19:17:16.912Z" }, + { url = "https://files.pythonhosted.org/packages/7c/2c/e9b6dd824fb6e76dbd39a308fc6f497320afd455373aac8518ca3eba7948/blessed-1.25.0-py3-none-any.whl", hash = "sha256:e52b9f778b9e10c30b3f17f6b5f5d2208d1e9b53b270f1d94fc61a243fc4708f", size = 95646, upload-time = "2025-11-18T18:43:50.924Z" }, ] [[package]] @@ -417,7 +417,7 @@ name = "exceptiongroup" version = "1.3.0" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "typing-extensions", marker = "python_full_version < '3.11'" }, + { name = "typing-extensions", marker = "python_full_version < '3.13'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/0b/9f/a65090624ecf468cdca03533906e7c69ed7588582240cfe7cc9e770b50eb/exceptiongroup-1.3.0.tar.gz", hash = "sha256:b241f5885f560bc56a59ee63ca4c6a8bfa46ae4ad651af316d4e81817bb9fd88", size = 29749, upload-time = "2025-05-10T17:42:51.123Z" } wheels = [