Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ on:

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -34,6 +33,4 @@ jobs:
- name: Type checks
run: uv run mypy *.py --check-untyped-defs
- name: Tests
run: |
PY_CPPMODEL_LIBCLANG_PATH=/usr/lib/llvm-18/lib/libclang-18.so.1 \
uv run python -m unittest discover --verbose .
run: uv run python -m unittest discover --verbose .
7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@
`py_cppmodel` is a Python wrapper around clang's python bindings to generate a
simple Python model of a C++ translation unit.

## Limitations

Currently the environment variable `PY_CPPMODEL_LIBCLANG_PATH` must be defined
to specify where libclang can be found. This may be fixed in the future.

## Development

To set up the development environment, execute the following commands:
Expand All @@ -30,7 +25,7 @@ uv sync
To run the tests, run:

```sh
./test.macos.sh
uv run python -m unittest discover --verbose .
```

To run type checking:
Expand Down
21 changes: 3 additions & 18 deletions Sandbox.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,6 @@
"tags": []
},
"outputs": [],
"source": [
"# TODO: Change this for your OS-dependent or locally-built libclang path.\n",
"clang.cindex.Config.set_library_file(\n",
" \"/Library/Developer/CommandLineTools/usr/lib/libclang.dylib\"\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"COMPILER_ARGS = [\n",
" \"-x\",\n",
Expand All @@ -60,7 +45,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "4",
"id": "3",
"metadata": {
"tags": []
},
Expand All @@ -81,7 +66,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "5",
"id": "4",
"metadata": {
"tags": []
},
Expand All @@ -93,7 +78,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "6",
"id": "5",
"metadata": {},
"outputs": [],
"source": []
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ license = { file = "LICENSE" }
authors = [{ name = "J.B. Coe", email = "jonathanbcoe@gmail.com" }]
dependencies = [
"clang>=14.0",
"libclang>=18.1.1",
]

[project.urls]
Expand Down
1 change: 0 additions & 1 deletion test.macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@ uv sync
uv run mypy *.py --check-untyped-defs

# Unit tests
PY_CPPMODEL_LIBCLANG_PATH=/Library/Developer/CommandLineTools/usr/lib/libclang.dylib \
uv run python -m unittest discover --verbose .
6 changes: 0 additions & 6 deletions test_parse_standard_library_includes.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@

from ctypes.util import find_library

LIBCLANG_PATH = os.environ.get("PY_CPPMODEL_LIBCLANG_PATH")
if not LIBCLANG_PATH:
raise RuntimeError("PY_CPPMODEL_LIBCLANG_PATH is unset")

clang.cindex.Config.set_library_file(LIBCLANG_PATH) # type: ignore

from clang.cindex import TranslationUnit

COMPILER_ARGS = [
Expand Down
6 changes: 0 additions & 6 deletions test_py_cppmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
import py_cppmodel
import unittest

LIBCLANG_PATH = os.environ.get("PY_CPPMODEL_LIBCLANG_PATH")
if not LIBCLANG_PATH:
raise RuntimeError("PY_CPPMODEL_LIBCLANG_PATH is unset")

clang.cindex.Config.set_library_file(LIBCLANG_PATH) # type: ignore

from clang.cindex import TranslationUnit

COMPILER_ARGS = [
Expand Down
23 changes: 22 additions & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading