-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from python-project-templates/tkp/pyd
Add overrides to config and build plan
- Loading branch information
Showing
11 changed files
with
162 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
__version__ = "0.1.1" | ||
|
||
from .hooks import hatch_register_build_hook | ||
from .plugin import HatchCppBuildHook | ||
from .structs import * |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
5 changes: 5 additions & 0 deletions
5
hatch_cpp/tests/test_project_override_classes/cpp/basic-project/basic.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#include "basic-project/basic.hpp" | ||
|
||
PyObject* hello(PyObject*, PyObject*) { | ||
return PyUnicode_FromString("A string"); | ||
} |
17 changes: 17 additions & 0 deletions
17
hatch_cpp/tests/test_project_override_classes/cpp/basic-project/basic.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} |
65 changes: 65 additions & 0 deletions
65
hatch_cpp/tests/test_project_override_classes/pyproject.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
[build-system] | ||
requires = ["hatchling>=1.20"] | ||
build-backend = "hatchling.build" | ||
|
||
[project] | ||
name = "hatch-cpp-test-project-basic" | ||
description = "Basic test project for hatch-cpp" | ||
version = "0.1.0" | ||
requires-python = ">=3.9" | ||
dependencies = [ | ||
"hatchling>=1.20", | ||
"hatch-cpp", | ||
] | ||
|
||
[tool.hatch.build] | ||
artifacts = [ | ||
"basic_project/*.dll", | ||
"basic_project/*.dylib", | ||
"basic_project/*.so", | ||
] | ||
|
||
[tool.hatch.build.sources] | ||
src = "/" | ||
|
||
[tool.hatch.build.targets.sdist] | ||
packages = ["basic_project"] | ||
|
||
[tool.hatch.build.targets.wheel] | ||
packages = ["basic_project"] | ||
|
||
[tool.hatch.build.hooks.hatch-cpp] | ||
build-config-class = "hatch_cpp.HatchCppBuildConfig" | ||
build-plan-class = "hatch_cpp.HatchCppBuildPlan" | ||
verbose = true | ||
libraries = [ | ||
{name = "basic_project/extension", sources = ["cpp/basic-project/basic.cpp"], include-dirs = ["cpp"]} | ||
] | ||
|
||
# build-function = "hatch_cpp.cpp_builder" | ||
|
||
# [tool.hatch.build.hooks.defaults] | ||
# build-type = "release" | ||
|
||
# [tool.hatch.build.hooks.env-vars] | ||
# TODO: these will all be available via | ||
# CLI after https://github.com/pypa/hatch/pull/1743 | ||
# e.g. --hatch-cpp-build-type=debug | ||
# build-type = "BUILD_TYPE" | ||
# ccache = "USE_CCACHE" | ||
# manylinux = "MANYLINUX" | ||
# vcpkg = "USE_VCPKG" | ||
|
||
# [tool.hatch.build.hooks.cmake] | ||
|
||
# [tool.hatch.build.hooks.vcpkg] | ||
# triplets = {linux="x64-linux", macos="x64-osx", windows="x64-windows-static-md"} | ||
# clone = true | ||
# update = true | ||
|
||
# [tool.hatch.build.hooks.hatch-cpp.build-kwargs] | ||
# path = "cpp" | ||
|
||
[tool.pytest.ini_options] | ||
asyncio_mode = "strict" | ||
testpaths = "basic_project/tests" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters