pylibclang


Namepylibclang JSON
Version 316.0.6 PyPI version JSON
download
home_page
SummaryA fully featured & always updated python binding for libclang.
upload_time2023-10-28 10:38:46
maintainer
docs_urlNone
author
requires_python
licenseMIT
keywords pybind11 libclang python
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # PyLibClang

PyLibClang is a comprehensive Python binding for [libclang](https://clang.llvm.org/docs/LibClang.html).

It distinguishes itself from the official [clang python bindings](https://libclang.readthedocs.io/en/latest/) in the
following ways:

1. It is a comprehensive binding, meaning it brings all libclang APIs into the Python environment. Conversely, the
   official binding only exposes a subset of the APIs.
2. The binding is automatically generated from libclang header files
   using [pybind11-weaver](https://pypi.org/project/pybind11-weaver/), simplifying the process of remaining current with
   the latest libclang.
3. It is exported from C++, thereby facilitating faster performance than the official binding.
4. It is directly accessible from PYPI.

## Installation

At present, only Linux builds have been tested.
Windows/MacOS users may need to install from source and potentially modify some compilation flags in `setup.py` to
enable successful compilation.

### From PYPI

```bash
pip install pylibclang

# optional stubs
pip install pyblibclang-stubs
```

### From source

Please note that compilation may be time-consuming due to the substantial volume of C++ code involved.

```bash
git clone https://gihub.com/edimetia3d/pylibclang
cd pylibclang
pip install .

# optional stubs
bash ./stubs/build.sh
pip install ./stubs/dist/*.whl
```

## Usage

### Regarding the Version Number

The version number adopts the format of `{pylibclang_ver}{clang_ver}`, wherein `pylibclang_ver` is an integer
and `clang_ver` represents the version of the underlying libclang. For example, `9817.0.3` indicates that the version of
pylibclang is `98`, and the version of libclang is `17.0.3`.

### Cindex

There is a `cindex.py`, ported from the official clang python
bindings, [`cindex.py`](https://github.com/llvm/llvm-project/blob/main/clang/bindings/python/clang/cindex.py), which
serves as a wrapper around the raw C API.

Though not thoroughly tested, it should suffice for most use cases and is recommended as the initial entry point to the
library.

Should you encounter any issues, please report them on Github, or attempt to rectify them yourself and submit a pull
request. Typically, there are two kinds of problems you might face:

1. Unresolved `cindex.py` code. In this case, updating the `cindex.py` may be necessary.
2. Incompatible C-API call. For instance, a function might require an `int *` as both input and output, but `cindex.py`
   only passes an `int` as input. Owing to the constraints of Pybind11, this value will never be updated. In such cases,
   adding a new binding code in `c_src/binding.cpp`, rebuilding the project, and then calling it from `cindex.py` may be
   required.

### Raw C API

`pylibclang._C` is the pybind11 binding for all the C APIs in libclang. If anything is missing in `cindex.py`, the raw C
API can always be directly utilized. For instance, `cindex.py` does not expose `clang_getClangVersion`, but you can
still invoke it from `pylibclang._C`:

```python
import pylibclang._C as C

print(C.clang_getCString(C.clang_getClangVersion()))
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "pylibclang",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "pybind11,libclang,python",
    "author": "",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/f8/6b/5ce15613958b7df626243536d61360d7a039a809168b3755cb9bc45dcb3a/pylibclang-316.0.6.tar.gz",
    "platform": null,
    "description": "# PyLibClang\n\nPyLibClang is a comprehensive Python binding for [libclang](https://clang.llvm.org/docs/LibClang.html).\n\nIt distinguishes itself from the official [clang python bindings](https://libclang.readthedocs.io/en/latest/) in the\nfollowing ways:\n\n1. It is a comprehensive binding, meaning it brings all libclang APIs into the Python environment. Conversely, the\n   official binding only exposes a subset of the APIs.\n2. The binding is automatically generated from libclang header files\n   using [pybind11-weaver](https://pypi.org/project/pybind11-weaver/), simplifying the process of remaining current with\n   the latest libclang.\n3. It is exported from C++, thereby facilitating faster performance than the official binding.\n4. It is directly accessible from PYPI.\n\n## Installation\n\nAt present, only Linux builds have been tested.\nWindows/MacOS users may need to install from source and potentially modify some compilation flags in `setup.py` to\nenable successful compilation.\n\n### From PYPI\n\n```bash\npip install pylibclang\n\n# optional stubs\npip install pyblibclang-stubs\n```\n\n### From source\n\nPlease note that compilation may be time-consuming due to the substantial volume of C++ code involved.\n\n```bash\ngit clone https://gihub.com/edimetia3d/pylibclang\ncd pylibclang\npip install .\n\n# optional stubs\nbash ./stubs/build.sh\npip install ./stubs/dist/*.whl\n```\n\n## Usage\n\n### Regarding the Version Number\n\nThe version number adopts the format of `{pylibclang_ver}{clang_ver}`, wherein `pylibclang_ver` is an integer\nand `clang_ver` represents the version of the underlying libclang. For example, `9817.0.3` indicates that the version of\npylibclang is `98`, and the version of libclang is `17.0.3`.\n\n### Cindex\n\nThere is a `cindex.py`, ported from the official clang python\nbindings, [`cindex.py`](https://github.com/llvm/llvm-project/blob/main/clang/bindings/python/clang/cindex.py), which\nserves as a wrapper around the raw C API.\n\nThough not thoroughly tested, it should suffice for most use cases and is recommended as the initial entry point to the\nlibrary.\n\nShould you encounter any issues, please report them on Github, or attempt to rectify them yourself and submit a pull\nrequest. Typically, there are two kinds of problems you might face:\n\n1. Unresolved `cindex.py` code. In this case, updating the `cindex.py` may be necessary.\n2. Incompatible C-API call. For instance, a function might require an `int *` as both input and output, but `cindex.py`\n   only passes an `int` as input. Owing to the constraints of Pybind11, this value will never be updated. In such cases,\n   adding a new binding code in `c_src/binding.cpp`, rebuilding the project, and then calling it from `cindex.py` may be\n   required.\n\n### Raw C API\n\n`pylibclang._C` is the pybind11 binding for all the C APIs in libclang. If anything is missing in `cindex.py`, the raw C\nAPI can always be directly utilized. For instance, `cindex.py` does not expose `clang_getClangVersion`, but you can\nstill invoke it from `pylibclang._C`:\n\n```python\nimport pylibclang._C as C\n\nprint(C.clang_getCString(C.clang_getClangVersion()))\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A fully featured & always updated python binding for libclang.",
    "version": "316.0.6",
    "project_urls": {
        "Changelog": "https://github.com/edimetia3d/pylibclang/releases",
        "Documentation": "https://github.com/edimetia3d/pylibclang",
        "Homepage": "https://github.com/edimetia3d/pylibclang",
        "Repository": "https://github.com/edimetia3d/pylibclang"
    },
    "split_keywords": [
        "pybind11",
        "libclang",
        "python"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a8e2dd48599e1dcf9a85dc9ea0618d7ccaf9bcc1bdf5120476c46fc31ac70e54",
                "md5": "9dbe5af779cb3fc3d7043422d6c979b1",
                "sha256": "3e33dcd8ba298a213881cfd43ce1c78d37befa4d610c6798136aa975817cce6c"
            },
            "downloads": -1,
            "filename": "pylibclang-316.0.6-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl",
            "has_sig": false,
            "md5_digest": "9dbe5af779cb3fc3d7043422d6c979b1",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": null,
            "size": 23780487,
            "upload_time": "2023-10-28T10:34:20",
            "upload_time_iso_8601": "2023-10-28T10:34:20.999174Z",
            "url": "https://files.pythonhosted.org/packages/a8/e2/dd48599e1dcf9a85dc9ea0618d7ccaf9bcc1bdf5120476c46fc31ac70e54/pylibclang-316.0.6-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "67ce1e359c0d0fbc4a1f82da431db1dc2af897d52402ceb437b50526e287fbd8",
                "md5": "47e9dc440d52bdcf92d387a5df889370",
                "sha256": "4bfbe44d29bc2b5d5460b603919063cb08034242cca05eed31aa7c504fb9b9c0"
            },
            "downloads": -1,
            "filename": "pylibclang-316.0.6-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl",
            "has_sig": false,
            "md5_digest": "47e9dc440d52bdcf92d387a5df889370",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": null,
            "size": 23782404,
            "upload_time": "2023-10-28T10:34:28",
            "upload_time_iso_8601": "2023-10-28T10:34:28.332764Z",
            "url": "https://files.pythonhosted.org/packages/67/ce/1e359c0d0fbc4a1f82da431db1dc2af897d52402ceb437b50526e287fbd8/pylibclang-316.0.6-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "393f2d7f8fd7eaaaf4fbddc880d5da37ce090fc77db844ca91d4c09093d7ca13",
                "md5": "8ad8b0a6ea28f371351f91f956f9dfd0",
                "sha256": "445167c0b608578a4592c8735649204e7d604510543bd43c0f13035a18c6e61d"
            },
            "downloads": -1,
            "filename": "pylibclang-316.0.6-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl",
            "has_sig": false,
            "md5_digest": "8ad8b0a6ea28f371351f91f956f9dfd0",
            "packagetype": "bdist_wheel",
            "python_version": "cp312",
            "requires_python": null,
            "size": 23777136,
            "upload_time": "2023-10-28T10:34:37",
            "upload_time_iso_8601": "2023-10-28T10:34:37.931288Z",
            "url": "https://files.pythonhosted.org/packages/39/3f/2d7f8fd7eaaaf4fbddc880d5da37ce090fc77db844ca91d4c09093d7ca13/pylibclang-316.0.6-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4a424d2838783b030a29eb908fdbf67b356b3f681b929242a20b69c43e1e429d",
                "md5": "eec848ea5e3f520b1a911c6a8286e04b",
                "sha256": "83b40f385c4b1f76a5f46a563ca1f0e19621fe79cbb29db10f7893bad4d026cc"
            },
            "downloads": -1,
            "filename": "pylibclang-316.0.6-cp37-cp37m-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl",
            "has_sig": false,
            "md5_digest": "eec848ea5e3f520b1a911c6a8286e04b",
            "packagetype": "bdist_wheel",
            "python_version": "cp37",
            "requires_python": null,
            "size": 23771038,
            "upload_time": "2023-10-28T10:34:45",
            "upload_time_iso_8601": "2023-10-28T10:34:45.353372Z",
            "url": "https://files.pythonhosted.org/packages/4a/42/4d2838783b030a29eb908fdbf67b356b3f681b929242a20b69c43e1e429d/pylibclang-316.0.6-cp37-cp37m-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b9f30ca5ddfa9c958d9c0b1f292be7e764dd5e965087b99ee51c42b7369fb95a",
                "md5": "8b6f27df2ce5b5ec3feead52fac7eaee",
                "sha256": "b83cfea2e3d5bf9f41306b5a471b2d7fb7b0d0a7ba33e8e22c34ee7b37e75f81"
            },
            "downloads": -1,
            "filename": "pylibclang-316.0.6-cp38-cp38-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl",
            "has_sig": false,
            "md5_digest": "8b6f27df2ce5b5ec3feead52fac7eaee",
            "packagetype": "bdist_wheel",
            "python_version": "cp38",
            "requires_python": null,
            "size": 23782431,
            "upload_time": "2023-10-28T10:34:52",
            "upload_time_iso_8601": "2023-10-28T10:34:52.454383Z",
            "url": "https://files.pythonhosted.org/packages/b9/f3/0ca5ddfa9c958d9c0b1f292be7e764dd5e965087b99ee51c42b7369fb95a/pylibclang-316.0.6-cp38-cp38-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d1e1fc6eaa0bb1f0aa789d60bbd5a5f05576799d6a9d2792361afdb01fc932a0",
                "md5": "87ac03e4fea12e8e010efac4782632a4",
                "sha256": "1e5c14238f50db8eeb8e85de4f65abc1f01e42632277c721b6f10eec3ce2eeda"
            },
            "downloads": -1,
            "filename": "pylibclang-316.0.6-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl",
            "has_sig": false,
            "md5_digest": "87ac03e4fea12e8e010efac4782632a4",
            "packagetype": "bdist_wheel",
            "python_version": "cp39",
            "requires_python": null,
            "size": 23782824,
            "upload_time": "2023-10-28T10:35:01",
            "upload_time_iso_8601": "2023-10-28T10:35:01.408076Z",
            "url": "https://files.pythonhosted.org/packages/d1/e1/fc6eaa0bb1f0aa789d60bbd5a5f05576799d6a9d2792361afdb01fc932a0/pylibclang-316.0.6-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f86b5ce15613958b7df626243536d61360d7a039a809168b3755cb9bc45dcb3a",
                "md5": "27c1f118991345dff7688ef107b61f3a",
                "sha256": "7157340128244b1b1db7e9b32f8df783e797c83910b8de5994eeebbefd112a3e"
            },
            "downloads": -1,
            "filename": "pylibclang-316.0.6.tar.gz",
            "has_sig": false,
            "md5_digest": "27c1f118991345dff7688ef107b61f3a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 191629,
            "upload_time": "2023-10-28T10:38:46",
            "upload_time_iso_8601": "2023-10-28T10:38:46.860666Z",
            "url": "https://files.pythonhosted.org/packages/f8/6b/5ce15613958b7df626243536d61360d7a039a809168b3755cb9bc45dcb3a/pylibclang-316.0.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-28 10:38:46",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "edimetia3d",
    "github_project": "pylibclang",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "pylibclang"
}
        
Elapsed time: 0.15184s