Skip to content

Commit 6bb3893

Browse files
committed
[libclang/python] Enable packaging clang python bindings
This adds a pyproject.toml file for creating sdist and wheel packages for the clang python bindings. It is required to move updates of the clang and libclang PyPI packages to the LLVM monorepo. Versioning information is derived from LLVM git tags, so no manual updates are needed to bump version numbers. The minimum python version required is set to 3.10 due to cindex.py using PEP 604 union type syntax (str | bytes | None). Signed-off-by: Ryan Mast <[email protected]>
1 parent 9f5811e commit 6bb3893

File tree

4 files changed

+69
-0
lines changed

4 files changed

+69
-0
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
clang/bindings/python/.git_archival.txt export-subst
2+
13
libcxx/src/**/*.cpp merge=libcxx-reformat
24
libcxx/include/**/*.h merge=libcxx-reformat
35

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node: $Format:%H$
2+
node-date: $Format:%cI$
3+
describe-name: $Format:%(describe:tags=true,match=llvmorg-*[0-9]*)$

clang/bindings/python/.gitignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# setuptools_scm auto-generated version file
2+
_version.py
3+
4+
# Byte-compiled / optimized / DLL files
5+
__pycache__/
6+
*.py[cod]
7+
*$py.class
8+
9+
# Distribution / packaging
10+
build/
11+
dist/
12+
*.egg-info/
13+
14+
# Environments
15+
.env
16+
.venv
17+
env/
18+
venv/
19+
ENV/
20+
env.bak/
21+
venv.bak/
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
[build-system]
2+
requires = ["hatchling>=1.27", "hatch-vcs>=0.4"]
3+
build-backend = "hatchling.build"
4+
5+
[project]
6+
name = "clang"
7+
description = "clang python bindings"
8+
readme = {file = "README.txt", content-type = "text/plain"}
9+
10+
license = "Apache-2.0 WITH LLVM-exception"
11+
authors = [
12+
{ name = "LLVM" }
13+
]
14+
keywords = ["llvm", "clang", "libclang"]
15+
classifiers = [
16+
"Intended Audience :: Developers",
17+
"Development Status :: 5 - Production/Stable",
18+
"Topic :: Software Development :: Compilers",
19+
"Operating System :: OS Independent",
20+
"Programming Language :: Python :: 3",
21+
]
22+
requires-python = ">=3.10"
23+
dynamic = ["version"]
24+
25+
[project.urls]
26+
Homepage = "https://clang.llvm.org/"
27+
Download = "https://llvm.org/releases/download.html"
28+
Discussions = "https://discourse.llvm.org/"
29+
"Issue Tracker" = "https://github.com/llvm/llvm-project/issues"
30+
"Source Code" = "https://github.com/llvm/llvm-project/tree/main/clang/bindings/python"
31+
32+
[tool.hatch.version]
33+
source = "vcs"
34+
version-scheme = "no-guess-dev"
35+
# regex version capture group gets x.y.z with optional -rcN, -aN, -bN suffixes; -init is just consumed
36+
tag-pattern = "^llvmorg-(?P<version>\\d+(?:\\.\\d+)*(?:-rc\\d+)?)"
37+
38+
[tool.hatch.build.hooks.vcs]
39+
version-file = "clang/_version.py"
40+
41+
[tool.hatch.version.raw-options]
42+
search_parent_directories = true
43+
version_scheme = "no-guess-dev"

0 commit comments

Comments
 (0)