hatch-cpp 0.3.7__tar.gz → 0.4.0__tar.gz

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 (67) hide show
  1. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/.gitignore +12 -7
  2. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/PKG-INFO +2 -2
  3. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/__init__.py +1 -1
  4. {hatch_cpp-0.3.7/hatch_cpp/tests/test_project_cmake_vcpkg → hatch_cpp-0.4.0/hatch_cpp/tests/test_project_cmake}/CMakeLists.txt +2 -10
  5. {hatch_cpp-0.3.7/hatch_cpp/tests/test_project_cmake → hatch_cpp-0.4.0/hatch_cpp/tests/test_project_cmake_vcpkg}/CMakeLists.txt +2 -10
  6. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/tests/test_projects.py +17 -8
  7. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/toolchains/common.py +3 -0
  8. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/pyproject.toml +6 -3
  9. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/LICENSE +0 -0
  10. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/README.md +0 -0
  11. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/config.py +0 -0
  12. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/hooks.py +0 -0
  13. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/plugin.py +0 -0
  14. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/tests/test_hatch_build.py +0 -0
  15. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/tests/test_platform_specific.py +0 -0
  16. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/tests/test_project_basic/cpp/project/basic.cpp +0 -0
  17. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/tests/test_project_basic/cpp/project/basic.hpp +0 -0
  18. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/tests/test_project_basic/project/__init__.py +0 -0
  19. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/tests/test_project_basic/pyproject.toml +0 -0
  20. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/tests/test_project_cmake/Makefile +0 -0
  21. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/tests/test_project_cmake/cpp/project/basic.cpp +0 -0
  22. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/tests/test_project_cmake/cpp/project/basic.hpp +0 -0
  23. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/tests/test_project_cmake/project/__init__.py +0 -0
  24. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/tests/test_project_cmake/project/include/project/basic.hpp +0 -0
  25. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/tests/test_project_cmake/pyproject.toml +0 -0
  26. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/tests/test_project_cmake_vcpkg/Makefile +0 -0
  27. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/tests/test_project_cmake_vcpkg/cpp/project/basic.cpp +0 -0
  28. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/tests/test_project_cmake_vcpkg/cpp/project/basic.hpp +0 -0
  29. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/tests/test_project_cmake_vcpkg/project/__init__.py +0 -0
  30. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/tests/test_project_cmake_vcpkg/project/include/project/basic.hpp +0 -0
  31. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/tests/test_project_cmake_vcpkg/pyproject.toml +0 -0
  32. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/tests/test_project_cmake_vcpkg/vcpkg.json +0 -0
  33. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/tests/test_project_hatch_build/cpp/project/basic.cpp +0 -0
  34. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/tests/test_project_hatch_build/cpp/project/basic.hpp +0 -0
  35. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/tests/test_project_hatch_build/project/__init__.py +0 -0
  36. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/tests/test_project_hatch_build/pyproject.toml +0 -0
  37. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/tests/test_project_limited_api/cpp/project/basic.cpp +0 -0
  38. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/tests/test_project_limited_api/cpp/project/basic.hpp +0 -0
  39. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/tests/test_project_limited_api/project/__init__.py +0 -0
  40. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/tests/test_project_limited_api/pyproject.toml +0 -0
  41. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/tests/test_project_nanobind/cpp/project/basic.cpp +0 -0
  42. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/tests/test_project_nanobind/cpp/project/basic.hpp +0 -0
  43. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/tests/test_project_nanobind/project/__init__.py +0 -0
  44. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/tests/test_project_nanobind/pyproject.toml +0 -0
  45. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/tests/test_project_override_classes/cpp/project/basic.cpp +0 -0
  46. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/tests/test_project_override_classes/cpp/project/basic.hpp +0 -0
  47. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/tests/test_project_override_classes/project/__init__.py +0 -0
  48. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/tests/test_project_override_classes/pyproject.toml +0 -0
  49. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/tests/test_project_override_toolchain/cpp/project/basic.cpp +0 -0
  50. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/tests/test_project_override_toolchain/cpp/project/basic.hpp +0 -0
  51. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/tests/test_project_override_toolchain/project/__init__.py +0 -0
  52. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/tests/test_project_override_toolchain/pyproject.toml +0 -0
  53. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/tests/test_project_pybind/cpp/project/basic.cpp +0 -0
  54. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/tests/test_project_pybind/cpp/project/basic.hpp +0 -0
  55. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/tests/test_project_pybind/project/__init__.py +0 -0
  56. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/tests/test_project_pybind/pyproject.toml +0 -0
  57. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/tests/test_project_pybind_vcpkg/cpp/project/basic.cpp +0 -0
  58. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/tests/test_project_pybind_vcpkg/cpp/project/basic.hpp +0 -0
  59. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/tests/test_project_pybind_vcpkg/project/__init__.py +0 -0
  60. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/tests/test_project_pybind_vcpkg/pyproject.toml +0 -0
  61. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/tests/test_project_pybind_vcpkg/vcpkg.json +0 -0
  62. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/tests/test_structs.py +0 -0
  63. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/tests/test_vcpkg_ref.py +0 -0
  64. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/toolchains/__init__.py +0 -0
  65. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/toolchains/cmake.py +0 -0
  66. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/toolchains/vcpkg.py +0 -0
  67. {hatch_cpp-0.3.7 → hatch_cpp-0.4.0}/hatch_cpp/utils.py +0 -0
