hatch-cpp 0.1.7__py3-none-any.whl → 0.1.9__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. hatch_cpp/__init__.py +5 -4
  2. hatch_cpp/config.py +101 -0
  3. hatch_cpp/plugin.py +1 -1
  4. hatch_cpp/tests/test_project_cmake/project/include/project/basic.hpp +17 -0
  5. hatch_cpp/tests/test_project_cmake_vcpkg/CMakeLists.txt +92 -0
  6. hatch_cpp/tests/test_project_cmake_vcpkg/Makefile +140 -0
  7. hatch_cpp/tests/test_project_cmake_vcpkg/cpp/project/basic.cpp +5 -0
  8. hatch_cpp/tests/test_project_cmake_vcpkg/cpp/project/basic.hpp +17 -0
  9. hatch_cpp/tests/test_project_cmake_vcpkg/project/__init__.py +0 -0
  10. hatch_cpp/tests/test_project_cmake_vcpkg/project/include/project/basic.hpp +17 -0
  11. hatch_cpp/tests/test_project_cmake_vcpkg/pyproject.toml +39 -0
  12. hatch_cpp/tests/test_project_cmake_vcpkg/vcpkg.json +8 -0
  13. hatch_cpp/tests/test_project_override_toolchain/cpp/project/basic.cpp +5 -0
  14. hatch_cpp/tests/test_project_override_toolchain/cpp/project/basic.hpp +17 -0
  15. hatch_cpp/tests/test_project_override_toolchain/project/__init__.py +0 -0
  16. hatch_cpp/tests/test_project_override_toolchain/pyproject.toml +38 -0
  17. hatch_cpp/tests/test_project_pybind_vcpkg/cpp/project/basic.cpp +6 -0
  18. hatch_cpp/tests/test_project_pybind_vcpkg/cpp/project/basic.hpp +9 -0
  19. hatch_cpp/tests/test_project_pybind_vcpkg/project/__init__.py +0 -0
  20. hatch_cpp/tests/test_project_pybind_vcpkg/pyproject.toml +35 -0
  21. hatch_cpp/tests/test_project_pybind_vcpkg/vcpkg.json +8 -0
  22. hatch_cpp/tests/test_projects.py +5 -2
  23. hatch_cpp/tests/test_structs.py +9 -1
  24. hatch_cpp/toolchains/__init__.py +3 -0
  25. hatch_cpp/toolchains/cmake.py +87 -0
  26. hatch_cpp/{structs.py → toolchains/common.py} +26 -105
  27. hatch_cpp/toolchains/vcpkg.py +64 -0
  28. hatch_cpp-0.1.9.dist-info/METADATA +144 -0
  29. hatch_cpp-0.1.9.dist-info/RECORD +60 -0
  30. {hatch_cpp-0.1.7.dist-info → hatch_cpp-0.1.9.dist-info}/licenses/LICENSE +4 -0
  31. hatch_cpp-0.1.7.dist-info/METADATA +0 -72
  32. hatch_cpp-0.1.7.dist-info/RECORD +0 -40
  33. {hatch_cpp-0.1.7.dist-info → hatch_cpp-0.1.9.dist-info}/WHEEL +0 -0
  34. {hatch_cpp-0.1.7.dist-info → hatch_cpp-0.1.9.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,87 @@
1
+ from __future__ import annotations
2
+
3
+ from os import environ
4
+ from pathlib import Path
5
+ from sys import version_info
6
+ from typing import Any, Dict, Optional
7
+
8
+ from pydantic import BaseModel, Field
9
+
10
+ from .common import Platform
11
+
12
+ __all__ = ("HatchCppCmakeConfiguration",)
13
+
14
+ DefaultMSVCGenerator = {
15
+ "12": "Visual Studio 12 2013",
16
+ "14": "Visual Studio 14 2015",
17
+ "14.0": "Visual Studio 14 2015",
18
+ "14.1": "Visual Studio 15 2017",
19
+ "14.2": "Visual Studio 16 2019",
20
+ "14.3": "Visual Studio 17 2022",
21
+ "14.4": "Visual Studio 17 2022",
22
+ }
23
+
24
+
25
+ class HatchCppCmakeConfiguration(BaseModel):
26
+ root: Path
27
+ build: Path = Field(default_factory=lambda: Path("build"))
28
+ install: Optional[Path] = Field(default=None)
29
+
30
+ cmake_arg_prefix: Optional[str] = Field(default=None)
31
+ cmake_args: Dict[str, str] = Field(default_factory=dict)
32
+ cmake_env_args: Dict[Platform, Dict[str, str]] = Field(default_factory=dict)
33
+
34
+ include_flags: Optional[Dict[str, Any]] = Field(default=None)
35
+
36
+ def generate(self, config) -> Dict[str, Any]:
37
+ commands = []
38
+
39
+ # Derive prefix
40
+ if self.cmake_arg_prefix is None:
41
+ self.cmake_arg_prefix = f"{config.name.replace('.', '_').replace('-', '_').upper()}_"
42
+
43
+ # Append base command
44
+ commands.append(f"cmake {Path(self.root).parent} -DCMAKE_BUILD_TYPE={config.build_type} -B {self.build}")
45
+
46
+ # Hook in to vcpkg if active
47
+ if "vcpkg" in config._active_toolchains:
48
+ commands[-1] += f" -DCMAKE_TOOLCHAIN_FILE={Path(config.vcpkg.vcpkg_root) / 'scripts' / 'buildsystems' / 'vcpkg.cmake'}"
49
+
50
+ # Setup install path
51
+ if self.install:
52
+ commands[-1] += f" -DCMAKE_INSTALL_PREFIX={self.install}"
53
+ else:
54
+ commands[-1] += f" -DCMAKE_INSTALL_PREFIX={Path(self.root).parent}"
55
+
56
+ # TODO: CMAKE_CXX_COMPILER
57
+ if config.platform.platform == "win32":
58
+ # TODO: prefix?
59
+ commands[-1] += f' -G "{environ.get("CMAKE_GENERATOR", "Visual Studio 17 2022")}"'
60
+
61
+ # Put in CMake flags
62
+ args = self.cmake_args.copy()
63
+ for platform, env_args in self.cmake_env_args.items():
64
+ if platform == config.platform.platform:
65
+ for key, value in env_args.items():
66
+ args[key] = value
67
+ for key, value in args.items():
68
+ commands[-1] += f" -D{self.cmake_arg_prefix}{key.upper()}={value}"
69
+
70
+ # Include customs
71
+ if self.include_flags:
72
+ if self.include_flags.get("python_version", False):
73
+ commands[-1] += f" -D{self.cmake_arg_prefix}PYTHON_VERSION={version_info.major}.{version_info.minor}"
74
+ if self.include_flags.get("manylinux", False) and config.platform.platform == "linux":
75
+ commands[-1] += f" -D{self.cmake_arg_prefix}MANYLINUX=ON"
76
+
77
+ # Include mac deployment target
78
+ if config.platform.platform == "darwin":
79
+ commands[-1] += f" -DCMAKE_OSX_DEPLOYMENT_TARGET={environ.get('OSX_DEPLOYMENT_TARGET', '11')}"
80
+
81
+ # Append build command
82
+ commands.append(f"cmake --build {self.build} --config {config.build_type}")
83
+
84
+ # Append install command
85
+ commands.append(f"cmake --install {self.build} --config {config.build_type}")
86
+
87
+ return commands
@@ -1,24 +1,31 @@
1
1
  from __future__ import annotations
2
2
 
3
- from os import environ, system as system_call
3
+ from os import environ
4
4
  from pathlib import Path
5
5
  from re import match
6
6
  from shutil import which
7
- from sys import executable, platform as sys_platform, version_info
7
+ from sys import executable, platform as sys_platform
8
8
  from sysconfig import get_path
9
- from typing import Any, Dict, List, Literal, Optional
9
+ from typing import Any, List, Literal, Optional
10
10
 
11
11
  from pydantic import AliasChoices, BaseModel, Field, field_validator, model_validator
12
12
 
13
13
  __all__ = (
14
- "HatchCppBuildConfig",
14
+ "BuildType",
15
+ "CompilerToolchain",
16
+ "Toolchain",
17
+ "Language",
18
+ "Binding",
19
+ "Platform",
20
+ "PlatformDefaults",
15
21
  "HatchCppLibrary",
16
22
  "HatchCppPlatform",
17
- "HatchCppBuildPlan",
18
23
  )
19
24
 
25
+
20
26
  BuildType = Literal["debug", "release"]
21
27
  CompilerToolchain = Literal["gcc", "clang", "msvc"]
28
+ Toolchain = Literal["vcpkg", "cmake", "vanilla"]
22
29
  Language = Literal["c", "c++"]
23
30
  Binding = Literal["cpython", "pybind11", "nanobind", "generic"]
24
31
  Platform = Literal["linux", "darwin", "win32"]
@@ -102,8 +109,15 @@ class HatchCppPlatform(BaseModel):
102
109
  toolchain = "clang"
103
110
  elif "cl" in CC and "cl" in CXX:
104
111
  toolchain = "msvc"
112
+ # Fallback to platform defaults
113
+ elif platform == "linux":
114
+ toolchain = "gcc"
115
+ elif platform == "darwin":
116
+ toolchain = "clang"
117
+ elif platform == "win32":
118
+ toolchain = "msvc"
105
119
  else:
106
- raise Exception(f"Unrecognized toolchain: {CC}, {CXX}")
120
+ toolchain = "gcc"
107
121
 
108
122
  # Customizations
109
123
  if which("ccache") and not environ.get("HATCH_CPP_DISABLE_CCACHE"):
@@ -117,6 +131,12 @@ class HatchCppPlatform(BaseModel):
117
131
  # LD = which("ld.lld")
118
132
  return HatchCppPlatform(cc=CC, cxx=CXX, ld=LD, platform=platform, toolchain=toolchain)
119
133
 
134
+ @staticmethod
135
+ def platform_for_toolchain(toolchain: CompilerToolchain) -> HatchCppPlatform:
136
+ platform = HatchCppPlatform.default()
137
+ platform.toolchain = toolchain
138
+ return platform
139
+
120
140
  def get_compile_flags(self, library: HatchCppLibrary, build_type: BuildType = "release") -> str:
121
141
  flags = ""
122
142
 
@@ -218,102 +238,3 @@ class HatchCppPlatform(BaseModel):
218
238
  while flags.count(" "):
219
239
  flags = flags.replace(" ", " ")
220
240
  return flags
221
-
222
-
223
- class HatchCppCmakeConfiguration(BaseModel):
224
- root: Path
225
- build: Path = Field(default_factory=lambda: Path("build"))
226
- install: Optional[Path] = Field(default=None)
227
-
228
- cmake_arg_prefix: Optional[str] = Field(default=None)
229
- cmake_args: Dict[str, str] = Field(default_factory=dict)
230
- cmake_env_args: Dict[Platform, Dict[str, str]] = Field(default_factory=dict)
231
-
232
- include_flags: Optional[Dict[str, Any]] = Field(default=None)
233
-
234
-
235
- class HatchCppBuildConfig(BaseModel):
236
- """Build config values for Hatch C++ Builder."""
237
-
238
- verbose: Optional[bool] = Field(default=False)
239
- name: Optional[str] = Field(default=None)
240
- libraries: List[HatchCppLibrary] = Field(default_factory=list)
241
- cmake: Optional[HatchCppCmakeConfiguration] = Field(default=None)
242
- platform: Optional[HatchCppPlatform] = Field(default_factory=HatchCppPlatform.default)
243
-
244
- @model_validator(mode="after")
245
- def check_toolchain_matches_args(self):
246
- if self.cmake and self.libraries:
247
- raise ValueError("Must not provide libraries when using cmake toolchain.")
248
- return self
249
-
250
-
251
- class HatchCppBuildPlan(HatchCppBuildConfig):
252
- build_type: BuildType = "release"
253
- commands: List[str] = Field(default_factory=list)
254
-
255
- def generate(self):
256
- self.commands = []
257
- if self.libraries:
258
- for library in self.libraries:
259
- compile_flags = self.platform.get_compile_flags(library, self.build_type)
260
- link_flags = self.platform.get_link_flags(library, self.build_type)
261
- self.commands.append(
262
- f"{self.platform.cc if library.language == 'c' else self.platform.cxx} {' '.join(library.sources)} {compile_flags} {link_flags}"
263
- )
264
- elif self.cmake:
265
- # Derive prefix
266
- if self.cmake.cmake_arg_prefix is None:
267
- self.cmake.cmake_arg_prefix = f"{self.name.replace('.', '_').replace('-', '_').upper()}_"
268
-
269
- # Append base command
270
- self.commands.append(f"cmake {Path(self.cmake.root).parent} -DCMAKE_BUILD_TYPE={self.build_type} -B {self.cmake.build}")
271
-
272
- # Setup install path
273
- if self.cmake.install:
274
- self.commands[-1] += f" -DCMAKE_INSTALL_PREFIX={self.cmake.install}"
275
- else:
276
- self.commands[-1] += f" -DCMAKE_INSTALL_PREFIX={Path(self.cmake.root).parent}"
277
-
278
- # TODO: CMAKE_CXX_COMPILER
279
- if self.platform.platform == "win32":
280
- # TODO: prefix?
281
- self.commands[-1] += f' -G "{environ.get("GENERATOR", "Visual Studio 17 2022")}"'
282
-
283
- # Put in CMake flags
284
- args = self.cmake.cmake_args.copy()
285
- for platform, env_args in self.cmake.cmake_env_args.items():
286
- if platform == self.platform.platform:
287
- for key, value in env_args.items():
288
- args[key] = value
289
- for key, value in args.items():
290
- self.commands[-1] += f" -D{self.cmake.cmake_arg_prefix}{key.upper()}={value}"
291
-
292
- # Include customs
293
- if self.cmake.include_flags:
294
- if self.cmake.include_flags.get("python_version", False):
295
- self.commands[-1] += f" -D{self.cmake.cmake_arg_prefix}PYTHON_VERSION={version_info.major}.{version_info.minor}"
296
- if self.cmake.include_flags.get("manylinux", False) and self.platform.platform == "linux":
297
- self.commands[-1] += f" -D{self.cmake.cmake_arg_prefix}MANYLINUX=ON"
298
-
299
- # Include mac deployment target
300
- if self.platform.platform == "darwin":
301
- self.commands[-1] += f" -DCMAKE_OSX_DEPLOYMENT_TARGET={environ.get('OSX_DEPLOYMENT_TARGET', '11')}"
302
-
303
- # Append build command
304
- self.commands.append(f"cmake --build {self.cmake.build} --config {self.build_type}")
305
-
306
- # Append install command
307
- self.commands.append(f"cmake --install {self.cmake.build} --config {self.build_type}")
308
-
309
- return self.commands
310
-
311
- def execute(self):
312
- for command in self.commands:
313
- system_call(command)
314
- return self.commands
315
-
316
- def cleanup(self):
317
- if self.platform.platform == "win32":
318
- for temp_obj in Path(".").glob("*.obj"):
319
- temp_obj.unlink()
@@ -0,0 +1,64 @@
1
+ from __future__ import annotations
2
+
3
+ from pathlib import Path
4
+ from platform import machine as platform_machine
5
+ from sys import platform as sys_platform
6
+ from typing import Literal, Optional
7
+
8
+ from pydantic import BaseModel, Field
9
+
10
+ __all__ = ("HatchCppVcpkgConfiguration",)
11
+
12
+
13
+ VcpkgTriplet = Literal[
14
+ "x64-android",
15
+ "x64-osx",
16
+ "x64-linux",
17
+ "x64-uwp",
18
+ "x64-windows",
19
+ "x64-windows-release",
20
+ "x64-windows-static",
21
+ "x64-windows-static-md",
22
+ "x86-windows",
23
+ "arm-neon-android",
24
+ "arm64-android",
25
+ "arm64-osx",
26
+ "arm64-uwp",
27
+ "arm64-windows",
28
+ "arm64-windows-static-md",
29
+ ]
30
+ VcpkgPlatformDefaults = {
31
+ ("linux", "x86_64"): "x64-linux",
32
+ # ("linux", "arm64"): "",
33
+ ("darwin", "x86_64"): "x64-osx",
34
+ ("darwin", "arm64"): "arm64-osx",
35
+ ("win32", "x86_64"): "x64-windows-static-md",
36
+ ("win32", "arm64"): "arm64-windows-static-md",
37
+ }
38
+
39
+
40
+ class HatchCppVcpkgConfiguration(BaseModel):
41
+ vcpkg: Optional[str] = Field(default="vcpkg.json")
42
+ vcpkg_root: Optional[Path] = Field(default=Path("vcpkg"))
43
+ vcpkg_repo: Optional[str] = Field(default="https://github.com/microsoft/vcpkg.git")
44
+ vcpkg_triplet: Optional[VcpkgTriplet] = Field(default=None)
45
+
46
+ # TODO: overlay
47
+
48
+ def generate(self, config):
49
+ commands = []
50
+
51
+ if self.vcpkg_triplet is None:
52
+ self.vcpkg_triplet = VcpkgPlatformDefaults.get((sys_platform, platform_machine()))
53
+ if self.vcpkg_triplet is None:
54
+ raise ValueError(f"Could not determine vcpkg triplet for platform {sys_platform} and architecture {platform_machine()}")
55
+
56
+ if self.vcpkg and Path(self.vcpkg).exists():
57
+ if not Path(self.vcpkg_root).exists():
58
+ commands.append(f"git clone {self.vcpkg_repo} {self.vcpkg_root}")
59
+ commands.append(
60
+ f"./{self.vcpkg_root / 'bootstrap-vcpkg.sh' if sys_platform != 'win32' else self.vcpkg_root / 'sbootstrap-vcpkg.bat'}"
61
+ )
62
+ commands.append(f"./{self.vcpkg_root / 'vcpkg'} install --triplet {self.vcpkg_triplet}")
63
+
64
+ return commands
@@ -0,0 +1,144 @@
1
+ Metadata-Version: 2.4
2
+ Name: hatch-cpp
3
+ Version: 0.1.9
4
+ Summary: Hatch plugin for C++ builds
5
+ Project-URL: Repository, https://github.com/python-project-templates/hatch-cpp
6
+ Project-URL: Homepage, https://github.com/python-project-templates/hatch-cpp
7
+ Author-email: the hatch-cpp authors <t.paine154@gmail.com>
8
+ License: Apache-2.0
9
+ License-File: LICENSE
10
+ Keywords: build,c++,cmake,cpp,hatch,python
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: License :: OSI Approved :: Apache Software License
13
+ Classifier: Programming Language :: Python
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.9
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Programming Language :: Python :: 3.14
21
+ Classifier: Programming Language :: Python :: Implementation :: CPython
22
+ Classifier: Programming Language :: Python :: Implementation :: PyPy
23
+ Requires-Python: >=3.9
24
+ Requires-Dist: hatchling>=1.20
25
+ Requires-Dist: pydantic
26
+ Provides-Extra: develop
27
+ Requires-Dist: build; extra == 'develop'
28
+ Requires-Dist: bump-my-version; extra == 'develop'
29
+ Requires-Dist: check-manifest; extra == 'develop'
30
+ Requires-Dist: codespell<2.5,>=2.4; extra == 'develop'
31
+ Requires-Dist: hatch-build; extra == 'develop'
32
+ Requires-Dist: hatchling; extra == 'develop'
33
+ Requires-Dist: mdformat-tables>=1; extra == 'develop'
34
+ Requires-Dist: mdformat<1.1,>=0.7.22; extra == 'develop'
35
+ Requires-Dist: nanobind<2.10.0; extra == 'develop'
36
+ Requires-Dist: pybind11; extra == 'develop'
37
+ Requires-Dist: pytest; extra == 'develop'
38
+ Requires-Dist: pytest-cov; extra == 'develop'
39
+ Requires-Dist: ruff<0.15,>=0.9; extra == 'develop'
40
+ Requires-Dist: toml; extra == 'develop'
41
+ Requires-Dist: twine; extra == 'develop'
42
+ Requires-Dist: uv; extra == 'develop'
43
+ Requires-Dist: wheel; extra == 'develop'
44
+ Description-Content-Type: text/markdown
45
+
46
+ # hatch-cpp
47
+
48
+ Hatch plugin for C++ builds
49
+
50
+ [![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)
51
+ [![codecov](https://codecov.io/gh/python-project-templates/hatch-cpp/branch/main/graph/badge.svg)](https://codecov.io/gh/python-project-templates/hatch-cpp)
52
+ [![License](https://img.shields.io/github/license/python-project-templates/hatch-cpp)](https://github.com/python-project-templates/hatch-cpp)
53
+ [![PyPI](https://img.shields.io/pypi/v/hatch-cpp.svg)](https://pypi.python.org/pypi/hatch-cpp)
54
+
55
+ ## Overview
56
+
57
+ A simple, extensible C++ build plugin for [hatch](https://hatch.pypa.io/latest/).
58
+
59
+ ```toml
60
+ [tool.hatch.build.hooks.hatch-cpp]
61
+ libraries = [
62
+ {name = "project/extension", sources = ["cpp/project/basic.cpp"], include-dirs = ["cpp"]}
63
+ ]
64
+ ```
65
+
66
+ For more complete systems, see:
67
+
68
+ - [scikit-build-core](https://github.com/scikit-build/scikit-build-core)
69
+ - [setuptools](https://setuptools.pypa.io/en/latest/userguide/ext_modules.html)
70
+
71
+ ## Configuration
72
+
73
+ Configuration is driven from the `[tool.hatch.build.hooks.hatch-cpp]` hatch hook configuration field in a `pyproject.toml`.
74
+ It is designed to closely match existing Python/C/C++ packaging tools.
75
+
76
+ ```toml
77
+ verbose = true
78
+ libraries = { Library Args }
79
+ cmake = { CMake Args }
80
+ platform = { Platform, either "linux", "darwin", or "win32" }
81
+ ```
82
+
83
+ See the [test cases](./hatch_cpp/tests/) for more concrete examples.
84
+
85
+ `hatch-cpp` is driven by [pydantic](https://docs.pydantic.dev/latest/) models for configuration and execution of the build.
86
+ These models can themselves be overridden by setting `build-config-class` / `build-plan-class`.
87
+
88
+ ### Library Arguments
89
+
90
+ ```toml
91
+ name = "mylib"
92
+ sources = [
93
+ "path/to/file.cpp",
94
+ ]
95
+ language = "c++"
96
+
97
+ binding = "cpython" # or "pybind11", "nanobind", "generic"
98
+ std = "" # Passed to -std= or /std:
99
+
100
+ include_dirs = ["paths/to/add/to/-I"]
101
+ library_dirs = ["paths/to/add/to/-L"]
102
+ libraries = ["-llibraries_to_link"]
103
+
104
+ extra_compile_args = ["--extra-compile-args"]
105
+ extra_link_args = ["--extra-link-args"]
106
+ extra_objects = ["extra_objects"]
107
+
108
+ define_macros = ["-Ddefines_to_use"]
109
+ undef_macros = ["-Uundefines_to_use"]
110
+
111
+ py_limited_api = "cp39" # limited API to use
112
+ ```
113
+
114
+ ### CMake Arguments
115
+
116
+ `hatch-cpp` has some convenience integration with CMake.
117
+ Though this is not designed to be as full-featured as e.g. `scikit-build`, it should be satisfactory for many small projects.
118
+
119
+ ```toml
120
+ root = "path/to/cmake/root"
121
+ build = "path/to/cmake/build/folder"
122
+ install = "path/to/cmake/install/folder"
123
+
124
+ cmake_arg_prefix = "MYPROJECT_"
125
+ cmake_args = {} # any other cmake args to pass
126
+ cmake_env_args = {} # env-specific cmake args to pass
127
+
128
+ include_flags = {} # include flags to pass -D
129
+ ```
130
+
131
+ ### Environment Variables
132
+
133
+ `hatch-cpp` will respect standard environment variables for compiler control.
134
+
135
+ | Name | Default | Description |
136
+ | :------------------------- | :------ | :-------------------- |
137
+ | `CC` | | C Compiler override |
138
+ | `CXX` | | C++ Compiler override |
139
+ | `LD` | | Linker override |
140
+ | `HATCH_CPP_PLATFORM` | | Platform to build |
141
+ | `HATCH_CPP_DISABLE_CCACHE` | | Disable CCache usage |
142
+
143
+ > [!NOTE]
144
+ > 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).
@@ -0,0 +1,60 @@
1
+ hatch_cpp/__init__.py,sha256=oKHiO4K6AqVX3CJNI-_Bg9N7-jM_vIcXsdrv8aTVCAM,114
2
+ hatch_cpp/config.py,sha256=8UIdlc6fHEBNgjmLZ1op3x-16BARxx4GJHPwAFQlOUw,3641
3
+ hatch_cpp/hooks.py,sha256=SQkF5WJIgzw-8rvlTzuQvBqdP6K3fHgnh6CZOZFag50,203
4
+ hatch_cpp/plugin.py,sha256=9y_cmH7cDFUJ5_xOj6ugVBerd5EdQo30T1FnZ5mmna8,4402
5
+ hatch_cpp/utils.py,sha256=lxd3U3aMYsTS6DYMc1y17MR16LzgRzv92f_xh87LSg8,297
6
+ hatch_cpp/tests/test_projects.py,sha256=vs-kHdiHM7pCqM3oGQsSryq5blRi0HyK5QFfHxlJDi8,1773
7
+ hatch_cpp/tests/test_structs.py,sha256=cpzbPLneEbEONzXmPS1S9PL9mbhya4udc4eqTpU9w6w,2576
8
+ hatch_cpp/tests/test_project_basic/pyproject.toml,sha256=eqM1UVpNmJWDfsuO18ZG_VOV9I4tAWgsM5Dhf49X8Nc,694
9
+ hatch_cpp/tests/test_project_basic/cpp/project/basic.cpp,sha256=gQ2nmdLqIdgaqxSKvkN_vbp6Iv_pAoVIHETXPRnALb0,117
10
+ hatch_cpp/tests/test_project_basic/cpp/project/basic.hpp,sha256=SO5GhPj8k3RzWrfH37lFSDc8w1Vf3yqTUhxmr1hnoko,422
11
+ hatch_cpp/tests/test_project_basic/project/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
+ hatch_cpp/tests/test_project_cmake/CMakeLists.txt,sha256=J6ijT9x9uSuisNEVIdFVgc_AstU9hbmIUbwvdjn_4GU,2795
13
+ hatch_cpp/tests/test_project_cmake/Makefile,sha256=Vfr65pvnktWTUeuvpMWqIxDR-7V9MT4PQAyj-WHG_pI,4357
14
+ hatch_cpp/tests/test_project_cmake/pyproject.toml,sha256=pu9RWhm_FY7KlcdOg2nmp-obnStnPJ04jW-bxei704w,814
15
+ hatch_cpp/tests/test_project_cmake/cpp/project/basic.cpp,sha256=gQ2nmdLqIdgaqxSKvkN_vbp6Iv_pAoVIHETXPRnALb0,117
16
+ hatch_cpp/tests/test_project_cmake/cpp/project/basic.hpp,sha256=SO5GhPj8k3RzWrfH37lFSDc8w1Vf3yqTUhxmr1hnoko,422
17
+ hatch_cpp/tests/test_project_cmake/project/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
+ hatch_cpp/tests/test_project_cmake/project/include/project/basic.hpp,sha256=SO5GhPj8k3RzWrfH37lFSDc8w1Vf3yqTUhxmr1hnoko,422
19
+ hatch_cpp/tests/test_project_cmake_vcpkg/CMakeLists.txt,sha256=J6ijT9x9uSuisNEVIdFVgc_AstU9hbmIUbwvdjn_4GU,2795
20
+ hatch_cpp/tests/test_project_cmake_vcpkg/Makefile,sha256=Vfr65pvnktWTUeuvpMWqIxDR-7V9MT4PQAyj-WHG_pI,4357
21
+ hatch_cpp/tests/test_project_cmake_vcpkg/pyproject.toml,sha256=pu9RWhm_FY7KlcdOg2nmp-obnStnPJ04jW-bxei704w,814
22
+ hatch_cpp/tests/test_project_cmake_vcpkg/vcpkg.json,sha256=3D_Mm48_-srxYzbdHNCVO00eFLLGZfsFfL6IMcK0x3E,162
23
+ hatch_cpp/tests/test_project_cmake_vcpkg/cpp/project/basic.cpp,sha256=gQ2nmdLqIdgaqxSKvkN_vbp6Iv_pAoVIHETXPRnALb0,117
24
+ hatch_cpp/tests/test_project_cmake_vcpkg/cpp/project/basic.hpp,sha256=SO5GhPj8k3RzWrfH37lFSDc8w1Vf3yqTUhxmr1hnoko,422
25
+ hatch_cpp/tests/test_project_cmake_vcpkg/project/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
26
+ hatch_cpp/tests/test_project_cmake_vcpkg/project/include/project/basic.hpp,sha256=SO5GhPj8k3RzWrfH37lFSDc8w1Vf3yqTUhxmr1hnoko,422
27
+ hatch_cpp/tests/test_project_limited_api/pyproject.toml,sha256=k_2y7YpZP5I-KPvKOZLmnHqoKXVE2oVM8fjxtRKoTo0,726
28
+ hatch_cpp/tests/test_project_limited_api/cpp/project/basic.cpp,sha256=gQ2nmdLqIdgaqxSKvkN_vbp6Iv_pAoVIHETXPRnALb0,117
29
+ hatch_cpp/tests/test_project_limited_api/cpp/project/basic.hpp,sha256=SO5GhPj8k3RzWrfH37lFSDc8w1Vf3yqTUhxmr1hnoko,422
30
+ hatch_cpp/tests/test_project_limited_api/project/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
31
+ hatch_cpp/tests/test_project_nanobind/pyproject.toml,sha256=_QV3uW2UWjbiBOKiEfMQKkDyG3VlZui-GE6PSYokdHo,720
32
+ hatch_cpp/tests/test_project_nanobind/cpp/project/basic.cpp,sha256=L4v9AUveWWQX8Z2GMRREsEGLz-A_NCeuX0KiyppDmbc,30
33
+ hatch_cpp/tests/test_project_nanobind/cpp/project/basic.hpp,sha256=AK2FKdlqBwH5jnRUdJXSbWvRr-gSVsUKSG0PiYNsW7A,155
34
+ hatch_cpp/tests/test_project_nanobind/project/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
35
+ hatch_cpp/tests/test_project_override_classes/pyproject.toml,sha256=ykoZnutSWLYIZQ0M5K86tcy7P1sHamzRd-R-bJKuxsk,807
36
+ hatch_cpp/tests/test_project_override_classes/cpp/project/basic.cpp,sha256=gQ2nmdLqIdgaqxSKvkN_vbp6Iv_pAoVIHETXPRnALb0,117
37
+ hatch_cpp/tests/test_project_override_classes/cpp/project/basic.hpp,sha256=SO5GhPj8k3RzWrfH37lFSDc8w1Vf3yqTUhxmr1hnoko,422
38
+ hatch_cpp/tests/test_project_override_classes/project/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
39
+ hatch_cpp/tests/test_project_override_toolchain/pyproject.toml,sha256=t4zW-beld-tQzLsP7czECLMLYrewwF37EtNMrn-BRM8,758
40
+ hatch_cpp/tests/test_project_override_toolchain/cpp/project/basic.cpp,sha256=gQ2nmdLqIdgaqxSKvkN_vbp6Iv_pAoVIHETXPRnALb0,117
41
+ hatch_cpp/tests/test_project_override_toolchain/cpp/project/basic.hpp,sha256=SO5GhPj8k3RzWrfH37lFSDc8w1Vf3yqTUhxmr1hnoko,422
42
+ hatch_cpp/tests/test_project_override_toolchain/project/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
43
+ hatch_cpp/tests/test_project_pybind/pyproject.toml,sha256=3IVlSprxx8XaC36s6OSgKr-OiSPn6cH6nX8pbp10suM,716
44
+ hatch_cpp/tests/test_project_pybind/cpp/project/basic.cpp,sha256=MT3eCSQKr4guI3XZHV8kw8PoBGC6LEK8ClxnNMBnvnI,78
45
+ hatch_cpp/tests/test_project_pybind/cpp/project/basic.hpp,sha256=LZSfCfhLY_91MBOxtnvDk7DcceO-9GhCHKpMnAjGe18,146
46
+ hatch_cpp/tests/test_project_pybind/project/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
47
+ hatch_cpp/tests/test_project_pybind_vcpkg/pyproject.toml,sha256=3IVlSprxx8XaC36s6OSgKr-OiSPn6cH6nX8pbp10suM,716
48
+ hatch_cpp/tests/test_project_pybind_vcpkg/vcpkg.json,sha256=3D_Mm48_-srxYzbdHNCVO00eFLLGZfsFfL6IMcK0x3E,162
49
+ hatch_cpp/tests/test_project_pybind_vcpkg/cpp/project/basic.cpp,sha256=MT3eCSQKr4guI3XZHV8kw8PoBGC6LEK8ClxnNMBnvnI,78
50
+ hatch_cpp/tests/test_project_pybind_vcpkg/cpp/project/basic.hpp,sha256=LZSfCfhLY_91MBOxtnvDk7DcceO-9GhCHKpMnAjGe18,146
51
+ hatch_cpp/tests/test_project_pybind_vcpkg/project/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
52
+ hatch_cpp/toolchains/__init__.py,sha256=anza4tXKxauobWMOUrxX3sEO0qs7sp6VdLXhLae3vkY,64
53
+ hatch_cpp/toolchains/cmake.py,sha256=_NyURVcVBjQH4cYDtBLNH6PNCVT88WiRCx70U7CNyKA,3282
54
+ hatch_cpp/toolchains/common.py,sha256=nBAGQ9B5a7yNgOgohUCsbnDAJACrdQ8lt5dFyb7IXMs,10076
55
+ hatch_cpp/toolchains/vcpkg.py,sha256=fx9lo5EH3HVqg9Fnh5EO67gNsAXcza9eZz4S-Y8piJ0,2097
56
+ hatch_cpp-0.1.9.dist-info/METADATA,sha256=4_5RAtqq11Hp9ddwth9auEBEfpddcMQQ9z0VRKhM0Rk,5540
57
+ hatch_cpp-0.1.9.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
58
+ hatch_cpp-0.1.9.dist-info/entry_points.txt,sha256=RgXfjpD4iwomJQK5n7FnPkXzb5fOnF5v3DI5hbkgVcw,30
59
+ hatch_cpp-0.1.9.dist-info/licenses/LICENSE,sha256=FWyFTpd5xXEz50QpGDtsyIv6dgR2z_dHdoab_Nq_KMw,11452
60
+ hatch_cpp-0.1.9.dist-info/RECORD,,
@@ -186,7 +186,11 @@
186
186
  same "printed page" as the copyright notice for easier
187
187
  identification within third-party archives.
188
188
 
189
+ <<<<<<< before updating
189
190
  Copyright [yyyy] [name of copyright owner]
191
+ =======
192
+ Copyright 2025 the hatch-cpp authors
193
+ >>>>>>> after updating
190
194
 
191
195
  Licensed under the Apache License, Version 2.0 (the "License");
192
196
  you may not use this file except in compliance with the License.
@@ -1,72 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: hatch-cpp
3
- Version: 0.1.7
4
- Summary: Hatch plugin for C++ builds
5
- Project-URL: Repository, https://github.com/python-project-templates/hatch-cpp
6
- Project-URL: Homepage, https://github.com/python-project-templates/hatch-cpp
7
- Author-email: the hatch-cpp authors <t.paine154@gmail.com>
8
- License: Apache-2.0
9
- License-File: LICENSE
10
- Keywords: build,c++,cmake,cpp,hatch,python
11
- Classifier: Development Status :: 3 - Alpha
12
- Classifier: License :: OSI Approved :: Apache Software License
13
- Classifier: Programming Language :: Python
14
- Classifier: Programming Language :: Python :: 3
15
- Classifier: Programming Language :: Python :: 3.9
16
- Classifier: Programming Language :: Python :: 3.10
17
- Classifier: Programming Language :: Python :: 3.11
18
- Classifier: Programming Language :: Python :: 3.12
19
- Classifier: Programming Language :: Python :: Implementation :: CPython
20
- Classifier: Programming Language :: Python :: Implementation :: PyPy
21
- Requires-Python: >=3.9
22
- Requires-Dist: hatchling>=1.20
23
- Requires-Dist: pydantic
24
- Provides-Extra: develop
25
- Requires-Dist: build; extra == 'develop'
26
- Requires-Dist: bump-my-version; extra == 'develop'
27
- Requires-Dist: check-manifest; extra == 'develop'
28
- Requires-Dist: nanobind; extra == 'develop'
29
- Requires-Dist: pybind11; extra == 'develop'
30
- Requires-Dist: pytest; extra == 'develop'
31
- Requires-Dist: pytest-cov; extra == 'develop'
32
- Requires-Dist: ruff<0.9,>=0.3; extra == 'develop'
33
- Requires-Dist: toml; extra == 'develop'
34
- Requires-Dist: twine; extra == 'develop'
35
- Requires-Dist: wheel; extra == 'develop'
36
- Description-Content-Type: text/markdown
37
-
38
- # hatch-cpp
39
-
40
- Hatch plugin for C++ builds
41
-
42
- [![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)
43
- [![codecov](https://codecov.io/gh/python-project-templates/hatch-cpp/branch/main/graph/badge.svg)](https://codecov.io/gh/python-project-templates/hatch-cpp)
44
- [![License](https://img.shields.io/github/license/python-project-templates/hatch-cpp)](https://github.com/python-project-templates/hatch-cpp)
45
- [![PyPI](https://img.shields.io/pypi/v/hatch-cpp.svg)](https://pypi.python.org/pypi/hatch-cpp)
46
-
47
- ## Overview
48
-
49
- A simple, extensible C++ build plugin for [hatch](https://hatch.pypa.io/latest/).
50
-
51
- ```toml
52
- [tool.hatch.build.hooks.hatch-cpp]
53
- libraries = [
54
- {name = "project/extension", sources = ["cpp/project/basic.cpp"], include-dirs = ["cpp"]}
55
- ]
56
- ```
57
-
58
- For more complete systems, see:
59
- - [scikit-build-core](https://github.com/scikit-build/scikit-build-core)
60
- - [setuptools](https://setuptools.pypa.io/en/latest/userguide/ext_modules.html)
61
-
62
- ## Environment Variables
63
- | Name | Default | Description |
64
- |:-----|:--------|:------------|
65
- |`CC`| | |
66
- |`CXX`| | |
67
- |`LD`| | |
68
- |`HATCH_CPP_PLATFORM`| | |
69
- |`HATCH_CPP_DISABLE_CCACHE`| | |
70
-
71
- > [!NOTE]
72
- > 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).
@@ -1,40 +0,0 @@
1
- hatch_cpp/__init__.py,sha256=iL_H3Zhh1jKzI3DB7IrRjibqnsFh0QPAQL1ERHAR7hI,129
2
- hatch_cpp/hooks.py,sha256=SQkF5WJIgzw-8rvlTzuQvBqdP6K3fHgnh6CZOZFag50,203
3
- hatch_cpp/plugin.py,sha256=AV5hcVcPPIOsalKKiGSXHcHrLlZ7mKIVc-g5_waK9fk,4403
4
- hatch_cpp/structs.py,sha256=LDaAjzpAl4G7IysMIz6zUV1H5GcVBL2BAxA7DXjtxQw,13895
5
- hatch_cpp/utils.py,sha256=lxd3U3aMYsTS6DYMc1y17MR16LzgRzv92f_xh87LSg8,297
6
- hatch_cpp/tests/test_projects.py,sha256=vmJ218C_jP5nsen2gwjPtob0AoH4J_jNS5nOckHamvw,1623
7
- hatch_cpp/tests/test_structs.py,sha256=5y_xi2Hsg5NwG34hWuQoycJZEOMRI384RjPjIY4skw4,2090
8
- hatch_cpp/tests/test_project_basic/pyproject.toml,sha256=eqM1UVpNmJWDfsuO18ZG_VOV9I4tAWgsM5Dhf49X8Nc,694
9
- hatch_cpp/tests/test_project_basic/cpp/project/basic.cpp,sha256=gQ2nmdLqIdgaqxSKvkN_vbp6Iv_pAoVIHETXPRnALb0,117
10
- hatch_cpp/tests/test_project_basic/cpp/project/basic.hpp,sha256=SO5GhPj8k3RzWrfH37lFSDc8w1Vf3yqTUhxmr1hnoko,422
11
- hatch_cpp/tests/test_project_basic/project/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
- hatch_cpp/tests/test_project_cmake/CMakeLists.txt,sha256=J6ijT9x9uSuisNEVIdFVgc_AstU9hbmIUbwvdjn_4GU,2795
13
- hatch_cpp/tests/test_project_cmake/Makefile,sha256=Vfr65pvnktWTUeuvpMWqIxDR-7V9MT4PQAyj-WHG_pI,4357
14
- hatch_cpp/tests/test_project_cmake/pyproject.toml,sha256=pu9RWhm_FY7KlcdOg2nmp-obnStnPJ04jW-bxei704w,814
15
- hatch_cpp/tests/test_project_cmake/cpp/project/basic.cpp,sha256=gQ2nmdLqIdgaqxSKvkN_vbp6Iv_pAoVIHETXPRnALb0,117
16
- hatch_cpp/tests/test_project_cmake/cpp/project/basic.hpp,sha256=SO5GhPj8k3RzWrfH37lFSDc8w1Vf3yqTUhxmr1hnoko,422
17
- hatch_cpp/tests/test_project_cmake/project/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
- hatch_cpp/tests/test_project_limited_api/pyproject.toml,sha256=k_2y7YpZP5I-KPvKOZLmnHqoKXVE2oVM8fjxtRKoTo0,726
19
- hatch_cpp/tests/test_project_limited_api/cpp/project/basic.cpp,sha256=gQ2nmdLqIdgaqxSKvkN_vbp6Iv_pAoVIHETXPRnALb0,117
20
- hatch_cpp/tests/test_project_limited_api/cpp/project/basic.hpp,sha256=SO5GhPj8k3RzWrfH37lFSDc8w1Vf3yqTUhxmr1hnoko,422
21
- hatch_cpp/tests/test_project_limited_api/project/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
- hatch_cpp/tests/test_project_nanobind/pyproject.toml,sha256=_QV3uW2UWjbiBOKiEfMQKkDyG3VlZui-GE6PSYokdHo,720
23
- hatch_cpp/tests/test_project_nanobind/cpp/project/basic.cpp,sha256=L4v9AUveWWQX8Z2GMRREsEGLz-A_NCeuX0KiyppDmbc,30
24
- hatch_cpp/tests/test_project_nanobind/cpp/project/basic.hpp,sha256=AK2FKdlqBwH5jnRUdJXSbWvRr-gSVsUKSG0PiYNsW7A,155
25
- hatch_cpp/tests/test_project_nanobind/project/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
26
- hatch_cpp/tests/test_project_override_classes/pyproject.toml,sha256=ykoZnutSWLYIZQ0M5K86tcy7P1sHamzRd-R-bJKuxsk,807
27
- hatch_cpp/tests/test_project_override_classes/cpp/project/basic.cpp,sha256=gQ2nmdLqIdgaqxSKvkN_vbp6Iv_pAoVIHETXPRnALb0,117
28
- hatch_cpp/tests/test_project_override_classes/cpp/project/basic.hpp,sha256=SO5GhPj8k3RzWrfH37lFSDc8w1Vf3yqTUhxmr1hnoko,422
29
- hatch_cpp/tests/test_project_override_classes/project/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
30
- hatch_cpp/tests/test_project_pybind/pyproject.toml,sha256=3IVlSprxx8XaC36s6OSgKr-OiSPn6cH6nX8pbp10suM,716
31
- hatch_cpp/tests/test_project_pybind/cpp/project/basic.cpp,sha256=MT3eCSQKr4guI3XZHV8kw8PoBGC6LEK8ClxnNMBnvnI,78
32
- hatch_cpp/tests/test_project_pybind/cpp/project/basic.hpp,sha256=LZSfCfhLY_91MBOxtnvDk7DcceO-9GhCHKpMnAjGe18,146
33
- hatch_cpp/tests/test_project_pybind/project/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
34
- hatch_cpp/toolchains/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
35
- hatch_cpp/toolchains/cmake.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
36
- hatch_cpp-0.1.7.dist-info/METADATA,sha256=z95QlwYagluSoKGVxGm9sdjCcVF_y93MCmxSc3yvnZ0,3043
37
- hatch_cpp-0.1.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
38
- hatch_cpp-0.1.7.dist-info/entry_points.txt,sha256=RgXfjpD4iwomJQK5n7FnPkXzb5fOnF5v3DI5hbkgVcw,30
39
- hatch_cpp-0.1.7.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
40
- hatch_cpp-0.1.7.dist-info/RECORD,,