From f5b68f2a7fab51213c5c351934f24ac56d037a7b Mon Sep 17 00:00:00 2001 From: "python-templates-copier-update[bot]" Date: Sun, 11 Oct 2026 11:26:36 +0000 Subject: [PATCH 1/2] Update from Copier (2026-10-11T11-26-33Z) Signed-off-by: python-templates-copier-update[bot] --- .copier-answers.yaml | 2 +- .github/workflows/build.yaml | 2 +- Makefile | 10 +++++----- pyproject.toml | 3 ++- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.copier-answers.yaml b/.copier-answers.yaml index 42579a2..57166e2 100644 --- a/.copier-answers.yaml +++ b/.copier-answers.yaml @@ -1,5 +1,5 @@ # Changes here will be overwritten by Copier -_commit: ebb6e1c +_commit: '4372075' _src_path: https://github.com/python-project-templates/base.git add_docs: false add_extension: python diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 8444d39..3fc0c38 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -15,7 +15,7 @@ on: workflow_dispatch: concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true permissions: diff --git a/Makefile b/Makefile index 39e76ff..32fd774 100644 --- a/Makefile +++ b/Makefile @@ -25,16 +25,16 @@ lint-py: ## lint python with ruff python -m ruff format --check hatch_js lint-docs: ## lint docs with mdformat and codespell - python -m mdformat --check README.md - python -m codespell_lib README.md + python -m mdformat --check README.md $(wildcard docs/src) + python -m codespell_lib README.md $(wildcard docs/src) fix-py: ## autoformat python code with ruff python -m ruff check --fix hatch_js python -m ruff format hatch_js fix-docs: ## autoformat docs with mdformat and codespell - python -m mdformat README.md - python -m codespell_lib --write README.md + python -m mdformat README.md $(wildcard docs/src) + python -m codespell_lib --write README.md $(wildcard docs/src) lint: lint-py lint-docs ## run all linters lints: lint @@ -52,7 +52,7 @@ check-dist: ## check python sdist and wheel with check-dist check-types: ## check python types with ty ty check --python $$(which python) -checks: check-dist +checks: check-dist check-types # Alias check: checks diff --git a/pyproject.toml b/pyproject.toml index 5ab908f..1f792e3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -50,6 +50,7 @@ develop = [ "codespell", "hatchling", "mdformat", + "mdformat-frontmatter", "mdformat-tables>=1", "pytest", "pytest-cov", @@ -92,7 +93,7 @@ replace = 'version = "{new_version}"' [tool.coverage.run] branch = false omit = [ - "hatch_js/tests/integration/", + "hatch_js/tests/integration/*", ] [tool.coverage.report] From df3589caaeaf957b6812946585bbd4023a81b16b Mon Sep 17 00:00:00 2001 From: Tim Paine <3105306+timkpaine@users.noreply.github.com> Date: Sun, 11 Oct 2026 11:53:54 -0400 Subject: [PATCH 2/2] Fix JavaScript build defaults and type checks Signed-off-by: Tim Paine <3105306+timkpaine@users.noreply.github.com> --- Makefile | 10 +++++----- hatch_js/structs.py | 4 ++-- hatch_js/tests/test_hook_registration.py | 3 ++- hatch_js/tests/test_structs.py | 21 +++++++++++++++++++++ 4 files changed, 30 insertions(+), 8 deletions(-) create mode 100644 hatch_js/tests/test_structs.py diff --git a/Makefile b/Makefile index 32fd774..a394e58 100644 --- a/Makefile +++ b/Makefile @@ -25,16 +25,16 @@ lint-py: ## lint python with ruff python -m ruff format --check hatch_js lint-docs: ## lint docs with mdformat and codespell - python -m mdformat --check README.md $(wildcard docs/src) - python -m codespell_lib README.md $(wildcard docs/src) + python -m mdformat --check README.md $(wildcard docs/src) + python -m codespell_lib README.md $(wildcard docs/src) fix-py: ## autoformat python code with ruff python -m ruff check --fix hatch_js python -m ruff format hatch_js fix-docs: ## autoformat docs with mdformat and codespell - python -m mdformat README.md $(wildcard docs/src) - python -m codespell_lib --write README.md $(wildcard docs/src) + python -m mdformat README.md $(wildcard docs/src) + python -m codespell_lib --write README.md $(wildcard docs/src) lint: lint-py lint-docs ## run all linters lints: lint @@ -50,7 +50,7 @@ check-dist: ## check python sdist and wheel with check-dist check-dist -v check-types: ## check python types with ty - ty check --python $$(which python) + python -m ty check checks: check-dist check-types diff --git a/hatch_js/structs.py b/hatch_js/structs.py index 3b8dcaa..94a67d4 100644 --- a/hatch_js/structs.py +++ b/hatch_js/structs.py @@ -85,7 +85,7 @@ def execute(self): # First navigate to the project path cwd = Path(curdir).resolve() - chdir(self.path) + chdir(self.path or cwd) for command in self.commands: ret = system_call(command) @@ -95,7 +95,7 @@ def execute(self): # Check that all targets exist # Go back to original path chdir(str(cwd)) - for target in self.targets: + for target in self.targets or []: if not Path(target).resolve().exists(): raise FileNotFoundError(f"Target '{target}' does not exist after build. Please check your build configuration.") return self.commands diff --git a/hatch_js/tests/test_hook_registration.py b/hatch_js/tests/test_hook_registration.py index 7b463c2..1793faa 100644 --- a/hatch_js/tests/test_hook_registration.py +++ b/hatch_js/tests/test_hook_registration.py @@ -1,4 +1,5 @@ from hatchling.builders.hooks.plugin.interface import BuildHookInterface +from hatchling.metadata.core import ProjectMetadata from hatch_js.hooks import hatch_register_build_hook @@ -10,7 +11,7 @@ def test_registered_build_hook_accepts_hatchling_configuration(tmp_path): root=str(tmp_path), config=config, build_config=None, - metadata=None, + metadata=ProjectMetadata(str(tmp_path), None, {"project": {"name": "project", "version": "0.1.0"}}), directory=str(tmp_path), target_name="wheel", ) diff --git a/hatch_js/tests/test_structs.py b/hatch_js/tests/test_structs.py new file mode 100644 index 0000000..e1b289f --- /dev/null +++ b/hatch_js/tests/test_structs.py @@ -0,0 +1,21 @@ +from pathlib import Path + +import pytest + +from hatch_js.structs import HatchJsBuildPlan + + +@pytest.mark.parametrize("targets", [None, []]) +def test_execute_uses_working_directory_by_default(tmp_path, monkeypatch, targets): + monkeypatch.chdir(tmp_path) + directories = [] + + def run(command): + directories.append(Path.cwd()) + return 0 + + monkeypatch.setattr("hatch_js.structs.system_call", run) + plan = HatchJsBuildPlan(targets=targets) + plan.generate() + plan.execute() + assert directories == [tmp_path, tmp_path]