From 946ff6b8be69e6908aad7c10237b8d508ee89938 Mon Sep 17 00:00:00 2001 From: Daniel Haag <121057143+denialhaag@users.noreply.github.com> Date: Wed, 17 Jun 2026 15:46:44 +0200 Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=90=9B=20Run=20prek=20from=20current?= =?UTF-8?q?=20working=20direcory?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mqt/templates/render_templates.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mqt/templates/render_templates.py b/src/mqt/templates/render_templates.py index aae13ba..8d08faa 100644 --- a/src/mqt/templates/render_templates.py +++ b/src/mqt/templates/render_templates.py @@ -236,7 +236,7 @@ def render_templates( if template_container.arguments is None: _copy_template(template_container, output_dir) else: - _render_template(environment, template_container, output_dir) + _render_template(environment, template_container, target_dir) def _copy_template(template_container: TemplateContainer, output_dir: Path) -> None: @@ -252,7 +252,7 @@ def _copy_template(template_container: TemplateContainer, output_dir: Path) -> N output_path.write_text(output, encoding="utf-8") -def _render_template(environment: jinja2.Environment, template_container: TemplateContainer, output_dir: Path) -> None: +def _render_template(environment: jinja2.Environment, template_container: TemplateContainer, target_dir: Path) -> None: """Render a template.""" if template_container.active: assert template_container.arguments is not None @@ -263,8 +263,8 @@ def _render_template(environment: jinja2.Environment, template_container: Templa output = template.render(**template_container.arguments) # Write the rendered template to a file - output_path = output_dir / template_container.file_name + output_path = target_dir / template_container.output_dir / template_container.file_name output_path.write_text(output + "\n", encoding="utf-8") # Format the rendered template - subprocess.run(["prek", "run", "--files", str(output_path)], check=False) + subprocess.run(["prek", "run", "--files", str(output_path)], cwd=target_dir, check=False) From 50535d81a1ff479bd0e67eeb9bbd13c67004f923 Mon Sep 17 00:00:00 2001 From: Daniel Haag <121057143+denialhaag@users.noreply.github.com> Date: Wed, 17 Jun 2026 15:58:59 +0200 Subject: [PATCH 2/3] Update changelog --- CHANGELOG.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 36e5c09..d30aba3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,12 @@ with the exception that minor releases may include breaking changes. ## [Unreleased] +## [1.3.1] - 2026-06-17 + +### Fixed + +- 🐛 Run `prek` from root of target repository ([#344]) ([**@denialhaag**]) + ## [1.3.0] - 2026-06-16 _If you are upgrading: please see [`UPGRADING.md`](UPGRADING.md#130)._ @@ -224,7 +230,8 @@ _If you are upgrading: please see [`UPGRADING.md`](UPGRADING.md#110)._ -[unreleased]: https://github.com/munich-quantum-toolkit/templates/compare/v1.3.0...HEAD +[unreleased]: https://github.com/munich-quantum-toolkit/templates/compare/v1.3.1...HEAD +[1.3.1]: https://github.com/munich-quantum-toolkit/templates/releases/tag/v1.3.1 [1.3.0]: https://github.com/munich-quantum-toolkit/templates/releases/tag/v1.3.0 [1.2.0]: https://github.com/munich-quantum-toolkit/templates/releases/tag/v1.2.0 [1.1.13]: https://github.com/munich-quantum-toolkit/templates/releases/tag/v1.1.13 @@ -245,6 +252,7 @@ _If you are upgrading: please see [`UPGRADING.md`](UPGRADING.md#110)._ +[#344]: https://github.com/munich-quantum-toolkit/templates/pull/344 [#338]: https://github.com/munich-quantum-toolkit/templates/pull/338 [#332]: https://github.com/munich-quantum-toolkit/templates/pull/332 [#328]: https://github.com/munich-quantum-toolkit/templates/pull/328 From 422ffcd28c4c947bdec60d2256e62b03dddde05f Mon Sep 17 00:00:00 2001 From: Daniel Haag <121057143+denialhaag@users.noreply.github.com> Date: Wed, 17 Jun 2026 16:11:04 +0200 Subject: [PATCH 3/3] Resolve target_dir --- src/mqt/templates/render_templates.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mqt/templates/render_templates.py b/src/mqt/templates/render_templates.py index 8d08faa..fdd1ef0 100644 --- a/src/mqt/templates/render_templates.py +++ b/src/mqt/templates/render_templates.py @@ -82,6 +82,8 @@ def render_templates( Raises: ValueError: If the arguments are incompatible with each other or if the project type is not supported. """ + target_dir = target_dir.resolve() + supported_project_types = ["pure-python", "c++-python", "c++-mlir-python", "other"] if project_type not in supported_project_types: msg = f"Project type '{project_type}' is not supported. Must be one of {supported_project_types}."