|
1 | | -# python bindings for vaccel |
| 1 | +# Python bindings for vAccel |
2 | 2 |
|
3 | | -This repo defines and builds the vaccel bindings for python. It is WiP and only |
4 | | -defines a subset of the vAccel API. |
| 3 | +[Python](https://www.python.org/) bindings for vAccel wrap the vAccel C API and |
| 4 | +provide a native Python API to vAccel operations. The bindings are currently a |
| 5 | +WiP, supporting a subset of the vAccel operations. |
5 | 6 |
|
| 7 | +You can find more information about these bindings and everything vAccel in the |
| 8 | +[Documentation](https://docs.vaccel.org). |
6 | 9 |
|
7 | | -## building |
| 10 | +## Installation |
8 | 11 |
|
9 | | -To build, first clone the repo: |
| 12 | +The bindings are implemented in the `vaccel` Python package. The package is |
| 13 | +installable with `pip` by using the provided Wheels or from source. |
10 | 14 |
|
11 | | -```bash |
12 | | -git clone https://github.com/nubificus/python-vaccel |
13 | | -``` |
| 15 | +### Requirements |
14 | 16 |
|
15 | | -## vAccel |
| 17 | +- To use the `vaccel` Python package you need a valid vAccel installation. You |
| 18 | + can find more information on how to install vAccel in the |
| 19 | + [Installation](https://docs.vaccel.org/latest/getting-started/installation) |
| 20 | + page. |
16 | 21 |
|
17 | | -In order to build the python bindings for vAccel, we first need a vAccel |
18 | | -installation. We can either build it from source, or get the latest binary |
19 | | -release: |
| 22 | +- This package requires Python 3.10 or newer. Verify your Python version with: |
| 23 | + ```sh |
| 24 | + python3 --version |
| 25 | + ``` |
| 26 | + and update Python as needed using the |
| 27 | + [official instructions](https://docs.python.org/3/using/index.html) |
20 | 28 |
|
21 | | -### Build from source |
| 29 | +### Wheel |
22 | 30 |
|
23 | | -```bash |
24 | | -git clone https://github.com/nubificus/vaccel --recursive |
25 | | -cd vaccel |
26 | | -meson setup -Dplugin-noop=enabled build |
27 | | -meson compile -C build |
28 | | -meson install -C build |
| 31 | +You can get the latest `vaccel` Wheel package from the |
| 32 | +[Releases](https://github.com/nubificus/vaccel-python/releases) page. |
29 | 33 |
|
| 34 | +```sh |
| 35 | +# Replace `x86_64` with `aarch64` or `armv7l` to get packages for the relevant |
| 36 | +# architectures |
| 37 | +wget https://github.com/nubificus/vaccel-python/releases/download/v0.1.0/vaccel-0.1.0-cp310-abi3-linux_x86_64.whl |
| 38 | +pip install vaccel-0.1.0-cp310-abi3-linux_x86_64.whl |
30 | 39 | ``` |
31 | 40 |
|
32 | | -The relevant libs & plugins should be in `/usr/local/lib/x86_64-linux-gnu`, along with include |
33 | | -files in `/usr/local/include`. |
34 | | - |
35 | | -### Get the binary release |
| 41 | +### Latest artifacts |
36 | 42 |
|
37 | | -Get the latest vAccel binaries: |
| 43 | +To install the Wheel artifact of the latest `vaccel` revision: |
38 | 44 |
|
39 | | -```bash |
40 | | -wget https://s3.nbfc.io/nbfc-assets/github/vaccel/rev/main/x86_64/release/vaccel-latest-bin.tar.gz |
| 45 | +```sh |
| 46 | +# Replace `x86_64` with `aarch64` or `armv7l` to get packages for the relevant |
| 47 | +# architectures |
| 48 | +wget https://s3.nbfc.io/nbfc-assets/github/python-vaccel/main/x86_64/vaccel-latest-cp310-abi3-linux_x86_64.whl |
| 49 | +pip install vaccel-latest-cp310-abi3-linux_x86_64.whl |
41 | 50 | ``` |
42 | 51 |
|
43 | | -and install it: |
44 | | - |
45 | | -```bash |
46 | | -sudo tar xfv vaccel-latest-bin.tar.gz --strip-components=2 -C /usr/local |
47 | | -``` |
48 | | - |
49 | | -## python bindings |
50 | | - |
51 | | -Finally, call the `builder.py` to build the bindings. The required python |
52 | | -packages to build are: `datestamp cffi wheel setuptools cmake_build_extension`. |
53 | | -To install them use: |
54 | | - |
55 | | -```bash |
56 | | -pip3 install datestamp cffi wheel setuptools cmake_build_extension |
57 | | -``` |
| 52 | +### Building from source |
58 | 53 |
|
59 | | -and run the builder: |
| 54 | +You can build the package from source directly and install it using `pip`: |
60 | 55 |
|
61 | | -```bash |
62 | | -python3 builder.py |
| 56 | +```sh |
| 57 | +pip install git+https://github.com/nubificus/vaccel-python |
63 | 58 | ``` |
64 | 59 |
|
65 | | -The module should be ready. To test run: |
66 | | - |
67 | | -```bash |
68 | | -export VACCEL_PLUGINS=/usr/local/lib/x86_64-linux-gnu/libvaccel-noop.so |
69 | | -export LD_LIBRARY_PATH=/usr/local/lib/x86_64-linux-gnu |
70 | | -export PYTHONPATH=$PYTHONPATH:. |
71 | | -python3 vaccel/test.py |
72 | | -``` |
73 | | -Alternatively, you could build the pip package: |
| 60 | +## Running the examples |
74 | 61 |
|
75 | | -```bash |
76 | | -pip3 install build |
77 | | -python3 -m build |
78 | | -``` |
| 62 | +Examples of using the package are provided in the `examples` directory. |
79 | 63 |
|
80 | | -and install it: |
| 64 | +After cloning the repo: |
81 | 65 |
|
82 | | -```bash |
83 | | -pip install dist/vaccel*.tar.gz |
| 66 | +```sh |
| 67 | +git clone https://github.com/nubificus/vaccel-python |
| 68 | +cd vaccel-python |
84 | 69 | ``` |
85 | 70 |
|
86 | | -## Test |
87 | | - |
88 | | -To run the tests: |
89 | | - |
90 | | -```bash |
91 | | -export VACCEL_PLUGINS=/usr/local/lib/x86_64-linux-gnu/libvaccel-noop.so |
92 | | -export LD_LIBRARY_PATH=/usr/local/lib/x86_64-linux-gnu |
93 | | -export PYTHONPATH=$PYTHONPATH:. |
94 | | -pytest |
95 | | - |
| 71 | +you can run all the available examples with sample arguments using: |
96 | 72 |
|
97 | | -# Test coverage |
98 | | -export VACCEL_PLUGINS=/usr/local/lib/x86_64-linux-gnu/libvaccel-noop.so |
99 | | -export LD_LIBRARY_PATH=/usr/local/lib/x86_64-linux-gnu |
100 | | -export PYTHONPATH=$PYTHONPATH:. |
101 | | -pytest --cov=vaccel tests/ |
| 73 | +```sh |
| 74 | +python3 run-examples.py |
102 | 75 | ``` |
0 commit comments