From 5145f2803a1f9de8bdf1ae18942f31b21b4668a2 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 19 Jan 2025 05:17:20 +0000 Subject: [PATCH 01/48] Update from copier (2025-01-19T05:17:20) --- .copier-answers.yml | 2 +- pyproject.toml | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.copier-answers.yml b/.copier-answers.yml index f3bd003..6476fe7 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,5 +1,5 @@ # Changes here will be overwritten by Copier -_commit: 81e8acd +_commit: 7c534a1 _src_path: https://github.com/python-project-templates/base.git add_extension: python email: t.paine154@gmail.com diff --git a/pyproject.toml b/pyproject.toml index cdbf5d7..22fe31b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -81,7 +81,6 @@ replace = 'version = "{new_version}"' ignore = [ ".copier-answers.yml", "Makefile", - "setup.py", "docs/**/*", ] From 51a7d7781ca628cf9fe5d7d6f2a35327a1030dcf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 1 Feb 2025 07:15:12 +0000 Subject: [PATCH 02/48] Update ruff requirement from <0.9,>=0.3 to >=0.3,<0.10 Updates the requirements on [ruff](https://github.com/astral-sh/ruff) to permit the latest version. - [Release notes](https://github.com/astral-sh/ruff/releases) - [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md) - [Commits](https://github.com/astral-sh/ruff/compare/v0.3.0...0.9.4) --- updated-dependencies: - dependency-name: ruff dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 22fe31b..eb10078 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,7 +41,7 @@ develop = [ "build", "bump-my-version", "check-manifest", - "ruff>=0.3,<0.9", + "ruff>=0.3,<0.10", "twine", "wheel", # test From 48172d662fa66f20a51487539916f459ec060836 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 2 Feb 2025 05:18:13 +0000 Subject: [PATCH 03/48] Update from copier (2025-02-02T05:18:13) --- .copier-answers.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.copier-answers.yml b/.copier-answers.yml index 6476fe7..6d5b188 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,5 +1,5 @@ # Changes here will be overwritten by Copier -_commit: 7c534a1 +_commit: '9689455' _src_path: https://github.com/python-project-templates/base.git add_extension: python email: t.paine154@gmail.com From a19cc2ee4ef604a91a768d6e06bbfff12df8aca7 Mon Sep 17 00:00:00 2001 From: Tim Paine <3105306+timkpaine@users.noreply.github.com> Date: Sat, 15 Feb 2025 23:54:40 -0500 Subject: [PATCH 04/48] workaround until https://github.com/wjakob/nanobind/commit/abd27e3b5565bc95f5091321f0f863fce8b5b95b --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index eb10078..42dc4bc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,7 +45,7 @@ develop = [ "twine", "wheel", # test - "nanobind", + "nanobind<2.5.0", # https://github.com/wjakob/nanobind/commit/abd27e3b5565bc95f5091321f0f863fce8b5b95b "pybind11", "pytest", "pytest-cov", From 78c005a90d6ea2bfaf3883568749700188b170c8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 1 Apr 2025 07:54:11 +0000 Subject: [PATCH 05/48] Update ruff requirement from <0.10,>=0.3 to >=0.3,<0.12 Updates the requirements on [ruff](https://github.com/astral-sh/ruff) to permit the latest version. - [Release notes](https://github.com/astral-sh/ruff/releases) - [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md) - [Commits](https://github.com/astral-sh/ruff/compare/v0.3.0...0.11.2) --- updated-dependencies: - dependency-name: ruff dependency-version: 0.11.2 dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 42dc4bc..bba0d34 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,7 +41,7 @@ develop = [ "build", "bump-my-version", "check-manifest", - "ruff>=0.3,<0.10", + "ruff>=0.3,<0.12", "twine", "wheel", # test From ba98c5c8f623c551dcd0e27f6aa12a4f27b71379 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 1 Apr 2025 07:54:16 +0000 Subject: [PATCH 06/48] Update nanobind requirement from <2.5.0 to <2.7.0 Updates the requirements on [nanobind](https://github.com/wjakob/nanobind) to permit the latest version. - [Changelog](https://github.com/wjakob/nanobind/blob/master/docs/changelog.rst) - [Commits](https://github.com/wjakob/nanobind/compare/v0.0.1...v2.6.1) --- updated-dependencies: - dependency-name: nanobind dependency-version: 2.6.1 dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 42dc4bc..09cf7d7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,7 +45,7 @@ develop = [ "twine", "wheel", # test - "nanobind<2.5.0", # https://github.com/wjakob/nanobind/commit/abd27e3b5565bc95f5091321f0f863fce8b5b95b + "nanobind<2.7.0", # https://github.com/wjakob/nanobind/commit/abd27e3b5565bc95f5091321f0f863fce8b5b95b "pybind11", "pytest", "pytest-cov", From 906e5acc620956817c622f4e5fcc3590789cbba3 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 6 Apr 2025 05:19:15 +0000 Subject: [PATCH 07/48] Update from copier (2025-04-06T05:19:15) --- .copier-answers.yml | 2 +- .github/workflows/build.yml | 7 ++----- Makefile | 4 ++-- pyproject.toml | 1 + 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/.copier-answers.yml b/.copier-answers.yml index 6d5b188..dab7480 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,5 +1,5 @@ # Changes here will be overwritten by Copier -_commit: '9689455' +_commit: '6957226' _src_path: https://github.com/python-project-templates/base.git add_extension: python email: t.paine154@gmail.com diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b5df3cb..ef66d9b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,12 +35,9 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 + - uses: actions-ext/python/setup@main with: - python-version: ${{ matrix.python-version }} - cache: 'pip' - cache-dependency-path: 'pyproject.toml' + version: ${{ matrix.python-version }} - name: Install dependencies run: make develop diff --git a/Makefile b/Makefile index f1ad97c..adac7f6 100644 --- a/Makefile +++ b/Makefile @@ -4,13 +4,13 @@ .PHONY: develop build install develop: ## install dependencies and build library - python -m pip install -e .[develop] + uv pip install -e .[develop] build: ## build the python library python -m build -n install: ## install library - python -m pip install . + uv pip install . ######### # LINTS # diff --git a/pyproject.toml b/pyproject.toml index d6c3f06..9d37394 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,6 +43,7 @@ develop = [ "check-manifest", "ruff>=0.3,<0.12", "twine", + "uv", "wheel", # test "nanobind<2.7.0", # https://github.com/wjakob/nanobind/commit/abd27e3b5565bc95f5091321f0f863fce8b5b95b From 1e7873a5718f8cf6aeaf707a62d7943ea1ff2cfd Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 13 Apr 2025 05:24:30 +0000 Subject: [PATCH 08/48] Update from copier (2025-04-13T05:24:30) --- .copier-answers.yml | 2 +- pyproject.toml | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.copier-answers.yml b/.copier-answers.yml index dab7480..2bc0d63 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,5 +1,5 @@ # Changes here will be overwritten by Copier -_commit: '6957226' +_commit: 98c8f14 _src_path: https://github.com/python-project-templates/base.git add_extension: python email: t.paine154@gmail.com diff --git a/pyproject.toml b/pyproject.toml index 9d37394..7e19df6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,7 +28,11 @@ classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", +<<<<<<< before updating "License :: OSI Approved :: Apache Software License", +======= + "Programming Language :: Python :: 3.13", +>>>>>>> after updating ] dependencies = [ From abf42d5ac229f972420151dcc8ad2af018e9f5fd Mon Sep 17 00:00:00 2001 From: Tim Paine <3105306+timkpaine@users.noreply.github.com> Date: Sun, 13 Apr 2025 13:38:43 -0400 Subject: [PATCH 09/48] Update pyproject.toml --- pyproject.toml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 7e19df6..8362341 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,11 +28,8 @@ classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", -<<<<<<< before updating - "License :: OSI Approved :: Apache Software License", -======= "Programming Language :: Python :: 3.13", ->>>>>>> after updating + "License :: OSI Approved :: Apache Software License", ] dependencies = [ From 978da6a692ec919cf62544b1b15c26d64c34acd3 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 20 Apr 2025 05:20:29 +0000 Subject: [PATCH 10/48] Update from copier (2025-04-20T05:20:29) --- .copier-answers.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.copier-answers.yml b/.copier-answers.yml index 2bc0d63..116c448 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,5 +1,5 @@ # Changes here will be overwritten by Copier -_commit: 98c8f14 +_commit: 122ea92 _src_path: https://github.com/python-project-templates/base.git add_extension: python email: t.paine154@gmail.com From 6e2ce7aede4d3f0e4f74f5c3ff2149125d78c1c8 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 27 Apr 2025 05:20:08 +0000 Subject: [PATCH 11/48] Update from copier (2025-04-27T05:20:08) --- .copier-answers.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.copier-answers.yml b/.copier-answers.yml index 116c448..45bf8ab 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,5 +1,5 @@ # Changes here will be overwritten by Copier -_commit: 122ea92 +_commit: 839686f _src_path: https://github.com/python-project-templates/base.git add_extension: python email: t.paine154@gmail.com From 644989e8282c4964770a498996a66cc7a41c8ee7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 1 May 2025 08:06:08 +0000 Subject: [PATCH 12/48] Update nanobind requirement from <2.7.0 to <2.8.0 Updates the requirements on [nanobind](https://github.com/wjakob/nanobind) to permit the latest version. - [Changelog](https://github.com/wjakob/nanobind/blob/master/docs/changelog.rst) - [Commits](https://github.com/wjakob/nanobind/compare/v0.0.1...v2.7.0) --- updated-dependencies: - dependency-name: nanobind dependency-version: 2.7.0 dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 8362341..f2cc332 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -47,7 +47,7 @@ develop = [ "uv", "wheel", # test - "nanobind<2.7.0", # https://github.com/wjakob/nanobind/commit/abd27e3b5565bc95f5091321f0f863fce8b5b95b + "nanobind<2.8.0", # https://github.com/wjakob/nanobind/commit/abd27e3b5565bc95f5091321f0f863fce8b5b95b "pybind11", "pytest", "pytest-cov", From 7227f567ebaf5cddb0a16221e12980870ab1975a Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 4 May 2025 05:20:35 +0000 Subject: [PATCH 13/48] Update from copier (2025-05-04T05:20:35) --- .copier-answers.yml | 2 +- pyproject.toml | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.copier-answers.yml b/.copier-answers.yml index 45bf8ab..98e7012 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,5 +1,5 @@ # Changes here will be overwritten by Copier -_commit: 839686f +_commit: c9dacb5 _src_path: https://github.com/python-project-templates/base.git add_extension: python email: t.paine154@gmail.com diff --git a/pyproject.toml b/pyproject.toml index f2cc332..1834fc9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -114,7 +114,6 @@ packages = ["hatch_cpp"] [tool.pytest.ini_options] addopts = ["-vvv", "--junitxml=junit.xml"] -asyncio_mode = "strict" testpaths = "hatch_cpp/tests" [tool.ruff] From 81b6d6dfb2d331d7d036ac751ba70ff179e5b798 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 9 May 2025 19:17:12 +0000 Subject: [PATCH 14/48] Update from copier (2025-05-09T19:17:12) --- .copier-answers.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.copier-answers.yml b/.copier-answers.yml index 98e7012..354c327 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,5 +1,5 @@ # Changes here will be overwritten by Copier -_commit: c9dacb5 +_commit: a669f79 _src_path: https://github.com/python-project-templates/base.git add_extension: python email: t.paine154@gmail.com From b563e17d5448415456d61d606c8903f538883cf7 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 11 May 2025 05:20:18 +0000 Subject: [PATCH 15/48] Update from copier (2025-05-11T05:20:18) --- .copier-answers.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.copier-answers.yml b/.copier-answers.yml index 354c327..0f8cdce 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,5 +1,5 @@ # Changes here will be overwritten by Copier -_commit: a669f79 +_commit: d56cb12 _src_path: https://github.com/python-project-templates/base.git add_extension: python email: t.paine154@gmail.com From d2908720b84bc7a84ea6d66b8e632910f2e4ea6f Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 17 Jun 2025 14:48:19 +0000 Subject: [PATCH 16/48] Update from copier (2025-06-17T14:48:19) --- .copier-answers.yml => .copier-answers.yaml | 2 +- .gitattributes | 7 +++++++ .github/{dependabot.yml => dependabot.yaml} | 8 -------- .github/workflows/{build.yml => build.yaml} | 16 +++------------- .github/workflows/{copier.yml => copier.yaml} | 0 LICENSE | 4 ++++ README.md | 2 +- pyproject.toml | 2 +- 8 files changed, 17 insertions(+), 24 deletions(-) rename .copier-answers.yml => .copier-answers.yaml (95%) rename .github/{dependabot.yml => dependabot.yaml} (66%) rename .github/workflows/{build.yml => build.yaml} (73%) rename .github/workflows/{copier.yml => copier.yaml} (100%) diff --git a/.copier-answers.yml b/.copier-answers.yaml similarity index 95% rename from .copier-answers.yml rename to .copier-answers.yaml index 0f8cdce..1ad91e7 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yaml @@ -1,5 +1,5 @@ # Changes here will be overwritten by Copier -_commit: d56cb12 +_commit: 5c63cb2 _src_path: https://github.com/python-project-templates/base.git add_extension: python email: t.paine154@gmail.com diff --git a/.gitattributes b/.gitattributes index 092719d..8e05465 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3,4 +3,11 @@ docs/* linguist-documentation *.ipynb linguist-documentation Makefile linguist-documentation +<<<<<<< before updating * text=auto eol=lf +======= +*.md text=auto eol=lf +*.py text=auto eol=lf +*.toml text=auto eol=lf +*.yaml text=auto eol=lf +>>>>>>> after updating diff --git a/.github/dependabot.yml b/.github/dependabot.yaml similarity index 66% rename from .github/dependabot.yml rename to .github/dependabot.yaml index 4d17b20..42cac77 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yaml @@ -14,11 +14,3 @@ updates: labels: - "lang: python" - "part: dependencies" - - - package-ecosystem: "npm" - directory: "/" - schedule: - interval: "monthly" - labels: - - "lang: javascript" - - "part: dependencies" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yaml similarity index 73% rename from .github/workflows/build.yml rename to .github/workflows/build.yaml index ef66d9b..109d0d0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yaml @@ -29,8 +29,8 @@ jobs: strategy: matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - python-version: ["3.9", "3.10", "3.11", "3.12"] + os: [ubuntu-latest] + python-version: ["3.11"] steps: - uses: actions/checkout@v4 @@ -53,15 +53,7 @@ jobs: - name: Test run: make coverage - if: matrix.os != 'windows-latest' - - - name: Test - run: | - call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" - make coverage - shell: cmd - if: matrix.os == 'windows-latest' - + - name: Upload test results (Python) uses: actions/upload-artifact@v4 with: @@ -73,7 +65,6 @@ jobs: uses: EnricoMi/publish-unit-test-result-action@v2 with: files: '**/junit.xml' - if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9' - name: Upload coverage uses: codecov/codecov-action@v5 @@ -87,4 +78,3 @@ jobs: with: name: dist-${{matrix.os}} path: dist - if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9' diff --git a/.github/workflows/copier.yml b/.github/workflows/copier.yaml similarity index 100% rename from .github/workflows/copier.yml rename to .github/workflows/copier.yaml diff --git a/LICENSE b/LICENSE index 261eeb9..95b5e23 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,11 @@ same "printed page" as the copyright notice for easier identification within third-party archives. +<<<<<<< before updating Copyright [yyyy] [name of copyright owner] +======= + Copyright 2025 the hatch-cpp authors +>>>>>>> after updating Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/README.md b/README.md index 1f26618..2d254b9 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Hatch plugin for C++ builds -[![Build Status](https://github.com/python-project-templates/hatch-cpp/actions/workflows/build.yml/badge.svg?branch=main&event=push)](https://github.com/python-project-templates/hatch-cpp/actions/workflows/build.yml) +[![Build Status](https://github.com/python-project-templates/hatch-cpp/actions/workflows/build.yaml/badge.svg?branch=main&event=push)](https://github.com/python-project-templates/hatch-cpp/actions/workflows/build.yaml) [![codecov](https://codecov.io/gh/python-project-templates/hatch-cpp/branch/main/graph/badge.svg)](https://codecov.io/gh/python-project-templates/hatch-cpp) [![License](https://img.shields.io/github/license/python-project-templates/hatch-cpp)](https://github.com/python-project-templates/hatch-cpp) [![PyPI](https://img.shields.io/pypi/v/hatch-cpp.svg)](https://pypi.python.org/pypi/hatch-cpp) diff --git a/pyproject.toml b/pyproject.toml index 1834fc9..f727b50 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -81,7 +81,7 @@ replace = 'version = "{new_version}"' [tool.check-manifest] ignore = [ - ".copier-answers.yml", + ".copier-answers.yaml", "Makefile", "docs/**/*", ] From 44887f9ce4debf21ecf06962f6620192f56b2cca Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 22 Jun 2025 05:16:36 +0000 Subject: [PATCH 17/48] Update from copier (2025-06-22T05:16:36) --- .copier-answers.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.copier-answers.yaml b/.copier-answers.yaml index 1ad91e7..a1647a5 100644 --- a/.copier-answers.yaml +++ b/.copier-answers.yaml @@ -1,5 +1,5 @@ # Changes here will be overwritten by Copier -_commit: 5c63cb2 +_commit: 42057e0 _src_path: https://github.com/python-project-templates/base.git add_extension: python email: t.paine154@gmail.com From 6bdcd2408792b9e0d2cbb4ef41afe7f9c1f81ecf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 1 Jul 2025 10:16:50 +0000 Subject: [PATCH 18/48] Update ruff requirement from <0.12,>=0.3 to >=0.3,<0.13 Updates the requirements on [ruff](https://github.com/astral-sh/ruff) to permit the latest version. - [Release notes](https://github.com/astral-sh/ruff/releases) - [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md) - [Commits](https://github.com/astral-sh/ruff/compare/v0.3.0...0.12.1) --- updated-dependencies: - dependency-name: ruff dependency-version: 0.12.1 dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index f727b50..5c89714 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,7 +42,7 @@ develop = [ "build", "bump-my-version", "check-manifest", - "ruff>=0.3,<0.12", + "ruff>=0.3,<0.13", "twine", "uv", "wheel", From 70ed77952f16b9f33d56a5a609177a487bd4b482 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 6 Jul 2025 05:16:55 +0000 Subject: [PATCH 19/48] Update from copier (2025-07-06T05:16:55) --- .copier-answers.yaml | 3 ++- .gitignore | 10 ++++++++++ pyproject.toml | 4 ++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/.copier-answers.yaml b/.copier-answers.yaml index a1647a5..639fae3 100644 --- a/.copier-answers.yaml +++ b/.copier-answers.yaml @@ -1,6 +1,7 @@ # Changes here will be overwritten by Copier -_commit: 42057e0 +_commit: 8c06bd5 _src_path: https://github.com/python-project-templates/base.git +add_docs: false add_extension: python email: t.paine154@gmail.com github: python-project-templates diff --git a/.gitignore b/.gitignore index 5e96e1e..5ca5462 100644 --- a/.gitignore +++ b/.gitignore @@ -115,6 +115,7 @@ ENV/ # Thumbnails ._* +<<<<<<< before updating # Files that might appear in the root of a volume .DocumentRevisions-V100 .fseventsd @@ -122,6 +123,15 @@ ENV/ .TemporaryItems .Trashes .VolumeIcon.icns +======= +# Documentation +/site +index.md +docs/_build/ +docs/src/_build/ +docs/api +docs/index.md +>>>>>>> after updating # Directories potentially created on remote AFP share .AppleDB diff --git a/pyproject.toml b/pyproject.toml index 5c89714..4a1a6e8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -129,4 +129,8 @@ known-first-party = ["hatch_cpp"] section-order = ["future", "standard-library", "third-party", "first-party", "local-folder"] [tool.ruff.lint.per-file-ignores] +<<<<<<< before updating "__init__.py" = ["F401", "F403"] +======= +"__init__.py" = ["F401", "F403"] +>>>>>>> after updating From a058a28e5fcf44f6fff3be0f0874b06fdecd3459 Mon Sep 17 00:00:00 2001 From: Tim Paine <3105306+timkpaine@users.noreply.github.com> Date: Sun, 6 Jul 2025 19:55:07 -0400 Subject: [PATCH 20/48] Update .gitignore --- .gitignore | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 5ca5462..999ba3f 100644 --- a/.gitignore +++ b/.gitignore @@ -115,7 +115,6 @@ ENV/ # Thumbnails ._* -<<<<<<< before updating # Files that might appear in the root of a volume .DocumentRevisions-V100 .fseventsd @@ -123,7 +122,7 @@ ENV/ .TemporaryItems .Trashes .VolumeIcon.icns -======= + # Documentation /site index.md @@ -131,7 +130,6 @@ docs/_build/ docs/src/_build/ docs/api docs/index.md ->>>>>>> after updating # Directories potentially created on remote AFP share .AppleDB From 377e3ccea4dd566ee1c351d2a29b1c404630e387 Mon Sep 17 00:00:00 2001 From: Tim Paine <3105306+timkpaine@users.noreply.github.com> Date: Sun, 6 Jul 2025 19:55:33 -0400 Subject: [PATCH 21/48] Update pyproject.toml --- pyproject.toml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 4a1a6e8..5c89714 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -129,8 +129,4 @@ known-first-party = ["hatch_cpp"] section-order = ["future", "standard-library", "third-party", "first-party", "local-folder"] [tool.ruff.lint.per-file-ignores] -<<<<<<< before updating "__init__.py" = ["F401", "F403"] -======= -"__init__.py" = ["F401", "F403"] ->>>>>>> after updating From b62cfa74d04807bf17e8314028f668f911dcf965 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 16 Jul 2025 01:52:37 +0000 Subject: [PATCH 22/48] Update from copier (2025-07-16T01:52:37) --- .copier-answers.yaml | 2 +- .gitignore | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/.copier-answers.yaml b/.copier-answers.yaml index 639fae3..1e3f9cc 100644 --- a/.copier-answers.yaml +++ b/.copier-answers.yaml @@ -1,5 +1,5 @@ # Changes here will be overwritten by Copier -_commit: 8c06bd5 +_commit: '1810209' _src_path: https://github.com/python-project-templates/base.git add_docs: false add_extension: python diff --git a/.gitignore b/.gitignore index 999ba3f..6f58fd8 100644 --- a/.gitignore +++ b/.gitignore @@ -130,13 +130,30 @@ docs/_build/ docs/src/_build/ docs/api docs/index.md +docs/html +docs/jupyter_execute +index.md + +# JS +js/coverage +js/dist +js/lib +js/node_modules +<<<<<<< before updating # Directories potentially created on remote AFP share .AppleDB .AppleDesktop Network Trash Folder Temporary Items .apdisk +======= +# Jupyter +.ipynb_checkpoints +.autoversion +hatch_cpp/nbextension +hatch_cpp/labextension +>>>>>>> after updating # Windows # ========================= @@ -169,6 +186,7 @@ $RECYCLE.BIN/ # ------------- **/coverage/ +<<<<<<< before updating # Notebook and lab extensions nbprint/extension/* @@ -176,3 +194,7 @@ nbprint/templates/nbprint/static/* nbprint/voila/static/* tmp.html examples/output/ +======= +# Rust +target +>>>>>>> after updating From c0ae30322fab28a596268e4fe5c12178cc4a9aef Mon Sep 17 00:00:00 2001 From: Tim Paine <3105306+timkpaine@users.noreply.github.com> Date: Tue, 15 Jul 2025 21:54:51 -0400 Subject: [PATCH 23/48] Update .gitignore --- .gitignore | 140 +++++++++++++++++++---------------------------------- 1 file changed, 49 insertions(+), 91 deletions(-) diff --git a/.gitignore b/.gitignore index 6f58fd8..c3df8f8 100644 --- a/.gitignore +++ b/.gitignore @@ -13,22 +13,24 @@ __pycache__/ # Distribution / packaging .Python -env/ build/ develop-eggs/ dist/ downloads/ eggs/ .eggs/ -include/ lib/ lib64/ parts/ sdist/ var/ +wheels/ +pip-wheel-metadata/ +share/python-wheels/ *.egg-info/ .installed.cfg *.egg +MANIFEST # PyInstaller # Usually these files are written by a python script from a template @@ -43,18 +45,17 @@ pip-delete-this-directory.txt # Unit test / coverage reports htmlcov/ .tox/ +.nox/ .coverage .coverage.* .cache -python_junit.xml -junit.xml nosetests.xml coverage.xml -*,cover +junit.xml +*.cover +*.py,cover .hypothesis/ -.pytest_cache -.ruff_cache -js/playwright-report +.pytest_cache/ # Translations *.mo @@ -63,65 +64,69 @@ js/playwright-report # Django stuff: *.log local_settings.py +db.sqlite3 +db.sqlite3-journal -# Flask instance folder +# Flask stuff: instance/ +.webassets-cache # Scrapy stuff: .scrapy -# Sphinx documentation -docs/_build/ -docs/source - # PyBuilder target/ -# IPython Notebook -.ipynb_checkpoints -*.ipynb -.autoversion +# IPython +profile_default/ +ipython_config.py # pyenv .python-version -# celery beat schedule file +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow +__pypackages__/ + +# Celery stuff celerybeat-schedule +celerybeat.pid -# dotenv -.env +# SageMath parsed files +*.sage.py -# virtualenv +# Environments +.env +.venv +env/ venv/ ENV/ +env.bak/ +venv.bak/ # Spyder project settings .spyderproject +.spyproject # Rope project settings .ropeproject -# ========================= -# Operating System Files -# ========================= - -# OSX -# ========================= - -.DS_Store -.AppleDouble -.LSOverride +# mkdocs documentation +/site -# Thumbnails -._* +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json -# Files that might appear in the root of a volume -.DocumentRevisions-V100 -.fseventsd -.Spotlight-V100 -.TemporaryItems -.Trashes -.VolumeIcon.icns +# Pyre type checker +.pyre/ # Documentation /site @@ -140,61 +145,14 @@ js/dist js/lib js/node_modules -<<<<<<< before updating -# Directories potentially created on remote AFP share -.AppleDB -.AppleDesktop -Network Trash Folder -Temporary Items -.apdisk -======= # Jupyter .ipynb_checkpoints .autoversion -hatch_cpp/nbextension -hatch_cpp/labextension ->>>>>>> after updating - -# Windows -# ========================= - -# Windows image file caches -Thumbs.db -ehthumbs.db - -# Folder config file -Desktop.ini - -# Recycle Bin used on file shares -$RECYCLE.BIN/ +python_template_js/nbextension +python_template_js/labextension -# Windows Installer files -*.cab -*.msi -*.msm -*.msp - -# Windows shortcuts -*.lnk - - -# NPM -# ---- -**/node_modules/ - -# Coverage data -# ------------- -**/coverage/ - -<<<<<<< before updating -# Notebook and lab extensions +# Mac +.DS_Store -nbprint/extension/* -nbprint/templates/nbprint/static/* -nbprint/voila/static/* -tmp.html -examples/output/ -======= # Rust target ->>>>>>> after updating From 2da311629e0ad8f67411c403757ee14a32633885 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 20 Jul 2025 05:22:29 +0000 Subject: [PATCH 24/48] Update from copier (2025-07-20T05:22:29) --- .copier-answers.yaml | 2 +- .gitignore | 8 +------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/.copier-answers.yaml b/.copier-answers.yaml index 1e3f9cc..caf069e 100644 --- a/.copier-answers.yaml +++ b/.copier-answers.yaml @@ -1,5 +1,5 @@ # Changes here will be overwritten by Copier -_commit: '1810209' +_commit: 9dfa165 _src_path: https://github.com/python-project-templates/base.git add_docs: false add_extension: python diff --git a/.gitignore b/.gitignore index c3df8f8..bb39499 100644 --- a/.gitignore +++ b/.gitignore @@ -33,8 +33,6 @@ share/python-wheels/ MANIFEST # PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest *.spec @@ -85,11 +83,7 @@ ipython_config.py .python-version # pipenv -# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. -# However, in case of collaboration, if having platform-specific dependencies or dependencies -# having no cross-platform support, pipenv may install dependencies that don't work, or not -# install all needed dependencies. -#Pipfile.lock +Pipfile.lock # PEP 582; used by e.g. github.com/David-OConnor/pyflow __pypackages__/ From 3de625ec6c7ea521b25a13079cd07b9824b345e7 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 20 Jul 2025 21:34:32 +0000 Subject: [PATCH 25/48] Update from copier (2025-07-20T21:34:32) --- .copier-answers.yaml | 2 +- .gitignore | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.copier-answers.yaml b/.copier-answers.yaml index caf069e..484daee 100644 --- a/.copier-answers.yaml +++ b/.copier-answers.yaml @@ -1,5 +1,5 @@ # Changes here will be overwritten by Copier -_commit: 9dfa165 +_commit: c53b04c _src_path: https://github.com/python-project-templates/base.git add_docs: false add_extension: python diff --git a/.gitignore b/.gitignore index bb39499..07dcf45 100644 --- a/.gitignore +++ b/.gitignore @@ -138,6 +138,7 @@ js/coverage js/dist js/lib js/node_modules +js/*.tgz # Jupyter .ipynb_checkpoints From 3cd247fd6227c73342d06049781d9495bc132e32 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 1 Aug 2025 07:43:07 +0000 Subject: [PATCH 26/48] Update nanobind requirement from <2.8.0 to <2.9.0 Updates the requirements on [nanobind](https://github.com/wjakob/nanobind) to permit the latest version. - [Changelog](https://github.com/wjakob/nanobind/blob/master/docs/changelog.rst) - [Commits](https://github.com/wjakob/nanobind/compare/v0.0.1...v2.8.0) --- updated-dependencies: - dependency-name: nanobind dependency-version: 2.8.0 dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 5c89714..9ab0077 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -47,7 +47,7 @@ develop = [ "uv", "wheel", # test - "nanobind<2.8.0", # https://github.com/wjakob/nanobind/commit/abd27e3b5565bc95f5091321f0f863fce8b5b95b + "nanobind<2.9.0", # https://github.com/wjakob/nanobind/commit/abd27e3b5565bc95f5091321f0f863fce8b5b95b "pybind11", "pytest", "pytest-cov", From bf8e09f7dc2f090cd06c45e2dd19a68cd572143a Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 1 Aug 2025 14:06:14 +0000 Subject: [PATCH 27/48] Update from copier (2025-08-01T14:06:14) Signed-off-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- .copier-answers.yaml | 3 ++- Makefile | 24 ++++++++++++++++++------ README.md | 3 +++ pyproject.toml | 15 +++++++++++++++ 4 files changed, 38 insertions(+), 7 deletions(-) diff --git a/.copier-answers.yaml b/.copier-answers.yaml index 484daee..a0943a5 100644 --- a/.copier-answers.yaml +++ b/.copier-answers.yaml @@ -1,8 +1,9 @@ # Changes here will be overwritten by Copier -_commit: c53b04c +_commit: 9642da9 _src_path: https://github.com/python-project-templates/base.git add_docs: false add_extension: python +add_wiki: false email: t.paine154@gmail.com github: python-project-templates project_description: Hatch plugin for C++ builds diff --git a/Makefile b/Makefile index adac7f6..db9ea46 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,11 @@ develop: ## install dependencies and build library uv pip install -e .[develop] +requirements: ## install prerequisite python build requirements + python -m pip install --upgrade pip toml + python -m pip install `python -c 'import toml; c = toml.load("pyproject.toml"); print("\n".join(c["build-system"]["requires"]))'` + python -m pip install `python -c 'import toml; c = toml.load("pyproject.toml"); print(" ".join(c["project"]["optional-dependencies"]["develop"]))'` + build: ## build the python library python -m build -n @@ -15,20 +20,27 @@ install: ## install library ######### # LINTS # ######### -.PHONY: lint lints fix format +.PHONY: lint-py lint-docs fix-py fix-docs lint lints fix format -lint: ## run python linter with ruff +lint-py: ## lint python with ruff python -m ruff check hatch_cpp python -m ruff format --check hatch_cpp -# Alias -lints: lint +lint-docs: ## lint docs with mdformat and codespell + python -m mdformat --check README.md + python -m codespell_lib README.md -fix: ## fix python formatting with ruff +fix-py: ## autoformat python code with ruff python -m ruff check --fix hatch_cpp python -m ruff format hatch_cpp -# alias +fix-docs: ## autoformat docs with mdformat and codespell + python -m mdformat README.md + python -m codespell_lib --write README.md + +lint: lint-py lint-docs ## run all linters +lints: lint +fix: fix-py fix-docs ## run all autoformatters format: fix ################ diff --git a/README.md b/README.md index 2d254b9..4b25dd8 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ Hatch plugin for C++ builds ## Overview +<<<<<<< before updating A simple, extensible C++ build plugin for [hatch](https://hatch.pypa.io/latest/). ```toml @@ -31,5 +32,7 @@ For more complete systems, see: |`HATCH_CPP_PLATFORM`| | | |`HATCH_CPP_DISABLE_CCACHE`| | | +======= +>>>>>>> after updating > [!NOTE] > This library was generated using [copier](https://copier.readthedocs.io/en/stable/) from the [Base Python Project Template repository](https://github.com/python-project-templates/base). diff --git a/pyproject.toml b/pyproject.toml index 5c89714..2f296bc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,7 +42,17 @@ develop = [ "build", "bump-my-version", "check-manifest", +<<<<<<< before updating "ruff>=0.3,<0.13", +======= + "codespell>=2.4,<2.5", + "hatchling", + "mdformat>=0.7.22,<0.8", + "mdformat-tables>=1", + "pytest", + "pytest-cov", + "ruff", +>>>>>>> after updating "twine", "uv", "wheel", @@ -67,7 +77,12 @@ Homepage = "https://github.com/python-project-templates/hatch-cpp" [tool.bumpversion] current_version = "0.1.7" commit = true +<<<<<<< before updating tag = false +======= +tag = true +commit_args = "-s" +>>>>>>> after updating [[tool.bumpversion.files]] filename = "hatch_cpp/__init__.py" From 7dc8e0dd33f082293acfb62d3291f711ddcfd0d3 Mon Sep 17 00:00:00 2001 From: Tim Paine <3105306+timkpaine@users.noreply.github.com> Date: Fri, 1 Aug 2025 11:37:09 -0400 Subject: [PATCH 28/48] Update README.md --- README.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/README.md b/README.md index 4b25dd8..2d254b9 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,6 @@ Hatch plugin for C++ builds ## Overview -<<<<<<< before updating A simple, extensible C++ build plugin for [hatch](https://hatch.pypa.io/latest/). ```toml @@ -32,7 +31,5 @@ For more complete systems, see: |`HATCH_CPP_PLATFORM`| | | |`HATCH_CPP_DISABLE_CCACHE`| | | -======= ->>>>>>> after updating > [!NOTE] > This library was generated using [copier](https://copier.readthedocs.io/en/stable/) from the [Base Python Project Template repository](https://github.com/python-project-templates/base). From c09cbbfeac78ef1be3c410bc5b9d7d857cae87c5 Mon Sep 17 00:00:00 2001 From: Tim Paine <3105306+timkpaine@users.noreply.github.com> Date: Fri, 1 Aug 2025 11:37:25 -0400 Subject: [PATCH 29/48] Update pyproject.toml --- pyproject.toml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 2f296bc..c494e3b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,9 +42,6 @@ develop = [ "build", "bump-my-version", "check-manifest", -<<<<<<< before updating - "ruff>=0.3,<0.13", -======= "codespell>=2.4,<2.5", "hatchling", "mdformat>=0.7.22,<0.8", @@ -52,7 +49,6 @@ develop = [ "pytest", "pytest-cov", "ruff", ->>>>>>> after updating "twine", "uv", "wheel", @@ -77,12 +73,8 @@ Homepage = "https://github.com/python-project-templates/hatch-cpp" [tool.bumpversion] current_version = "0.1.7" commit = true -<<<<<<< before updating tag = false -======= -tag = true commit_args = "-s" ->>>>>>> after updating [[tool.bumpversion.files]] filename = "hatch_cpp/__init__.py" From f95574509a7adae51e42033166a5c256c042bddb Mon Sep 17 00:00:00 2001 From: Tim Paine <3105306+timkpaine@users.noreply.github.com> Date: Fri, 1 Aug 2025 11:39:06 -0400 Subject: [PATCH 30/48] fix lint --- README.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 2d254b9..a468e43 100644 --- a/README.md +++ b/README.md @@ -19,17 +19,19 @@ libraries = [ ``` For more complete systems, see: + - [scikit-build-core](https://github.com/scikit-build/scikit-build-core) - [setuptools](https://setuptools.pypa.io/en/latest/userguide/ext_modules.html) ## Environment Variables -| Name | Default | Description | -|:-----|:--------|:------------| -|`CC`| | | -|`CXX`| | | -|`LD`| | | -|`HATCH_CPP_PLATFORM`| | | -|`HATCH_CPP_DISABLE_CCACHE`| | | + +| Name | Default | Description | +| :------------------------- | :------ | :---------- | +| `CC` | | | +| `CXX` | | | +| `LD` | | | +| `HATCH_CPP_PLATFORM` | | | +| `HATCH_CPP_DISABLE_CCACHE` | | | > [!NOTE] > This library was generated using [copier](https://copier.readthedocs.io/en/stable/) from the [Base Python Project Template repository](https://github.com/python-project-templates/base). From e1d754cc82edeecb4e86b81d588cda42ad4b1d41 Mon Sep 17 00:00:00 2001 From: Tim Paine <3105306+timkpaine@users.noreply.github.com> Date: Sat, 2 Aug 2025 10:12:34 -0400 Subject: [PATCH 31/48] Update readme docs --- README.md | 77 ++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 68 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index a468e43..30459a6 100644 --- a/README.md +++ b/README.md @@ -23,15 +23,74 @@ For more complete systems, see: - [scikit-build-core](https://github.com/scikit-build/scikit-build-core) - [setuptools](https://setuptools.pypa.io/en/latest/userguide/ext_modules.html) -## Environment Variables - -| Name | Default | Description | -| :------------------------- | :------ | :---------- | -| `CC` | | | -| `CXX` | | | -| `LD` | | | -| `HATCH_CPP_PLATFORM` | | | -| `HATCH_CPP_DISABLE_CCACHE` | | | +## Configuration + +Configuration is driven from the `[tool.hatch.build.hooks.hatch-cpp]` hatch hook configuration field in a `pyproject.toml`. +It is designed to closely match existing Python/C/C++ packaging tools. + +```toml +verbose = true +libraries = { Library Args } +cmake = { CMake Args } +platform = { Platform, either "linux", "darwin", or "win32" } +``` + +See the [test cases](./hatch_cpp/tests/) for more concrete examples. + +### Library Arguments + +```toml +name = "mylib" +sources = [ + "path/to/file.cpp", +] +language = "c++" + +binding = "cpython" # or "pybind11", "nanobind", "generic" +std = "" # Passed to -std= or /std: + +include_dirs = ["paths/to/add/to/-I"] +library_dirs = ["paths/to/add/to/-L"] +libraries = ["-llibraries_to_link"] + +extra_compile_args = ["--extra-compile-args"] +extra_link_args = ["--extra-link-args"] +extra_objects = ["extra_objects"] + +define_macros = ["-Ddefines_to_use"] +undef_macros = ["-Uundefines_to_use"] + +py_limited_api = "cp39" # limited API to use +``` + +### CMake Arguments + +`hatch-cpp` has some convenience integration with CMake. +Though this is not designed to be as full-featured as e.g. `scikit-build`, it should be satisfactory for many small projects. + +```toml +root = "path/to/cmake/root" +build = "path/to/cmake/build/folder" +install = "path/to/cmake/install/folder" + +cmake_arg_prefix = "MYPROJECT_" +cmake_args = {} # any other cmake args to pass +cmake_env_args = {} # env-specific cmake args to pass + +include_flags = {} # include flags to pass -D +``` + +### Environment Variables + +`hatch-cpp` will respect standard environment variables for compiler control. + +| Name | Default | Description | +| :------------------------- | :------ | :-------------------- | +| `CC` | | C Compiler override | +| `CXX` | | C++ Compiler override | +| `LD` | | Linker override | +| `HATCH_CPP_PLATFORM` | | Platform to build | +| `HATCH_CPP_DISABLE_CCACHE` | | Disable CCache usage | > [!NOTE] > This library was generated using [copier](https://copier.readthedocs.io/en/stable/) from the [Base Python Project Template repository](https://github.com/python-project-templates/base). From 2d3ea7c7cda7a088c51db4dd52c87a1055a198ab Mon Sep 17 00:00:00 2001 From: Tim Paine <3105306+timkpaine@users.noreply.github.com> Date: Sat, 2 Aug 2025 10:17:39 -0400 Subject: [PATCH 32/48] Add more configuration information to readme --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 30459a6..31715dd 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,9 @@ platform = { Platform, either "linux", "darwin", or "win32" } See the [test cases](./hatch_cpp/tests/) for more concrete examples. +`hatch-cpp` is driven by [pydantic](https://docs.pydantic.dev/latest/) models for configuration and execution of the build. +These models can themselves be overridden by setting `build-config-class` / `build-plan-class`. + ### Library Arguments ```toml From da87f3cbf71c9bde527ab959c3ee850e132f7038 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 3 Aug 2025 05:24:31 +0000 Subject: [PATCH 33/48] Update from copier (2025-08-03T05:24:31) Signed-off-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- .copier-answers.yaml | 2 +- .gitignore | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.copier-answers.yaml b/.copier-answers.yaml index a0943a5..22ce1db 100644 --- a/.copier-answers.yaml +++ b/.copier-answers.yaml @@ -1,5 +1,5 @@ # Changes here will be overwritten by Copier -_commit: 9642da9 +_commit: 2d0c192 _src_path: https://github.com/python-project-templates/base.git add_docs: false add_extension: python diff --git a/.gitignore b/.gitignore index 07dcf45..af40666 100644 --- a/.gitignore +++ b/.gitignore @@ -139,12 +139,20 @@ js/dist js/lib js/node_modules js/*.tgz +hatch_cpp/extension # Jupyter .ipynb_checkpoints .autoversion +<<<<<<< before updating python_template_js/nbextension python_template_js/labextension +======= +!hatch_cpp/extension/hatch_cpp.json +!hatch_cpp/extension/install.json +hatch_cpp/nbextension +hatch_cpp/labextension +>>>>>>> after updating # Mac .DS_Store From bdb82ca1af528b3524756709063a8c7931fd66eb Mon Sep 17 00:00:00 2001 From: Tim Paine <3105306+timkpaine@users.noreply.github.com> Date: Sun, 3 Aug 2025 13:38:07 -0400 Subject: [PATCH 34/48] Update .gitignore --- .gitignore | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.gitignore b/.gitignore index af40666..2930342 100644 --- a/.gitignore +++ b/.gitignore @@ -144,15 +144,10 @@ hatch_cpp/extension # Jupyter .ipynb_checkpoints .autoversion -<<<<<<< before updating -python_template_js/nbextension -python_template_js/labextension -======= !hatch_cpp/extension/hatch_cpp.json !hatch_cpp/extension/install.json hatch_cpp/nbextension hatch_cpp/labextension ->>>>>>> after updating # Mac .DS_Store From d53f04e6d6e35221280edc6019ce442f4240c20b Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 10 Aug 2025 05:20:47 +0000 Subject: [PATCH 35/48] Update from copier (2025-08-10T05:20:47) Signed-off-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- .copier-answers.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.copier-answers.yaml b/.copier-answers.yaml index 22ce1db..a3b951e 100644 --- a/.copier-answers.yaml +++ b/.copier-answers.yaml @@ -1,5 +1,5 @@ # Changes here will be overwritten by Copier -_commit: 2d0c192 +_commit: f3ffa74 _src_path: https://github.com/python-project-templates/base.git add_docs: false add_extension: python From d8a511447ab05f7343552a62f609f05bc509a69a Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 11 Aug 2025 17:43:35 +0000 Subject: [PATCH 36/48] Update from copier (2025-08-11T17:43:35) Signed-off-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- .copier-answers.yaml | 2 +- .github/workflows/build.yaml | 2 +- .gitignore | 2 ++ Makefile | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.copier-answers.yaml b/.copier-answers.yaml index a3b951e..1b40ead 100644 --- a/.copier-answers.yaml +++ b/.copier-answers.yaml @@ -1,5 +1,5 @@ # Changes here will be overwritten by Copier -_commit: f3ffa74 +_commit: fa27c8d _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 109d0d0..53bb463 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -33,7 +33,7 @@ jobs: python-version: ["3.11"] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: actions-ext/python/setup@main with: diff --git a/.gitignore b/.gitignore index 2930342..79684bb 100644 --- a/.gitignore +++ b/.gitignore @@ -138,6 +138,8 @@ js/coverage js/dist js/lib js/node_modules +js/test-results +js/playwright-report js/*.tgz hatch_cpp/extension diff --git a/Makefile b/Makefile index db9ea46..e55cbef 100644 --- a/Makefile +++ b/Makefile @@ -100,7 +100,7 @@ dist-check: ## run python dist checker with twine dist: clean dist-build dist-check ## build all dists -publish: dist # publish python assets +publish: dist ## publish python assets ######### # CLEAN # From 0a8fadf0b0794e5091bc4899588ba7ec204c732b Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 17 Aug 2025 05:16:55 +0000 Subject: [PATCH 37/48] Update from copier (2025-08-17T05:16:55) Signed-off-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- .copier-answers.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.copier-answers.yaml b/.copier-answers.yaml index 1b40ead..c851765 100644 --- a/.copier-answers.yaml +++ b/.copier-answers.yaml @@ -1,5 +1,5 @@ # Changes here will be overwritten by Copier -_commit: fa27c8d +_commit: 3a223c6 _src_path: https://github.com/python-project-templates/base.git add_docs: false add_extension: python From 3ff38e99af1cdb34cd8dad6731c84e08120613c8 Mon Sep 17 00:00:00 2001 From: Tim Paine <3105306+timkpaine@users.noreply.github.com> Date: Sat, 23 Aug 2025 17:02:54 -0400 Subject: [PATCH 38/48] Build across 3.12, 3.13 --- .github/workflows/build.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 53bb463..89154d4 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -30,7 +30,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: ["3.11"] + python-version: ["3.11", "3.12", "3.13"] steps: - uses: actions/checkout@v5 @@ -59,7 +59,6 @@ jobs: with: name: test-results-${{ matrix.os }}-${{ matrix.python-version }} path: junit.xml - if: ${{ always() }} - name: Publish Unit Test Results uses: EnricoMi/publish-unit-test-result-action@v2 @@ -78,3 +77,4 @@ jobs: with: name: dist-${{matrix.os}} path: dist + if: ${{ matrix.python-version == '3.11' }} From 862862468281d9491649f9e3099173c8e84b9c22 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 23 Aug 2025 21:32:36 +0000 Subject: [PATCH 39/48] Update from copier (2025-08-23T21:32:36) Signed-off-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- .copier-answers.yaml | 2 +- pyproject.toml | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.copier-answers.yaml b/.copier-answers.yaml index c851765..62773b6 100644 --- a/.copier-answers.yaml +++ b/.copier-answers.yaml @@ -1,5 +1,5 @@ # Changes here will be overwritten by Copier -_commit: 3a223c6 +_commit: c124449 _src_path: https://github.com/python-project-templates/base.git add_docs: false add_extension: python diff --git a/pyproject.toml b/pyproject.toml index 77f8736..884d5e7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,7 +29,11 @@ classifiers = [ "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", +<<<<<<< before updating "License :: OSI Approved :: Apache Software License", +======= + "Programming Language :: Python :: 3.14", +>>>>>>> after updating ] dependencies = [ From ada5051cec743c5fe6f27fb6ce53489afd41b4a6 Mon Sep 17 00:00:00 2001 From: Tim Paine <3105306+timkpaine@users.noreply.github.com> Date: Sat, 23 Aug 2025 17:37:04 -0400 Subject: [PATCH 40/48] Update pyproject.toml --- pyproject.toml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 884d5e7..ee5e24d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,6 +20,7 @@ keywords = [ ] classifiers = [ "Development Status :: 3 - Alpha", + "License :: OSI Approved :: Apache Software License", "Programming Language :: Python", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", @@ -29,11 +30,7 @@ classifiers = [ "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", -<<<<<<< before updating - "License :: OSI Approved :: Apache Software License", -======= "Programming Language :: Python :: 3.14", ->>>>>>> after updating ] dependencies = [ From 9c88636440680cf260235324418a44bff2fa5ab1 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 14 Sep 2025 05:14:17 +0000 Subject: [PATCH 41/48] Update from copier (2025-09-14T05:14:17) Signed-off-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- .copier-answers.yaml | 2 +- .gitignore | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.copier-answers.yaml b/.copier-answers.yaml index 62773b6..fe02719 100644 --- a/.copier-answers.yaml +++ b/.copier-answers.yaml @@ -1,5 +1,5 @@ # Changes here will be overwritten by Copier -_commit: c124449 +_commit: a74894d _src_path: https://github.com/python-project-templates/base.git add_docs: false add_extension: python diff --git a/.gitignore b/.gitignore index 79684bb..ed2e334 100644 --- a/.gitignore +++ b/.gitignore @@ -146,6 +146,7 @@ hatch_cpp/extension # Jupyter .ipynb_checkpoints .autoversion +Untitled*.ipynb !hatch_cpp/extension/hatch_cpp.json !hatch_cpp/extension/install.json hatch_cpp/nbextension From 47709d677d0d1531995a5c2a44665ea47d6b8aed Mon Sep 17 00:00:00 2001 From: Tim Paine <3105306+timkpaine@users.noreply.github.com> Date: Sun, 14 Sep 2025 19:49:55 -0400 Subject: [PATCH 42/48] Update pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index ee5e24d..ee94b96 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -106,7 +106,7 @@ exclude_also = [ "@(abc\\.)?abstractmethod", ] ignore_errors = true -fail_under = 70 +fail_under = 50 [tool.hatch.build] artifacts = [] From c5596803058b1bc304e943d863adadaba84095b9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 1 Oct 2025 07:14:04 +0000 Subject: [PATCH 43/48] Update nanobind requirement from <2.9.0 to <2.10.0 Updates the requirements on [nanobind](https://github.com/wjakob/nanobind) to permit the latest version. - [Changelog](https://github.com/wjakob/nanobind/blob/master/docs/changelog.rst) - [Commits](https://github.com/wjakob/nanobind/compare/v0.0.1...v2.9.2) --- updated-dependencies: - dependency-name: nanobind dependency-version: 2.9.2 dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index ee94b96..6025877 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -54,7 +54,7 @@ develop = [ "uv", "wheel", # test - "nanobind<2.9.0", # https://github.com/wjakob/nanobind/commit/abd27e3b5565bc95f5091321f0f863fce8b5b95b + "nanobind<2.10.0", # https://github.com/wjakob/nanobind/commit/abd27e3b5565bc95f5091321f0f863fce8b5b95b "pybind11", "pytest", "pytest-cov", From 221dd367ec2a706afc61aae784f7de37734abeda Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 5 Oct 2025 05:14:28 +0000 Subject: [PATCH 44/48] Update from copier (2025-10-05T05:14:28) Signed-off-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- .copier-answers.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.copier-answers.yaml b/.copier-answers.yaml index fe02719..8759098 100644 --- a/.copier-answers.yaml +++ b/.copier-answers.yaml @@ -1,5 +1,5 @@ # Changes here will be overwritten by Copier -_commit: a74894d +_commit: 74b8054 _src_path: https://github.com/python-project-templates/base.git add_docs: false add_extension: python From 866cdb5a69dda42b1e8a21e52c2e47615ebff3c0 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 12 Oct 2025 05:14:27 +0000 Subject: [PATCH 45/48] Update from copier (2025-10-12T05:14:27) Signed-off-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- .copier-answers.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.copier-answers.yaml b/.copier-answers.yaml index 8759098..e789630 100644 --- a/.copier-answers.yaml +++ b/.copier-answers.yaml @@ -1,5 +1,5 @@ # Changes here will be overwritten by Copier -_commit: 74b8054 +_commit: f812aaa _src_path: https://github.com/python-project-templates/base.git add_docs: false add_extension: python From d318bf0c176ef2c531f17a2f491b652924ff4402 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 27 Oct 2025 07:51:55 +0000 Subject: [PATCH 46/48] Bump actions/upload-artifact from 4 to 5 Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4 to 5. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/v4...v5) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-version: '5' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/build.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 89154d4..6c3e975 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -55,7 +55,7 @@ jobs: run: make coverage - name: Upload test results (Python) - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v5 with: name: test-results-${{ matrix.os }}-${{ matrix.python-version }} path: junit.xml @@ -73,7 +73,7 @@ jobs: - name: Make dist run: make dist - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@v5 with: name: dist-${{matrix.os}} path: dist From a2a96423f4c605613aad40dde7465d5fc85b81d6 Mon Sep 17 00:00:00 2001 From: Tim Paine <3105306+timkpaine@users.noreply.github.com> Date: Tue, 28 Oct 2025 16:51:15 -0400 Subject: [PATCH 47/48] Allow for toolchain tweaks in pyproject.toml --- hatch_cpp/structs.py | 39 ++++++++++++++++--- .../project/include/project/basic.hpp | 17 ++++++++ .../cpp/project/basic.cpp | 5 +++ .../cpp/project/basic.hpp | 17 ++++++++ .../project/__init__.py | 0 .../pyproject.toml | 38 ++++++++++++++++++ hatch_cpp/tests/test_projects.py | 5 ++- hatch_cpp/tests/test_structs.py | 8 ++++ pyproject.toml | 1 + 9 files changed, 123 insertions(+), 7 deletions(-) create mode 100644 hatch_cpp/tests/test_project_cmake/project/include/project/basic.hpp create mode 100644 hatch_cpp/tests/test_project_override_toolchain/cpp/project/basic.cpp create mode 100644 hatch_cpp/tests/test_project_override_toolchain/cpp/project/basic.hpp create mode 100644 hatch_cpp/tests/test_project_override_toolchain/project/__init__.py create mode 100644 hatch_cpp/tests/test_project_override_toolchain/pyproject.toml diff --git a/hatch_cpp/structs.py b/hatch_cpp/structs.py index 75df2d8..5884988 100644 --- a/hatch_cpp/structs.py +++ b/hatch_cpp/structs.py @@ -102,8 +102,15 @@ def default() -> HatchCppPlatform: toolchain = "clang" elif "cl" in CC and "cl" in CXX: toolchain = "msvc" + # Fallback to platform defaults + elif platform == "linux": + toolchain = "gcc" + elif platform == "darwin": + toolchain = "clang" + elif platform == "win32": + toolchain = "msvc" else: - raise Exception(f"Unrecognized toolchain: {CC}, {CXX}") + toolchain = "gcc" # Customizations if which("ccache") and not environ.get("HATCH_CPP_DISABLE_CCACHE"): @@ -117,6 +124,12 @@ def default() -> HatchCppPlatform: # LD = which("ld.lld") return HatchCppPlatform(cc=CC, cxx=CXX, ld=LD, platform=platform, toolchain=toolchain) + @staticmethod + def platform_for_toolchain(toolchain: CompilerToolchain) -> HatchCppPlatform: + platform = HatchCppPlatform.default() + platform.toolchain = toolchain + return platform + def get_compile_flags(self, library: HatchCppLibrary, build_type: BuildType = "release") -> str: flags = "" @@ -241,11 +254,27 @@ class HatchCppBuildConfig(BaseModel): cmake: Optional[HatchCppCmakeConfiguration] = Field(default=None) platform: Optional[HatchCppPlatform] = Field(default_factory=HatchCppPlatform.default) - @model_validator(mode="after") - def check_toolchain_matches_args(self): - if self.cmake and self.libraries: + @model_validator(mode="wrap") + @classmethod + def validate_model(cls, data, handler): + if "toolchain" in data: + data["platform"] = HatchCppPlatform.platform_for_toolchain(data["toolchain"]) + data.pop("toolchain") + elif "platform" not in data: + data["platform"] = HatchCppPlatform.default() + if "cc" in data: + data["platform"].cc = data["cc"] + data.pop("cc") + if "cxx" in data: + data["platform"].cxx = data["cxx"] + data.pop("cxx") + if "ld" in data: + data["platform"].ld = data["ld"] + data.pop("ld") + model = handler(data) + if model.cmake and model.libraries: raise ValueError("Must not provide libraries when using cmake toolchain.") - return self + return model class HatchCppBuildPlan(HatchCppBuildConfig): diff --git a/hatch_cpp/tests/test_project_cmake/project/include/project/basic.hpp b/hatch_cpp/tests/test_project_cmake/project/include/project/basic.hpp new file mode 100644 index 0000000..65cb62e --- /dev/null +++ b/hatch_cpp/tests/test_project_cmake/project/include/project/basic.hpp @@ -0,0 +1,17 @@ +#pragma once +#include "Python.h" + +PyObject* hello(PyObject*, PyObject*); + +static PyMethodDef extension_methods[] = { + {"hello", (PyCFunction)hello, METH_NOARGS}, + {nullptr, nullptr, 0, nullptr} +}; + +static PyModuleDef extension_module = { + PyModuleDef_HEAD_INIT, "extension", "extension", -1, extension_methods}; + +PyMODINIT_FUNC PyInit_extension(void) { + Py_Initialize(); + return PyModule_Create(&extension_module); +} diff --git a/hatch_cpp/tests/test_project_override_toolchain/cpp/project/basic.cpp b/hatch_cpp/tests/test_project_override_toolchain/cpp/project/basic.cpp new file mode 100644 index 0000000..db4432a --- /dev/null +++ b/hatch_cpp/tests/test_project_override_toolchain/cpp/project/basic.cpp @@ -0,0 +1,5 @@ +#include "project/basic.hpp" + +PyObject* hello(PyObject*, PyObject*) { + return PyUnicode_FromString("A string"); +} diff --git a/hatch_cpp/tests/test_project_override_toolchain/cpp/project/basic.hpp b/hatch_cpp/tests/test_project_override_toolchain/cpp/project/basic.hpp new file mode 100644 index 0000000..65cb62e --- /dev/null +++ b/hatch_cpp/tests/test_project_override_toolchain/cpp/project/basic.hpp @@ -0,0 +1,17 @@ +#pragma once +#include "Python.h" + +PyObject* hello(PyObject*, PyObject*); + +static PyMethodDef extension_methods[] = { + {"hello", (PyCFunction)hello, METH_NOARGS}, + {nullptr, nullptr, 0, nullptr} +}; + +static PyModuleDef extension_module = { + PyModuleDef_HEAD_INIT, "extension", "extension", -1, extension_methods}; + +PyMODINIT_FUNC PyInit_extension(void) { + Py_Initialize(); + return PyModule_Create(&extension_module); +} diff --git a/hatch_cpp/tests/test_project_override_toolchain/project/__init__.py b/hatch_cpp/tests/test_project_override_toolchain/project/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/hatch_cpp/tests/test_project_override_toolchain/pyproject.toml b/hatch_cpp/tests/test_project_override_toolchain/pyproject.toml new file mode 100644 index 0000000..b5c40ca --- /dev/null +++ b/hatch_cpp/tests/test_project_override_toolchain/pyproject.toml @@ -0,0 +1,38 @@ +[build-system] +requires = ["hatchling>=1.20"] +build-backend = "hatchling.build" + +[project] +name = "hatch-cpp-test-project-toolchain" +description = "Toolchain override test project for hatch-cpp" +version = "0.1.0" +requires-python = ">=3.9" +dependencies = [ + "hatchling>=1.20", + "hatch-cpp", +] + +[tool.hatch.build] +artifacts = [ + "project/*.dll", + "project/*.dylib", + "project/*.so", +] + +[tool.hatch.build.sources] +src = "/" + +[tool.hatch.build.targets.sdist] +packages = ["project"] + +[tool.hatch.build.targets.wheel] +packages = ["project"] + +[tool.hatch.build.hooks.hatch-cpp] +verbose = true +libraries = [ + {name = "project/extension", sources = ["cpp/project/basic.cpp"], include-dirs = ["cpp"]} +] +toolchain = "gcc" +cc = "clang" +cxx = "clang++" diff --git a/hatch_cpp/tests/test_projects.py b/hatch_cpp/tests/test_projects.py index 7553c04..dd4c6fc 100644 --- a/hatch_cpp/tests/test_projects.py +++ b/hatch_cpp/tests/test_projects.py @@ -13,6 +13,8 @@ class TestProject: [ "test_project_basic", "test_project_override_classes", + "test_project_override_classes", + "test_project_override_toolchain", "test_project_pybind", "test_project_nanobind", "test_project_limited_api", @@ -29,8 +31,7 @@ def test_basic(self, project): # compile check_call( [ - "hatchling", - "build", + "hatch-build", "--hooks-only", ], cwd=f"hatch_cpp/tests/{project}", diff --git a/hatch_cpp/tests/test_structs.py b/hatch_cpp/tests/test_structs.py index fc36d9a..263b917 100644 --- a/hatch_cpp/tests/test_structs.py +++ b/hatch_cpp/tests/test_structs.py @@ -46,3 +46,11 @@ def test_cmake_args(self): assert f"-DHATCH_CPP_TEST_PROJECT_BASIC_PYTHON_VERSION=3.{version_info.minor}" in hatch_build_plan.commands[0] if hatch_build_plan.platform.platform == "darwin": assert "-DCMAKE_OSX_DEPLOYMENT_TARGET=11" in hatch_build_plan.commands[0] + + def test_platform_toolchain_override(self): + txt = (Path(__file__).parent / "test_project_override_toolchain" / "pyproject.toml").read_text() + toml = loads(txt) + hatch_build_config = HatchCppBuildConfig(name=toml["project"]["name"], **toml["tool"]["hatch"]["build"]["hooks"]["hatch-cpp"]) + assert "clang" in hatch_build_config.platform.cc + assert "clang++" in hatch_build_config.platform.cxx + assert hatch_build_config.platform.toolchain == "gcc" diff --git a/pyproject.toml b/pyproject.toml index 6025877..e3b1ee4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,6 +45,7 @@ develop = [ "check-manifest", "codespell>=2.4,<2.5", "hatchling", + "hatch-build", "mdformat>=0.7.22,<0.8", "mdformat-tables>=1", "pytest", From bb2190129a15b0aa1f22627ea40e271f0b209bf4 Mon Sep 17 00:00:00 2001 From: Tim Paine <3105306+timkpaine@users.noreply.github.com> Date: Tue, 28 Oct 2025 16:53:41 -0400 Subject: [PATCH 48/48] =?UTF-8?q?Bump=20version:=200.1.7=20=E2=86=92=200.1?= =?UTF-8?q?.8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tim Paine <3105306+timkpaine@users.noreply.github.com> --- hatch_cpp/__init__.py | 2 +- pyproject.toml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hatch_cpp/__init__.py b/hatch_cpp/__init__.py index d3dfbab..2f17aa3 100644 --- a/hatch_cpp/__init__.py +++ b/hatch_cpp/__init__.py @@ -1,4 +1,4 @@ -__version__ = "0.1.7" +__version__ = "0.1.8" from .hooks import hatch_register_build_hook from .plugin import HatchCppBuildHook diff --git a/pyproject.toml b/pyproject.toml index e3b1ee4..70d89ac 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ authors = [{name = "the hatch-cpp authors", email = "t.paine154@gmail.com"}] description = "Hatch plugin for C++ builds" readme = "README.md" license = { text = "Apache-2.0" } -version = "0.1.7" +version = "0.1.8" requires-python = ">=3.9" keywords = [ "hatch", @@ -73,7 +73,7 @@ Repository = "https://github.com/python-project-templates/hatch-cpp" Homepage = "https://github.com/python-project-templates/hatch-cpp" [tool.bumpversion] -current_version = "0.1.7" +current_version = "0.1.8" commit = true tag = false commit_args = "-s"