@@ -5,6 +5,8 @@ __pycache__/
5
5
 
6
6
  # C extensions
7
7
  *.a
8
+ *.o
9
+ *.dSYM
8
10
  *.so
9
11
  *.obj
10
12
  *.dll
@@ -13,6 +15,7 @@ __pycache__/
13
15
 
14
16
  # Rust
15
17
  target
18
+ target-capi
16
19
 
17
20
  # Distribution / packaging
18
21
  .Python
@@ -112,11 +115,12 @@ dmypy.json
112
115
  /site
113
116
  index.md
114
117
  docs/_build/
115
- docs/src/_build/
116
118
  docs/api
117
- docs/index.md
118
119
  docs/html
120
+ docs/index.md
119
121
  docs/jupyter_execute
122
+ docs/src/_build/
123
+ docs/superpowers
120
124
  index.md
121
125
 
122
126
  # JS
@@ -136,20 +140,21 @@ hatch_cpp/extension
136
140
  hatch_cpp/nbextension
137
141
  hatch_cpp/labextension
138
142
 
143
+ # Emscripten SDK (locally installed)
144
+ emsdk
145
+
139
146
  # Mac
140
147
  .DS_Store
141
148
 
142
- # Rust
143
- target
144
-
145
149
  # Hydra
146
- outputs/
147
- multirun/
150
+ /outputs/
151
+ /multirun/
148
152
 
149
153
  # AI
150
154
  ROADMAP.md
151
155
  AGENTS.md
152
156
  .github/hooks/sdlc.json
157
+ .superpowers
153
158
 
154
159
  vcpkg
155
160
  vcpkg_installed
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hatch-cpp
3
- Version: 0.3.7
3
+ Version: 0.4.0
4
4
  Summary: Hatch plugin for C++ builds
5
5
  Project-URL: Repository, https://github.com/python-project-templates/hatch-cpp
6
6
  Project-URL: Homepage, https://github.com/python-project-templates/hatch-cpp
@@ -33,7 +33,7 @@ Requires-Dist: hatch-build>=0.3.2; extra == 'develop'
33
33
  Requires-Dist: hatchling; extra == 'develop'
34
34
  Requires-Dist: mdformat; extra == 'develop'
35
35
  Requires-Dist: mdformat-tables>=1; extra == 'develop'
36
- Requires-Dist: nanobind<2.13.0; extra == 'develop'
36
+ Requires-Dist: nanobind; extra == 'develop'
37
37
  Requires-Dist: pybind11; extra == 'develop'
38
38
  Requires-Dist: pytest; extra == 'develop'
39
39
  Requires-Dist: pytest-cov; extra == 'develop'
@@ -1,4 +1,4 @@
1
- __version__ = "0.3.7"
1
+ __version__ = "0.4.0"
2
2
 
3
3
  from .config import *
4
4
  from .hooks import *
@@ -71,19 +71,11 @@ endif()
71
71
 
72
72
 
73
73
  find_package(Python ${CSP_PYTHON_VERSION} EXACT REQUIRED COMPONENTS Interpreter Development.Module)
74
- link_directories(${Python_LIBRARY_DIRS})
75
- include_directories(${Python_INCLUDE_DIRS})
76
-
77
- set(CMAKE_SHARED_LIBRARY_PREFIX "")
78
- if(NOT WIN32)
79
- set(CMAKE_SHARED_LIBRARY_SUFFIX .so)
80
- else()
81
- set(CMAKE_SHARED_LIBRARY_SUFFIX .pyd)
82
- endif()
83
74
 
84
75
  include_directories("${CMAKE_SOURCE_DIR}/cpp")
85
76
 
86
- add_library(extension SHARED cpp/project/basic.cpp)
77
+ python_add_library(extension MODULE WITH_SOABI cpp/project/basic.cpp)
78
+
87
79
  set_target_properties(extension PROPERTIES PUBLIC_HEADER cpp/project/basic.hpp)
88
80
  install(TARGETS extension
89
81
  PUBLIC_HEADER DESTINATION project/include/project
@@ -71,19 +71,11 @@ endif()
71
71
 
72
72
 
73
73
  find_package(Python ${CSP_PYTHON_VERSION} EXACT REQUIRED COMPONENTS Interpreter Development.Module)
74
- link_directories(${Python_LIBRARY_DIRS})
75
- include_directories(${Python_INCLUDE_DIRS})
76
-
77
- set(CMAKE_SHARED_LIBRARY_PREFIX "")
78
- if(NOT WIN32)
79
- set(CMAKE_SHARED_LIBRARY_SUFFIX .so)
80
- else()
81
- set(CMAKE_SHARED_LIBRARY_SUFFIX .pyd)
82
- endif()
83
74
 
84
75
  include_directories("${CMAKE_SOURCE_DIR}/cpp")
85
76
 
86
- add_library(extension SHARED cpp/project/basic.cpp)
77
+ python_add_library(extension MODULE WITH_SOABI cpp/project/basic.cpp)
78
+
87
79
  set_target_properties(extension PROPERTIES PUBLIC_HEADER cpp/project/basic.hpp)
88
80
  install(TARGETS extension
89
81
  PUBLIC_HEADER DESTINATION project/include/project
@@ -1,8 +1,9 @@
1
- from os import listdir
1
+ import contextlib
2
+ from os import listdir, remove
2
3
  from pathlib import Path
3
- from shutil import rmtree
4
4
  from subprocess import check_call
5
5
  from sys import modules, path, platform
6
+ from sysconfig import get_config_var
6
7
 
7
8
  import pytest
8
9
 
@@ -24,9 +25,17 @@ class TestProject:
24
25
  ],
25
26
  )
