Files
python-bpf/pyproject.toml
Varun R Mallya 6b76b74a3b add CI workflow to run the test suite
Runs make test on every push to master and every pull_request. Kernel
verifier tests need passwordless sudo and a kernel with BTF/BPF
enabled, which isn't guaranteed on every runner, so the workflow
probes for working sudo first and only attempts them if it's there.

Ubuntu's default apt packages need three adjustments to actually run
this: bpftool is a virtual package provided by linux-tools-generic
whose binary needs to be found and put on PATH manually; ctypeslib2's
clang bindings default to the latest PyPI release, which doesn't match
Ubuntu's libclang-16, so pin to clang==16.0.6 (older bindings stay
forward-compatible with a newer system libclang); and llvmlite>=0.49
emits IR using the 'captures(none)' attribute spelling, matching the
LLVM 22.1.0 it bundles internally, which Ubuntu's default LLVM 18 (and
even 19) can't parse - install a matching-generation LLVM 22 from
apt.llvm.org instead of the distro default.

Also add ctypeslib2 and a pinned clang to the test extra: make test
now regenerates vmlinux.py via tools/vmlinux-gen.py, which needs
clang2py, and that dependency was previously only installed ad hoc in
local dev venvs.
2026-08-30 20:54:10 +05:30

78 lines
2.2 KiB
TOML

[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"
[project]
name = "pythonbpf"
version = "0.1.9"
description = "Reduced Python frontend for eBPF"
authors = [
{ name = "r41k0u", email="pragyanshchaturvedi18@gmail.com" },
{ name = "varun-r-mallya", email="varunrmallya@gmail.com" }
]
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: System :: Operating System Kernels :: Linux",
]
readme = "README.md"
license = {text = "Apache-2.0"}
requires-python = ">=3.10"
dependencies = [
"llvmlite>=0.45",
"astpretty",
"pylibbpf"
]
[project.optional-dependencies]
docs = [
"sphinx>=7.0",
"myst-parser>=2.0",
"sphinx-rtd-theme>=2.0",
"sphinx-copybutton",
]
test = [
"pytest>=8.0",
"pytest-cov>=5.0",
"ctypeslib2",
# Pinned rather than left to ctypeslib2's own (unpinned) dependency: pip
# installs the latest release by default, and its libclang API surface
# can be newer than the system libclang (e.g. Ubuntu 24.04 ships
# libclang-16), which fails with a LibclangError about an undefined
# symbol. Older bindings against a newer libclang stay compatible, so
# pin to an old-enough release instead of pinning apt's libclang.
"clang==16.0.6",
]
[tool.setuptools.packages.find]
where = ["."]
include = ["pythonbpf*"]
[tool.pytest.ini_options]
testpaths = ["tests"]
pythonpath = ["."]
python_files = ["test_*.py"]
markers = [
"verifier: requires sudo/root for kernel verifier tests (not run by default)",
"vmlinux: requires vmlinux.py for current kernel",
]
log_cli = false
[tool.coverage.run]
source = ["pythonbpf"]
omit = ["*/vmlinux*", "*/__pycache__/*"]
[tool.coverage.report]
show_missing = true
skip_covered = false