|
1 | | -# Python-BPF |
2 | | - |
3 | | -Python-BPF is an LLVM IR generator for eBPF programs written in Python. It uses [llvmlite](https://github.com/numba/llvmlite) to generate LLVM IR and then compiles to LLVM object files. These object files can be loaded into the kernel for execution. Unlike BCC, Python-BPF performs compilation without relying on its infrastructure. |
| 1 | +<picture> |
| 2 | + <source |
| 3 | + media="(prefers-color-scheme: light)" |
| 4 | + srcset="https://github.com/user-attachments/assets/f3738131-d7cb-4b5c-8699-c7010295a159" |
| 5 | + width="450" |
| 6 | + alt="Light‐mode image"> |
| 7 | + <img |
| 8 | + src="https://github.com/user-attachments/assets/b175bf39-23cb-475d-a6e1-7b5c99a1ed72" |
| 9 | + width="450" |
| 10 | + alt="Dark‐mode image"> |
| 11 | +</picture> |
| 12 | +<!-- Badges --> |
| 13 | +<p align="center"> |
| 14 | + <!-- PyPI --> |
| 15 | + <a href="https://pypi.org/project/pythonbpf/"><img src="https://img.shields.io/pypi/v/pythonbpf?color=blue" alt="PyPI version"></a> |
| 16 | + <!-- <a href="https://pypi.org/project/pythonbpf/"><img src="https://img.shields.io/pypi/pyversions/pythonbpf" alt="Python versions"></a> --> |
| 17 | + <!-- <a href="https://pypi.org/project/pythonbpf/"><img src="https://img.shields.io/pypi/dm/pythonbpf" alt="PyPI downloads"></a> --> |
| 18 | + <!-- <a href="https://pypi.org/project/pythonbpf/"><img src="https://img.shields.io/pypi/status/pythonbpf" alt="PyPI Status"></a> --> |
| 19 | + <a href="https://pepy.tech/project/pythonbpf"><img src="https://pepy.tech/badge/pythonbpf" alt="Downloads"></a> |
| 20 | + <!-- Build & CI --> |
| 21 | + <a href="https://github.com/pythonbpf/python-bpf/actions"><img src="https://github.com/pythonbpf/python-bpf/actions/workflows/python-publish.yml/badge.svg" alt="Build Status"></a> |
| 22 | + <!-- Meta --> |
| 23 | + <a href="https://github.com/pythonbpf/python-bpf/blob/main/LICENSE"><img src="https://img.shields.io/github/license/pythonbpf/python-bpf" alt="License"></a> |
| 24 | +</p> |
| 25 | + |
| 26 | + |
| 27 | +Python-BPF is an LLVM IR generator for eBPF programs written in Python. It uses [llvmlite](https://github.com/numba/llvmlite) to generate LLVM IR and then compiles to LLVM object files. These object files can be loaded into the kernel for execution. Python-BPF performs compilation without relying on BCC. |
4 | 28 |
|
5 | 29 | > **Note**: This project is under active development and not ready for production use. |
6 | 30 |
|
@@ -145,23 +169,17 @@ This architecture eliminates the need for embedding C code in Python, allowing f |
145 | 169 | ```bash |
146 | 170 | make install |
147 | 171 | ``` |
148 | | - |
149 | | -3. Build and test examples: |
150 | | - |
151 | | - ```bash |
152 | | - make |
153 | | - ``` |
154 | | - |
155 | | -4. Verify an object file with the kernel verifier: |
| 172 | + Then, run any example in `examples` |
| 173 | +3. Verify an object file with the kernel verifier: |
156 | 174 |
|
157 | 175 | ```bash |
158 | | - ./check.sh check execve2.o |
| 176 | + ./tools/check.sh check execve2.o |
159 | 177 | ``` |
160 | 178 |
|
161 | 179 | 5. Run an object file using `bpftool`: |
162 | 180 |
|
163 | 181 | ```bash |
164 | | - ./check.sh run execve2.o |
| 182 | + ./tools/check.sh run execve2.o |
165 | 183 | ``` |
166 | 184 |
|
167 | 185 | 6. Explore LLVM IR output from clang in `examples/c-form` by running `make`. |
|
0 commit comments