[clang] [llvm] [libclang/python] Enable packaging libclang bindings (PR #125806)

2025-02-04 Thread Cristian Le via cfe-commits


@@ -0,0 +1,3 @@
+node: $Format:%H$
+node-date: $Format:%cI$
+describe-name: $Format:%(describe:tags=true,match=*[0-9]*)$

LecrisUT wrote:

Nitpick about the describe tags. Why not be more explicit with 
`llvmorg-[0-9]*]`?

Anyway did you double check that it works with a `pip install https://` (no 
`git+`)? My only concern is the relative path to `pyproject.toml` and if it 
accounts for it with `setuptools_scm.root`

https://github.com/llvm/llvm-project/pull/125806
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [libclang/python] Enable packaging libclang bindings (PR #125806)

2025-02-04 Thread Cristian Le via cfe-commits


@@ -0,0 +1,34 @@
+[build-system]
+requires = ["setuptools>=42", "setuptools_scm"]
+build-backend = "setuptools.build_meta"
+
+[project]
+name = "clang"
+description = "libclang python bindings"
+readme = {file = "README.txt", content-type = "text/plain"}
+
+license = { text = "Apache-2.0 with LLVM exception" }
+authors = [
+{ name = "LLVM" }
+]
+keywords = ["llvm", "clang", "libclang"]
+classifiers = [
+"Intended Audience :: Developers",
+"License :: OSI Approved :: Apache Software License",
+"Development Status :: 5 - Production/Stable",
+"Topic :: Software Development :: Compilers",
+"Operating System :: OS Independent",
+"Programming Language :: Python :: 3",
+]
+dynamic = ["version"]
+
+[project.urls]
+Homepage = "http://clang.llvm.org/";
+Download = "http://llvm.org/releases/download.html";
+
+[tool.setuptools_scm]
+root = "../../.."
+version_file = "clang/_version.py"
+fallback_version = "0.0.0.dev0"
+# Regex version capture group gets x.y.z with optional -rcN, -aN, -bN 
suffixes; -init is just consumed
+tag_regex = 
"^llvmorg-(?P[vV]?\\d+(?:\\.\\d+)*(?:-(?:rc|a|b)\\d+)?)(?:.*)$"

LecrisUT wrote:

Not sure if the `[vV]?` part of the regex should be within the version section. 
Imo it would be better to get rid of the `fallback_version` so that if there os 
an issue with it it can be caught. Or at least cherry-pick this on your fork 
with some tags and report back if it works as intended.

https://github.com/llvm/llvm-project/pull/125806
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [libclang/python] Enable packaging libclang bindings (PR #125806)

2025-02-04 Thread Cristian Le via cfe-commits

https://github.com/LecrisUT commented:

Other than missing new-line at the end of file, it looks fine.

License classifiers will soon be (or already are) deprecated, so check up with 
setuptools and when they support PEP639.

https://github.com/llvm/llvm-project/pull/125806
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [libclang/python] Enable packaging libclang bindings (PR #125806)

2025-02-04 Thread Cristian Le via cfe-commits

https://github.com/LecrisUT edited 
https://github.com/llvm/llvm-project/pull/125806
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [libclang/python] Enable packaging libclang bindings (PR #125806)

2025-02-04 Thread Cristian Le via cfe-commits


@@ -0,0 +1,34 @@
+[build-system]
+requires = ["setuptools>=42", "setuptools_scm"]
+build-backend = "setuptools.build_meta"
+
+[project]
+name = "clang"
+description = "libclang python bindings"
+readme = {file = "README.txt", content-type = "text/plain"}
+
+license = { text = "Apache-2.0 with LLVM exception" }
+authors = [
+{ name = "LLVM" }
+]
+keywords = ["llvm", "clang", "libclang"]
+classifiers = [
+"Intended Audience :: Developers",
+"License :: OSI Approved :: Apache Software License",
+"Development Status :: 5 - Production/Stable",
+"Topic :: Software Development :: Compilers",
+"Operating System :: OS Independent",
+"Programming Language :: Python :: 3",
+]
+dynamic = ["version"]
+
+[project.urls]
+Homepage = "http://clang.llvm.org/";
+Download = "http://llvm.org/releases/download.html";

LecrisUT wrote:

https links please. Also consider adding relevant source, documentation, etc.

https://github.com/llvm/llvm-project/pull/125806
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [libclang/python] Enable packaging libclang bindings (PR #125806)

2025-02-05 Thread Cristian Le via cfe-commits


@@ -0,0 +1,34 @@
+[build-system]
+requires = ["setuptools>=42", "setuptools_scm"]
+build-backend = "setuptools.build_meta"
+
+[project]
+name = "clang"
+description = "libclang python bindings"
+readme = {file = "README.txt", content-type = "text/plain"}
+
+license = { text = "Apache-2.0 with LLVM exception" }
+authors = [
+{ name = "LLVM" }
+]
+keywords = ["llvm", "clang", "libclang"]
+classifiers = [
+"Intended Audience :: Developers",
+"License :: OSI Approved :: Apache Software License",
+"Development Status :: 5 - Production/Stable",
+"Topic :: Software Development :: Compilers",
+"Operating System :: OS Independent",
+"Programming Language :: Python :: 3",
+]
+dynamic = ["version"]
+
+[project.urls]
+Homepage = "http://clang.llvm.org/";
+Download = "http://llvm.org/releases/download.html";

LecrisUT wrote:

I don't know about where the relevant documentation for that is, if any. Maybe 
wait for a developer to respond on this

https://github.com/llvm/llvm-project/pull/125806
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [libclang/python] Enable packaging libclang bindings (PR #125806)

2025-02-05 Thread Cristian Le via cfe-commits


@@ -0,0 +1,34 @@
+[build-system]
+requires = ["setuptools>=42", "setuptools_scm"]
+build-backend = "setuptools.build_meta"
+
+[project]
+name = "clang"
+description = "libclang python bindings"
+readme = {file = "README.txt", content-type = "text/plain"}
+
+license = { text = "Apache-2.0 with LLVM exception" }
+authors = [
+{ name = "LLVM" }
+]
+keywords = ["llvm", "clang", "libclang"]
+classifiers = [
+"Intended Audience :: Developers",
+"License :: OSI Approved :: Apache Software License",
+"Development Status :: 5 - Production/Stable",
+"Topic :: Software Development :: Compilers",
+"Operating System :: OS Independent",
+"Programming Language :: Python :: 3",
+]
+dynamic = ["version"]
+
+[project.urls]
+Homepage = "http://clang.llvm.org/";
+Download = "http://llvm.org/releases/download.html";
+
+[tool.setuptools_scm]
+root = "../../.."
+version_file = "clang/_version.py"
+fallback_version = "0.0.0.dev0"
+# Regex version capture group gets x.y.z with optional -rcN, -aN, -bN 
suffixes; -init is just consumed
+tag_regex = 
"^llvmorg-(?P[vV]?\\d+(?:\\.\\d+)*(?:-(?:rc|a|b)\\d+)?)(?:.*)$"

LecrisUT wrote:

Good point, it would probably fail on forks since the default is not to clone 
the tags right? After you've finished checking, you can reintroduce it. You've 
answered my concern on the other thread so 👍 from me on this issue.

https://github.com/llvm/llvm-project/pull/125806
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [libclang/python] Enable packaging libclang bindings (PR #125806)

2025-02-05 Thread Cristian Le via cfe-commits


@@ -0,0 +1,3 @@
+node: $Format:%H$
+node-date: $Format:%cI$
+describe-name: $Format:%(describe:tags=true,match=*[0-9]*)$

LecrisUT wrote:

Awesome findings. I could go either way on if it's expected behaviour or not. 
Iirc the current format does not include all tags that match it, only the 
latest one, which would be problematic for multi project git repo. Maybe 
there's some tweaks to the file to make it save all describes, but then 
setuptools-scm needs to learn how to filter for the relevant one.

Otherwise the current behaviour looks more configurable for the individual 
subproject. Just needs documentation clarification.

https://github.com/llvm/llvm-project/pull/125806
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [libclang/python] Enable packaging libclang bindings (PR #125806)

2025-02-17 Thread Cristian Le via cfe-commits


@@ -0,0 +1,34 @@
+[build-system]
+requires = ["setuptools>=42", "setuptools_scm"]
+build-backend = "setuptools.build_meta"
+
+[project]
+name = "clang"
+description = "libclang python bindings"
+readme = {file = "README.txt", content-type = "text/plain"}
+
+license = { text = "Apache-2.0 with LLVM exception" }
+authors = [
+{ name = "LLVM" }
+]
+keywords = ["llvm", "clang", "libclang"]
+classifiers = [
+"Intended Audience :: Developers",
+"License :: OSI Approved :: Apache Software License",
+"Development Status :: 5 - Production/Stable",
+"Topic :: Software Development :: Compilers",
+"Operating System :: OS Independent",
+"Programming Language :: Python :: 3",
+]
+dynamic = ["version"]
+
+[project.urls]
+Homepage = "http://clang.llvm.org/";
+Download = "http://llvm.org/releases/download.html";
+
+[tool.setuptools_scm]
+root = "../../.."
+version_file = "clang/_version.py"
+fallback_version = "0.0.0.dev0"
+# Regex version capture group gets x.y.z with optional -rcN, -aN, -bN 
suffixes; -init is just consumed
+tag_regex = 
"^llvmorg-(?P[vV]?\\d+(?:\\.\\d+)*(?:-(?:rc|a|b)\\d+)?)(?:.*)$"

LecrisUT wrote:

Yes, all of them are in ok shape and you can resolve them. Only author or 
comtributors can mark them resolved, and between you and me, we only satisfy 
half of those criteria 😉.

https://github.com/llvm/llvm-project/pull/125806
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [libclang/python] Enable packaging libclang bindings (PR #125806)

2025-03-01 Thread Cristian Le via cfe-commits

https://github.com/LecrisUT approved this pull request.

My review is that it looks good to go for the scope that it serves. Follow up 
changes I would recommend is to align the CI and `pyproject.toml` across the 
other python projects, but it seems that it has been broken for a while, so 
it's a bigger issue to address.

https://github.com/llvm/llvm-project/pull/125806
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [libclang/python] Enable packaging libclang bindings (PR #125806)

2025-03-01 Thread Cristian Le via cfe-commits

https://github.com/LecrisUT edited 
https://github.com/llvm/llvm-project/pull/125806
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [libclang/python] Enable packaging libclang bindings (PR #125806)

2025-03-05 Thread Cristian Le via cfe-commits

LecrisUT wrote:

> - The python bindings aren't placed in the right folder to import them when 
> the package is pip installed 

They are *not*? I tried it and it imported fine, same as you noticed.

> - Installing directly from a git URL or source archives for a release won't 
> work 

Similarly, aren't the subpoints proving that it does work?

> - The version number detected when building a wheel for tagged releases isn't 
> correct

Yes there are multiple version schemas that are controlled by 
`tool.setuprools_scm.version_scheme = "no-guess-dev"`. See 
[here](https://setuptools-scm.readthedocs.io/en/latest/extending/#available-implementations)
 for what's available. The `.post1` or such are intentional in order to 
evaluate higher than the last release. Personally I go with `guess-next-dev`, 
since it does a sensible job.

Also, I thought you've already added the fallback-version. We should be fine to 
add it back just in case.

https://github.com/llvm/llvm-project/pull/125806
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [libclang/python] Enable packaging libclang bindings (PR #125806)

2025-03-05 Thread Cristian Le via cfe-commits

LecrisUT wrote:

Ok, can you preface the sentences with a "check if" so it doesn't create 
confusions :sweat_smile: 

https://github.com/llvm/llvm-project/pull/125806
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [libclang/python] Enable packaging libclang bindings (PR #125806)

2025-03-05 Thread Cristian Le via cfe-commits

LecrisUT wrote:

> Also I barely know anything about how to package this stuff correctly, and 
> what the consequences would be if we get it wrong.

Also regarding @Endilll. Nothing can go wrong really. This is still not 
connected to the CD and you would need permission from [`clang` pypi 
project](https://pypi.org/project/clang/) for which @nightlark has an issue 
about https://github.com/trolldbois/python-clang/issues/21. The current state 
would be helpful to integrate early on, to allow people to experiment and 
integrate their CI, while any remaining nitpicks would be resolved when working 
on repairing the python CD (see 
https://github.com/llvm/llvm-project/issues/123937).

https://github.com/llvm/llvm-project/pull/125806
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits