add proper Python packaging with pyproject.toml

Add build-system section, move dev deps to optional, add MANIFEST.in
for C++/Cython source distribution, and export BASEDIR/INCLUDE_PATH
from __init__.py for consumers.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Adeeb Shihadeh
2026-02-21 10:35:13 -08:00
parent fa514e7dd7
commit c7c2fade03
3 changed files with 28 additions and 22 deletions

1
MANIFEST.in Normal file
View File

@@ -0,0 +1 @@
recursive-include msgq *.h *.cc *.pyx *.pxd

View File

@@ -1,4 +1,8 @@
# must be built with scons
import os
BASEDIR = os.path.dirname(os.path.abspath(__file__))
INCLUDE_PATH = os.path.abspath(os.path.join(BASEDIR, "../"))
from msgq.ipc_pyx import Context, Poller, SubSocket, PubSocket, SocketEventHandle, toggle_fake_events, \
set_fake_prefix, get_fake_prefix, delete_fake_prefix, wait_for_one_event
from msgq.ipc_pyx import MultiplePublishersError, IpcError

View File

@@ -1,33 +1,34 @@
[project]
name = "msgq"
version = "0.0.1"
description = "Code powering the comma.ai panda"
readme = "README.md"
version = "0.1.0"
description = "Lock-free IPC message queue and VisionIPC"
requires-python = ">=3.11,<3.13"
license = {text = "MIT"}
authors = [{name = "comma.ai"}]
classifiers = [
"Natural Language :: English",
"Programming Language :: Python :: 3",
"Topic :: System :: Hardware",
]
dependencies = [
"setuptools", # for distutils
"Cython",
"scons",
"ruff",
"parameterized",
"coverage",
"numpy",
"pytest",
"pytest-retry",
"cppcheck",
"cpplint",
"codespell",
"ty",
"lefthook",
]
[project.optional-dependencies]
dev = [
"setuptools", "Cython", "scons", "ruff",
"parameterized", "coverage", "numpy",
"pytest", "pytest-retry",
"cppcheck", "cpplint", "codespell", "ty", "lefthook",
]
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
[tool.setuptools]
include-package-data = true
[tool.setuptools.package-data]
"msgq" = ["*.h", "*.cc", "*.pyx", "*.pxd"]
"msgq.visionipc" = ["*.h", "*.cc", "*.pyx", "*.pxd"]
"msgq.logger" = ["*.h"]
# https://beta.ruff.rs/docs/configuration/#using-pyprojecttoml
[tool.ruff]
lint.select = ["E", "F", "W", "PIE", "C4", "ISC", "RUF100", "A"]