From 4dccab738f19644afad4c01889c1917bfe3fc325 Mon Sep 17 00:00:00 2001 From: Tymoteusz Blazejczyk Date: Sun, 10 Aug 2025 20:24:04 +0200 Subject: [PATCH 1/3] feat: add Python stub file for Vivado --- .gitignore | 1 + src/pytcl/vivado.pyi | 98 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 99 insertions(+) create mode 100644 src/pytcl/vivado.pyi diff --git a/.gitignore b/.gitignore index ef8e2e6..eb3bdea 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,7 @@ !*.tcl !*.svh !*.txt +!*.pyi !*.sv !*.py !*.md diff --git a/src/pytcl/vivado.pyi b/src/pytcl/vivado.pyi new file mode 100644 index 0000000..4aae5b9 --- /dev/null +++ b/src/pytcl/vivado.pyi @@ -0,0 +1,98 @@ +# SPDX-FileCopyrightText: 2025 Tymoteusz Blazejczyk +# SPDX-License-Identifier: Apache-2.0 + +"""Xilinx Vivado.""" + +from pathlib import Path +from collections.abc import Iterable + +from .pytcl import PyTCL +from .value import TCLValue + + +class Vivado(PyTCL): + """Xilinx Vivado. + + .. _Vivado Design Suite Tcl Command Reference Guide (UG835): + https://docs.amd.com/r/en-US/ug835-vivado-tcl-commands + """ + + def create_project( + self, + name: str | TCLValue, + path: Path | str | TCLValue = ".", + *args, + **kwargs, + ) -> None: + """Create a new project. + + Args: + name: Project name. + path: Directory where the project file is saved. + """ + + def close_project(self, *args, **kwargs) -> None: + """Close current opened project.""" + + def get_runs( + self, + patterns: Iterable[str | TCLValue] | str | TCLValue = "*", + *args, + **kwargs, + ) -> TCLValue: + """Get a list of runs. + + Args: + patterns: Match run names against patterns + + Returns: + List of run objects. + """ + + def launch_runs( + self, + runs: Iterable[str | TCLValue] | str | TCLValue, + *args, + **kwargs, + ) -> None: + """Launch a set of runs. + + Args: + runs: Runs to launch. + """ + + def wait_for_run( + self, + run: str | TCLValue, + *args, + **kwargs, + ) -> None: + """Block execution of further Tcl commands until the specified run complete(s). + + Args: + run: Run to wait. + """ + + def wait_for_runs( + self, + runs: Iterable[str | TCLValue] | str | TCLValue, + *args, + **kwargs, + ) -> None: + """Block execution of further Tcl commands until the specified run(s) complete(s). + + Args: + runs: Runs to wait. + """ + + def add_files( + self, + files: Iterable[str | Path | TCLValue] | str | Path | TCLValue, + *args, + **kwargs, + ) -> None: + """Add sources to the active fileset. + + Args: + files: Name of the files and/or directories to add. Must be specified if -scan_for_includes is not used. + """ -- GitLab From f9a7cbc4b5af226ab94e5b87962d00205af61707 Mon Sep 17 00:00:00 2001 From: Tymoteusz Blazejczyk Date: Sun, 10 Aug 2025 20:26:26 +0200 Subject: [PATCH 2/3] fix: ruff format --- src/pytcl/vivado.pyi | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pytcl/vivado.pyi b/src/pytcl/vivado.pyi index 4aae5b9..6f63f50 100644 --- a/src/pytcl/vivado.pyi +++ b/src/pytcl/vivado.pyi @@ -9,7 +9,6 @@ from collections.abc import Iterable from .pytcl import PyTCL from .value import TCLValue - class Vivado(PyTCL): """Xilinx Vivado. -- GitLab From 4d320d77a371cd6d931a8931f8188cc2fb921505 Mon Sep 17 00:00:00 2001 From: Tymoteusz Blazejczyk Date: Sun, 10 Aug 2025 20:45:53 +0200 Subject: [PATCH 3/3] chore: replace pathlib.Path with more generic os.PathLike --- src/pytcl/vivado.pyi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pytcl/vivado.pyi b/src/pytcl/vivado.pyi index 6f63f50..ee0aff7 100644 --- a/src/pytcl/vivado.pyi +++ b/src/pytcl/vivado.pyi @@ -3,7 +3,7 @@ """Xilinx Vivado.""" -from pathlib import Path +from os import PathLike from collections.abc import Iterable from .pytcl import PyTCL @@ -19,7 +19,7 @@ class Vivado(PyTCL): def create_project( self, name: str | TCLValue, - path: Path | str | TCLValue = ".", + path: str | PathLike | TCLValue = ".", *args, **kwargs, ) -> None: @@ -86,7 +86,7 @@ class Vivado(PyTCL): def add_files( self, - files: Iterable[str | Path | TCLValue] | str | Path | TCLValue, + files: Iterable[str | PathLike | TCLValue] | str | PathLike | TCLValue, *args, **kwargs, ) -> None: -- GitLab