From 9427bbadf6098791d13015e5debee2f65cdd84d5 Mon Sep 17 00:00:00 2001 From: Mario Fink Date: Tue, 26 Jan 2021 11:43:36 +0100 Subject: [PATCH] Cython/Python install module docu --- .gitignore | 1 - README.md | 21 ++++++++++++++++++++- cython/requirements.txt | 2 ++ makefile | 3 +++ 4 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 cython/requirements.txt diff --git a/.gitignore b/.gitignore index 774b57b..fef44c6 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,5 @@ data/ tdmripper *.csv *.log -*.txt tdmreaper cython/*.cpp diff --git a/README.md b/README.md index 290d391..c396da1 100644 --- a/README.md +++ b/README.md @@ -138,7 +138,22 @@ build the binary locally with `make` and install it in your preferred location. ### Python -...tbc... +In order to build a _Python module_ from the _C++_ code base the +[Cython](https://cython.readthedocs.io/en/latest/index.html) package must be +available, which may be installed via `python3 -m pip install cython` . +Furthermore, the [Numpy](https://numpy.org) package is recommended to be able +to pass arrays of data from the C++ kernel to Python. The _makefile_ provides +the target `make cython-requirements` to install all required Python modules. +Finally, to build the Python extension _TDMReaper_ either locally or install +it the targets `make cython-build` and `make cython-install` are provided. +Hence, to install the Python module on the system simply do + +```Shell +make cython-requirements +make cython-install +``` + +that makes the module available to be imported as `import tdm_reaper` . ## Usage @@ -308,3 +323,7 @@ wrapper. ### Code example - https://www.ni.com/content/dam/web/product-documentation/c_dll_tdm.zip + +### Cython + +- https://cython.readthedocs.io/en/latest/src/userguide/wrapping_CPlusPlus.html diff --git a/cython/requirements.txt b/cython/requirements.txt new file mode 100644 index 0000000..5a7a437 --- /dev/null +++ b/cython/requirements.txt @@ -0,0 +1,2 @@ +Cython==0.29.21 +numpy==1.18.4 diff --git a/makefile b/makefile index 4c643ec..01e7cfa 100644 --- a/makefile +++ b/makefile @@ -68,6 +68,9 @@ checkps : # --------------------------------------------------------------------------- # # python/cython module +cython-requirements: cython/requirements.txt + python3 -m pip install -r $< + cython-help : cython/setup.py python3 $< --help