mirror of
https://github.com/varun-r-mallya/pylibbpf.git
synced 2026-03-22 13:11:28 +00:00
Compare commits
10 Commits
perfbuf
...
b3e9410e0d
| Author | SHA1 | Date | |
|---|---|---|---|
| b3e9410e0d | |||
| fd739e87c1 | |||
| 87c698e940 | |||
| 298df7ede6 | |||
| b48f6a8a97 | |||
| 6e4dc0f5aa | |||
| a51bed14ca | |||
| 3a85a6446e | |||
| 6bc378defd | |||
| 5c1071fac0 |
4
.github/workflows/pip.yml
vendored
4
.github/workflows/pip.yml
vendored
@ -14,7 +14,7 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
platform: [ubuntu-latest]
|
||||
python-version: ["3.8", "3.12"]
|
||||
python-version: ["3.12", "3.13"]
|
||||
|
||||
runs-on: ${{ matrix.platform }}
|
||||
|
||||
@ -48,4 +48,4 @@ jobs:
|
||||
run: python -I -c "import pylibbpf; print('Import successful')"
|
||||
|
||||
- name: Test
|
||||
run: python -I -m pytest -v
|
||||
run: python -m pytest -v
|
||||
|
||||
10
.github/workflows/wheels.yml
vendored
10
.github/workflows/wheels.yml
vendored
@ -17,7 +17,7 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
submodules: true
|
||||
submodules: recursive
|
||||
|
||||
- name: Build SDist
|
||||
run: pipx run build --sdist
|
||||
@ -41,14 +41,14 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
submodules: true
|
||||
submodules: recursive
|
||||
|
||||
- name: Build wheels
|
||||
uses: pypa/cibuildwheel@v3.2
|
||||
env:
|
||||
CIBW_PLATFORM: linux
|
||||
CIBW_ARCHS_LINUX: ${{ matrix.arch }}
|
||||
CIBW_BUILD: "cp38-* cp311-*"
|
||||
CIBW_BUILD: "cp312-* cp313-*"
|
||||
CIBW_SKIP: "*-musllinux*"
|
||||
CIBW_TEST_COMMAND: "python -c 'import pylibbpf; print(f\"pylibbpf {pylibbpf.__version__} imported successfully\")'"
|
||||
CIBW_TEST_SKIP: "*-linux_aarch64"
|
||||
@ -56,7 +56,9 @@ jobs:
|
||||
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
|
||||
|
||||
CIBW_BEFORE_ALL_LINUX: |
|
||||
dnf install -y elfutils-libelf-devel zlib-devel
|
||||
dnf install -y elfutils-libelf-devel zlib-devel make gcc gcc-c++ git
|
||||
CIBW_BEFORE_BUILD: >
|
||||
pip install --upgrade "setuptools>=77.0.0" wheel cmake ninja pybind11
|
||||
|
||||
- name: Verify clean directory
|
||||
run: git diff --exit-code
|
||||
|
||||
@ -5,6 +5,8 @@ set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
find_package(Python COMPONENTS Interpreter Development.Module REQUIRED)
|
||||
|
||||
# pybind11
|
||||
include_directories(${CMAKE_SOURCE_DIR}/src)
|
||||
add_subdirectory(pybind11)
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
[build-system]
|
||||
requires = [
|
||||
"setuptools>=42",
|
||||
"setuptools>=77",
|
||||
"wheel",
|
||||
"ninja",
|
||||
"cmake>=4.0",
|
||||
@ -17,8 +17,8 @@ authors = [
|
||||
{ name = "varun-r-mallya", email = "varunrmallya@gmail.com" }
|
||||
]
|
||||
readme = "README.md"
|
||||
license = { file = "LICENSE" }
|
||||
requires-python = ">=3.8"
|
||||
license = "Apache-2.0"
|
||||
requires-python = ">=3.12"
|
||||
classifiers = [
|
||||
"Development Status :: 3 - Alpha",
|
||||
"Intended Audience :: Developers",
|
||||
@ -29,6 +29,7 @@ classifiers = [
|
||||
"Programming Language :: Python :: 3.10",
|
||||
"Programming Language :: Python :: 3.11",
|
||||
"Programming Language :: Python :: 3.12",
|
||||
"Programming Language :: Python :: 3.13",
|
||||
"Programming Language :: C++",
|
||||
"Topic :: Software Development :: Libraries :: Python Modules",
|
||||
"Topic :: System :: Operating System Kernels :: Linux",
|
||||
@ -47,7 +48,7 @@ Issues = "https://github.com/pythonbpf/pylibbpf/issues"
|
||||
|
||||
[tool.mypy]
|
||||
files = "setup.py"
|
||||
python_version = "3.8"
|
||||
python_version = "3.12"
|
||||
strict = true
|
||||
show_error_codes = true
|
||||
enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"]
|
||||
@ -68,7 +69,7 @@ filterwarnings = [
|
||||
testpaths = ["tests"]
|
||||
|
||||
[tool.ruff]
|
||||
target-version = "py38"
|
||||
target-version = "py312"
|
||||
line-length = 88
|
||||
|
||||
[tool.ruff.lint]
|
||||
|
||||
47
setup.py
47
setup.py
@ -6,14 +6,6 @@ from pathlib import Path
|
||||
from setuptools import Extension, find_packages, setup
|
||||
from setuptools.command.build_ext import build_ext
|
||||
|
||||
# Convert distutils Windows platform specifiers to CMake -A arguments
|
||||
PLAT_TO_CMAKE = {
|
||||
"win32": "Win32",
|
||||
"win-amd64": "x64",
|
||||
"win-arm32": "ARM",
|
||||
"win-arm64": "ARM64",
|
||||
}
|
||||
|
||||
|
||||
# A CMakeExtension needs a sourcedir instead of a file list.
|
||||
# The name must be the _single_ output extension from the CMake build.
|
||||
@ -45,8 +37,8 @@ class CMakeBuild(build_ext):
|
||||
# from Python.
|
||||
cmake_args = [
|
||||
f"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY={extdir}{os.sep}",
|
||||
f"-DPYTHON_EXECUTABLE={sys.executable}",
|
||||
f"-DCMAKE_BUILD_TYPE={cfg}", # not used on MSVC, but no harm
|
||||
f"-DPython_EXECUTABLE={sys.executable}",
|
||||
]
|
||||
build_args = []
|
||||
|
||||
@ -122,44 +114,7 @@ if readme_path.exists():
|
||||
long_description = readme_path.read_text(encoding="utf-8")
|
||||
|
||||
setup(
|
||||
name="pylibbpf",
|
||||
version="0.0.1",
|
||||
author="varun-r-mallya, r41k0u",
|
||||
author_email="varunrmallyagmail.com",
|
||||
description="Python Bindings for Libbpf",
|
||||
long_description=long_description,
|
||||
long_description_content_type="text/markdown",
|
||||
url="https://github.com/pythonbpf/pylibbpf",
|
||||
packages=find_packages(where="."),
|
||||
package_dir={"": "."},
|
||||
py_modules=[], # Empty since we use packages
|
||||
ext_modules=[CMakeExtension("pylibbpf.pylibbpf")],
|
||||
cmdclass={"build_ext": CMakeBuild},
|
||||
zip_safe=False,
|
||||
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 :: C++",
|
||||
"Topic :: Software Development :: Libraries :: Python Modules",
|
||||
"Topic :: System :: Operating System Kernels :: Linux",
|
||||
],
|
||||
install_requires=[
|
||||
"llvmlite>=0.40.0", # Required for struct conversion
|
||||
],
|
||||
extras_require={"test": ["pytest>=6.0"]},
|
||||
python_requires=">=3.8",
|
||||
package_data={
|
||||
"pylibbpf": [
|
||||
"*.py",
|
||||
"py.typed", # For type hints
|
||||
],
|
||||
},
|
||||
include_package_data=True,
|
||||
)
|
||||
|
||||
@ -2,6 +2,7 @@ import pylibbpf as m
|
||||
|
||||
|
||||
def test_main():
|
||||
print(dir(m))
|
||||
assert m.__version__ == "0.0.6"
|
||||
prog = m.BpfObject("tests/execve2.o", structs={})
|
||||
print(prog)
|
||||
|
||||
Reference in New Issue
Block a user