mirror of
https://github.com/varun-r-mallya/pylibbpf.git
synced 2026-02-12 16:11:00 +00:00
Compare commits
5 Commits
xdp
...
5a3937b7f6
| Author | SHA1 | Date | |
|---|---|---|---|
| 5a3937b7f6 | |||
| 6e6e48acdd | |||
| 15c171b546 | |||
| aa8183b28c | |||
| 80a0afe74f |
4
.github/workflows/format.yml
vendored
4
.github/workflows/format.yml
vendored
@ -15,8 +15,8 @@ jobs:
|
|||||||
name: Format
|
name: Format
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v5
|
||||||
- uses: actions/setup-python@v5
|
- uses: actions/setup-python@v6
|
||||||
with:
|
with:
|
||||||
python-version: "3.x"
|
python-version: "3.x"
|
||||||
- uses: pre-commit/action@v3.0.1
|
- uses: pre-commit/action@v3.0.1
|
||||||
|
|||||||
4
.github/workflows/pip.yml
vendored
4
.github/workflows/pip.yml
vendored
@ -19,11 +19,11 @@ jobs:
|
|||||||
runs-on: ${{ matrix.platform }}
|
runs-on: ${{ matrix.platform }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v5
|
||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
|
|
||||||
- uses: actions/setup-python@v5
|
- uses: actions/setup-python@v6
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
|
|
||||||
|
|||||||
8
.github/workflows/wheels.yml
vendored
8
.github/workflows/wheels.yml
vendored
@ -15,7 +15,7 @@ jobs:
|
|||||||
name: Build SDist
|
name: Build SDist
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v5
|
||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
|
|
||||||
@ -39,12 +39,12 @@ jobs:
|
|||||||
arch: [x86_64]
|
arch: [x86_64]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v5
|
||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
|
|
||||||
- name: Build wheels
|
- name: Build wheels
|
||||||
uses: pypa/cibuildwheel@v2.17
|
uses: pypa/cibuildwheel@v3.2
|
||||||
env:
|
env:
|
||||||
CIBW_PLATFORM: linux
|
CIBW_PLATFORM: linux
|
||||||
CIBW_ARCHS_LINUX: ${{ matrix.arch }}
|
CIBW_ARCHS_LINUX: ${{ matrix.arch }}
|
||||||
@ -80,7 +80,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Download all artifacts
|
- name: Download all artifacts
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v5
|
||||||
with:
|
with:
|
||||||
pattern: cibw-*
|
pattern: cibw-*
|
||||||
path: dist
|
path: dist
|
||||||
|
|||||||
45
README.md
45
README.md
@ -1,24 +1,43 @@
|
|||||||
# Py-libbpf
|
<picture>
|
||||||
|
<source
|
||||||
|
media="(prefers-color-scheme: light)"
|
||||||
|
srcset="https://github.com/user-attachments/assets/dbd56f5b-4512-4c82-a404-30bce0ee5207"
|
||||||
|
width="450"
|
||||||
|
alt="pylibbpf light mode">
|
||||||
|
<img
|
||||||
|
src="https://github.com/user-attachments/assets/9e873d60-a834-4411-bc0c-361b14502f8b"
|
||||||
|
width="450"
|
||||||
|
alt="pylibbpf dark mode">
|
||||||
|
</picture>
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://www.python.org/downloads/release/python-3080/"><img src="https://img.shields.io/badge/python-3.8-blue.svg"></a>
|
<!-- PyPI -->
|
||||||
<a href="https://pypi.org/project/pylibbpf"><img src="https://badge.fury.io/py/pylibbpf.svg"></a>
|
<a href="https://www.python.org/downloads/release/python-3080/"><img src="https://img.shields.io/badge/python-3.8-blue.svg"></a>
|
||||||
|
<a href="https://pypi.org/project/pylibbpf"><img src="https://badge.fury.io/py/pylibbpf.svg"></a>
|
||||||
|
<!-- <a href="https://pypi.org/project/pythonbpf/"><img src="https://img.shields.io/pypi/status/pythonbpf" alt="PyPI Status"></a> -->
|
||||||
|
<a href="https://pepy.tech/project/pylibbpf"><img src="https://pepy.tech/badge/pylibbpf" alt="Downloads"></a>
|
||||||
|
<!-- Build & CI -->
|
||||||
|
<a href="https://github.com/pythonbpf/pylibbpf/actions"><img src="https://github.com/pythonbpf/pylibbpf/actions/workflows/wheels.yml/badge.svg" alt="Build Status"></a>
|
||||||
|
<!-- Meta -->
|
||||||
|
<a href="https://github.com/pythonbpf/pylibbpf/blob/master/LICENSE"><img src="https://img.shields.io/github/license/pythonbpf/pylibbpf" alt="License"></a>
|
||||||
</p>
|
</p>
|
||||||
This library provides Python bindings for libbpf on Linux to make loading of eBPF object files easier. This is meant to
|
|
||||||
be used along with `pythonbpf`, the eBPF Python DSL compiler. This library makes it possible to attach these programs to
|
|
||||||
events in the kernel right from inside Python.
|
|
||||||
|
|
||||||
# IN DEVELOPMENT. DO NOT USE.
|
This library provides Python bindings for **libbpf** on Linux, making it easier to load eBPF object files. It is designed to be used together with [PythonBPF](https://github.com/pythonbpf/python-bpf), the eBPF compiler for Python. With these bindings, you can attach eBPF programs to kernel events directly from Python.
|
||||||
|
All programs written with this are to be run with a `sudo` Python interpreter.
|
||||||
|
|
||||||
## Prerequisites
|
> **Note**: This project is under active development and not ready for production use.
|
||||||
|
|
||||||
|
## Dependencies
|
||||||
|
|
||||||
* A compiler with C++11 support
|
* A compiler with C++11 support
|
||||||
* Pip 10+ or CMake >= 4.1
|
* Pip 10+ or CMake >= 4.1
|
||||||
* Ninja or Pip 10+
|
* Ninja or Pip 10+
|
||||||
|
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
`pip install pylibbpf`
|
||||||
|
|
||||||
Just clone this repository and pip install. Note the `--recursive` option which is
|
## Development
|
||||||
|
|
||||||
|
Clone this repository and pip install. Note the `--recursive` option which is
|
||||||
needed for the pybind11 submodule:
|
needed for the pybind11 submodule:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@ -30,11 +49,5 @@ pip install .
|
|||||||
With the `setup.py` file included in this example, the `pip install` command will
|
With the `setup.py` file included in this example, the `pip install` command will
|
||||||
invoke CMake and build the pybind11 module as specified in `CMakeLists.txt`.
|
invoke CMake and build the pybind11 module as specified in `CMakeLists.txt`.
|
||||||
|
|
||||||
## Development
|
|
||||||
Do this before running to make sure Python can manipulate bpf programs without sudo
|
|
||||||
```bash
|
|
||||||
sudo setcap cap_bpf,cap_sys_admin+ep /usr/bin/python3.12
|
|
||||||
```
|
|
||||||
|
|
||||||
## Building the documentation
|
## Building the documentation
|
||||||
The documentation here is still boilerplate.
|
The documentation here is still boilerplate.
|
||||||
|
|||||||
Reference in New Issue
Block a user