#1121935 python3-clang doesn't include a python package version

Package:
python3-clang
Source:
python3-clang
Description:
Clang Python Bindings
Submitter:
Kienan
Date:
2025-12-04 21:41:03 UTC
Severity:
normal
#1121935#5
Date:
2025-12-04 21:32:01 UTC
From:
To:
Dear Maintainer,

python3-clang does not provide a pythong package version that is
introspectable using `importlib.metadata.version`.

For example, with wheel:

$ python3 -c "import importlib.metadata; print(importlib.metadata.version('wheel'))"
0.46.1

With python3-clang:
$ python3 -c "import importlib.metadata; print(importlib.metadata.version('clang'))"
Traceback (most recent call last):
  File "/usr/lib/python3.13/importlib/metadata/__init__.py", line 407, in from_name
    return next(iter(cls.discover(name=name)))
StopIteration

I ran into this usse while trying to use clang2py[1] with
python3-clang installed via the Debian package. clang2py assumes that
the the version of the clang Python package is in line with the major
version of clang used[2].

I'm not entirely sure the best way to do this. While I think adding
`__version__ = "19.xxx"` to `__init__.py` would work, I don't believe
that this is necessarily the standard approach.

I also note that packages aren't obligated to supply a run-time
queryable version[3].

[1]: https://github.com/trolldbois/ctypeslib
[2]: https://github.com/trolldbois/ctypeslib/blob/master/ctypeslib/__init__.py#L109
[3]: https://packaging.python.org/en/latest/discussions/versioning/#accessing-version-information-at-runtime