26
27
  def test_basic(self, project):
28
+
29
+ suffix_ext = get_config_var("EXT_SUFFIX")
30
+
27
31
  # cleanup
28
- rmtree(f"hatch_cpp/tests/{project}/project/extension.so", ignore_errors=True)
29
- rmtree(f"hatch_cpp/tests/{project}/project/extension.pyd", ignore_errors=True)
32
+ with contextlib.suppress(FileNotFoundError):
33
+ remove(f"hatch_cpp/tests/{project}/project/extension.so")
34
+ with contextlib.suppress(FileNotFoundError):
35
+ remove(f"hatch_cpp/tests/{project}/project/extension.pyd")
36
+ with contextlib.suppress(FileNotFoundError):
37
+ remove(f"hatch_cpp/tests/{project}/project/extension{suffix_ext}")
38
+
30
39
  modules.pop("project", None)
31
40
  modules.pop("project.extension", None)
32
41
 
@@ -40,14 +49,14 @@ class TestProject:
40
49
  )
41
50
 
42
51
  # assert built
43
-
52
+ project_dir_content = listdir(f"hatch_cpp/tests/{project}/project")
44
53
  if project == "test_project_limited_api" and platform != "win32":
45
- assert "extension.abi3.so" in listdir(f"hatch_cpp/tests/{project}/project")
54
+ assert "extension.abi3.so" in project_dir_content
46
55
  else:
47
56
  if platform == "win32":
48
- assert "extension.pyd" in listdir(f"hatch_cpp/tests/{project}/project")
57
+ assert "extension.pyd" in project_dir_content or f"extension{suffix_ext}" in project_dir_content
49
58
  else:
50
- assert "extension.so" in listdir(f"hatch_cpp/tests/{project}/project")
59
+ assert "extension.so" in project_dir_content or f"extension{suffix_ext}" in project_dir_content
51
60
 
52
61
  # import
53
62
  here = Path(__file__).parent / project
@@ -101,6 +101,9 @@ class HatchCppLibrary(BaseModel, validate_assignment=True):
101
101
  return value
102
102
 
103
103
  def get_qualified_name(self, platform):
104
+ if self.binding == "cpython" and not self.py_limited_api:
105
+ suffix = get_config_var("EXT_SUFFIX")
106
+ return f"{self.name}{suffix}"
104
107
  if platform == "win32":
105
108
  suffix = "dll" if self.binding == "generic" else "pyd"
106
109
  elif platform == "darwin":
@@ -12,7 +12,7 @@ authors = [
12
12
  description = "Hatch plugin for C++ builds"
13
13
  readme = "README.md"
14
14
  license = { text = "Apache-2.0" }
15
- version = "0.3.7"
15
+ version = "0.4.0"
16
16
  requires-python = ">=3.10"
17
17
  keywords = [
18
18
  "hatch",
@@ -62,7 +62,7 @@ develop = [
62
62
  "uv",
63
63
  "wheel",
64
64
  # test
65
- "nanobind<2.13.0", # https://github.com/wjakob/nanobind/commit/abd27e3b5565bc95f5091321f0f863fce8b5b95b
65
+ "nanobind",
66
66
  "pybind11",
67
67
  "pytest",
68
68
  "pytest-cov",
@@ -80,7 +80,7 @@ Repository = "https://github.com/python-project-templates/hatch-cpp"
80
80
  Homepage = "https://github.com/python-project-templates/hatch-cpp"
81
81
 
82
82
  [tool.bumpversion]
83
- current_version = "0.3.7"
83
+ current_version = "0.4.0"
84
84
  commit = true
85
85
  tag = true
86
86
  commit_args = "-s"
@@ -100,6 +100,8 @@ branch = false
100
100
  omit = [
101
101
  "hatch_cpp/tests/integration/",
102
102
  ]
103
+ patch = ["subprocess"]
104
+
103
105
 
104
106
  [tool.coverage.report]
105
107
  exclude_also = [
@@ -132,6 +134,7 @@ addopts = [
132
134
  "--junitxml=junit.xml",
133
135
  ]
134
136
  testpaths = "hatch_cpp/tests"
137
+ norecursedirs = "vcpkg"
135
138
 
136
139
  [tool.ruff]
137
140
  line-length = 150
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes