From 329d8dc891fafddf2148bc87f5752a850a5de971 Mon Sep 17 00:00:00 2001 From: parker-research <166864283+parker-research@users.noreply.github.com> Date: Sat, 30 Nov 2024 18:40:19 -0700 Subject: [PATCH 1/4] Add Python binding build instructions --- docs/building.dox | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/docs/building.dox b/docs/building.dox index b767ea945..e5ad3a7d0 100644 --- a/docs/building.dox +++ b/docs/building.dox @@ -124,6 +124,38 @@ cmake --build build --target docs The output website is located at `build/docs/html/` +@section python-binding-builds Building Python Bindings + +This section contains instructions for building and installing the Python bindings, which are created with [pybind11](https://github.com/pybind/pybind11). + +## Steps + +1. Clone the `pyslang` repository (https://github.com/MikePopoloski/slang) +2. Clone the `slang` submodule: + +@code{.ansi} +git submodule update --init --recursive +@endcode + +3. Create a virtual environment, activate it, and install `pyslang` as a Python package (including building the C++ `slang` library, with bindings): + +@code{.ansi} +python3 -m venv venv +source venv/bin/activate +pip install . +@endcode + +## Steps: Run the Python tests + +The Python tests are built and executed using the `pytest` framework. + +Install test/development dependencies, and run the Python tests: + +@code{.ansi} +pip install '.[test]' +pytest +@endcode + @section installation Installation CMake can be used to install slang. From 8df540d8220150b023493286ce1c91ba8152954b Mon Sep 17 00:00:00 2001 From: parker-research <166864283+parker-research@users.noreply.github.com> Date: Mon, 2 Dec 2024 15:06:04 -0700 Subject: [PATCH 2/4] Fix strong repo, make venv step optional --- docs/building.dox | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/building.dox b/docs/building.dox index e5ad3a7d0..46b412d14 100644 --- a/docs/building.dox +++ b/docs/building.dox @@ -130,14 +130,14 @@ This section contains instructions for building and installing the Python bindin ## Steps -1. Clone the `pyslang` repository (https://github.com/MikePopoloski/slang) +1. Clone the `pyslang` repository (https://github.com/MikePopoloski/pyslang) 2. Clone the `slang` submodule: @code{.ansi} git submodule update --init --recursive @endcode -3. Create a virtual environment, activate it, and install `pyslang` as a Python package (including building the C++ `slang` library, with bindings): +3. Optionally, create a virtual environment and activate it. @code{.ansi} python3 -m venv venv @@ -145,6 +145,12 @@ source venv/bin/activate pip install . @endcode +4. Install `pyslang` as a Python package (including building the C++ `slang` library with bindings, from the submodule): + +@code{.ansi} +pip install . +@endcode + ## Steps: Run the Python tests The Python tests are built and executed using the `pytest` framework. From 365fead0b2667ec22cc798910f8d302c450459ad Mon Sep 17 00:00:00 2001 From: parker-research <166864283+parker-research@users.noreply.github.com> Date: Mon, 2 Dec 2024 15:27:41 -0700 Subject: [PATCH 3/4] Remove extra pip install mistake --- docs/building.dox | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/building.dox b/docs/building.dox index 46b412d14..1557e3982 100644 --- a/docs/building.dox +++ b/docs/building.dox @@ -142,7 +142,6 @@ git submodule update --init --recursive @code{.ansi} python3 -m venv venv source venv/bin/activate -pip install . @endcode 4. Install `pyslang` as a Python package (including building the C++ `slang` library with bindings, from the submodule): From 563421cdfea76c6fc20031ebe292ef6620e9ef8c Mon Sep 17 00:00:00 2001 From: parker-research <166864283+parker-research@users.noreply.github.com> Date: Mon, 2 Dec 2024 17:14:38 -0700 Subject: [PATCH 4/4] Add 'venv' to gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index d996c9efe..a3e51d306 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ .vs/ .vscode/ .venv/ +venv/ .idea/ .cache/ .DS_Store