Skip to content

Commit 4286420

Browse files
better
1 parent 5dd95c9 commit 4286420

File tree

10 files changed

+143
-74
lines changed

10 files changed

+143
-74
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
matrix:
1111
flags: ['', '--asan', '--ubsan']
1212
backend: ['MSGQ', 'ZMQ']
13-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
13+
python-version: ["3.11", "3.12"]
1414
steps:
1515
- uses: actions/checkout@v4
1616
- uses: actions/setup-python@v5

.github/workflows/wheels.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: wheels
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
wheels:
7+
runs-on: ${{ matrix.platform.os }}
8+
strategy:
9+
fail-fast: true
10+
matrix:
11+
platform: [ {os: "ubuntu-latest", target: "manylinux_x86_64", arch: "x86_64"},
12+
{os: "ubuntu-latest", target: "manylinux_aarch64", arch: "aarch64"},
13+
{os: "macos-14", target: "macosx_arm64", arch: "arm64"} ]
14+
python: [ {cp: "cp311", py: "3.11"}, {cp: "cp312", py: "3.12"} ]
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Set up QEMU
20+
if: runner.os == 'Linux'
21+
uses: docker/setup-qemu-action@v3
22+
with:
23+
platforms: all
24+
25+
- name: Building wheel
26+
uses: pypa/cibuildwheel@v2.19.2
27+
env:
28+
CIBW_BUILD: "${{ matrix.python.cp }}-${{ matrix.platform.target }}"
29+
CIBW_ARCHS: "${{ matrix.platform.arch }}"
30+
CIBW_BEFORE_ALL_LINUX: "bash {project}/scripts/manylinux_dependencies.sh"
31+
CIBW_BEFORE_BUILD_MACOS: "bash {project}/scripts/macos_dependencies.sh"
32+
CIBW_MANYLINUX_X86_64_IMAGE: "manylinux_2_28"
33+
CIBW_MANYLINUX_AARCH64_IMAGE: "manylinux_2_28"
34+
CIBW_TEST_COMMAND: pip install -r {project}/requirements.txt && pytest {package}
35+
36+
37+
- uses: actions/setup-python@v5
38+
if: ${{ matrix.platform.arch }} != 'aarch64'
39+
with:
40+
python-version: ${{ matrix.python.py }}
41+
42+
- name: Installing the wheel
43+
if: ${{ matrix.platform.arch }} != 'aarch64'
44+
run: |
45+
pip install --break-system-packages ./wheelhouse/*.whl
46+
47+
- name: Saving wheel
48+
uses: actions/upload-artifact@v4
49+
with:
50+
name: cibw-wheels-${{ matrix.platform.target }}-${{ matrix.python.cp }}
51+
path: ./wheelhouse/*.whl

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
[project]
22
name = "msgq"
3-
requires-python = ">= 3.8"
3+
requires-python = ">= 3.11"
44
version = "0.1.0"
55

66
dependencies = [
77
"numpy",
88
"Cython",
99
"pycapnp",
10+
"setuptools",
1011
]
1112

1213
[project.optional-dependencies]
1314
dev = [
14-
"pyyaml",
1515
"scons",
1616
"pre-commit",
1717
"ruff",

requirements.txt

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# This file was autogenerated by uv via the following command:
2+
# uv pip compile --all-extras -o requirements.txt pyproject.toml
3+
cfgv==3.4.0
4+
# via pre-commit
5+
coverage==7.6.0
6+
# via
7+
# msgq (pyproject.toml)
8+
# pytest-cov
9+
cython==3.0.10
10+
# via msgq (pyproject.toml)
11+
distlib==0.3.8
12+
# via virtualenv
13+
filelock==3.15.4
14+
# via virtualenv
15+
identify==2.6.0
16+
# via pre-commit
17+
iniconfig==2.0.0
18+
# via pytest
19+
nodeenv==1.9.1
20+
# via pre-commit
21+
numpy==2.0.0
22+
# via msgq (pyproject.toml)
23+
packaging==24.1
24+
# via pytest
25+
parameterized==0.9.0
26+
# via msgq (pyproject.toml)
27+
platformdirs==4.2.2
28+
# via virtualenv
29+
pluggy==1.5.0
30+
# via pytest
31+
pre-commit==3.7.1
32+
# via msgq (pyproject.toml)
33+
pycapnp==2.0.0
34+
# via msgq (pyproject.toml)
35+
pytest==8.2.2
36+
# via
37+
# msgq (pyproject.toml)
38+
# pytest-cov
39+
pytest-cov==5.0.0
40+
# via msgq (pyproject.toml)
41+
pyyaml==6.0.1
42+
# via pre-commit
43+
ruff==0.5.3
44+
# via msgq (pyproject.toml)
45+
scons==4.8.0
46+
# via msgq (pyproject.toml)
47+
setuptools==71.0.4
48+
# via msgq (pyproject.toml)
49+
virtualenv==20.26.3
50+
# via pre-commit

scripts/build_wheel.sh

Lines changed: 0 additions & 9 deletions
This file was deleted.

scripts/install_dependencies.sh

Lines changed: 0 additions & 58 deletions
This file was deleted.

scripts/macos_dependencies.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
brew bundle --file=- <<-EOS
3+
brew "zeromq"
4+
cask "gcc-arm-embedded"
5+
brew "gcc@13"
6+
EOS

scripts/manylinux_dependencies.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
dnf install -y clang opencl-headers ocl-icd-devel cppcheck wget
4+
5+
wget https://github.com/zeromq/libzmq/releases/download/v4.3.5/zeromq-4.3.5.tar.gz
6+
tar -xvf zeromq-4.3.5.tar.gz
7+
cd zeromq-4.3.5
8+
./configure
9+
make -j$(nproc)
10+
make install

scripts/ubuntu_dependencies.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
if [[ ! $(id -u) -eq 0 ]]; then
4+
if [[ -z $(which sudo) ]]; then
5+
echo "Please install sudo or run as root"
6+
exit 1
7+
fi
8+
SUDO="sudo"
9+
fi
10+
11+
$SUDO apt-get update
12+
$SUDO apt-get install -y --no-install-recommends clang opencl-headers libzmq3-dev ocl-icd-opencl-dev cppcheck

setup.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1-
from setuptools import Command, setup
1+
from setuptools import Command, setup, Distribution
22
from setuptools.command.build import build
33
import subprocess
44
import os
55

6+
class BinaryDistribution(Distribution):
7+
def has_ext_modules(self):
8+
return True
9+
10+
611
class SconsBuild(Command):
712
def initialize_options(self) -> None:
813
pass
@@ -12,14 +17,16 @@ def finalize_options(self) -> None:
1217

1318
def run(self) -> None:
1419
scons_flags = '' if 'BUILD_TESTS' in os.environ else '--minimal'
15-
subprocess.run([f"scons {scons_flags} -j$(nproc)"], shell=True).check_returncode()
20+
subprocess.run([f"scons {scons_flags} -j$(nproc || sysctl -n hw.logicalcpu)"], shell=True).check_returncode()
21+
1622

1723
class CustomBuild(build):
1824
sub_commands = [('scons_build', None)] + build.sub_commands
1925

2026
setup(
2127
packages = ["msgq", "msgq.visionipc"],
22-
package_data={'msgq': ['**/*.cc', '**/*.h', '**/*.pxd', '**/*.pyx', '**/*.so']},
28+
package_data={'': ['**/*.cc', '**/*.c', '**/*.h', '**/*.pxd', '**/*.pyx', '**/*.py', '**/*.so', '**/*.npy']},
2329
include_package_data=True,
24-
cmdclass={'build': CustomBuild, 'scons_build': SconsBuild}
30+
cmdclass={'build': CustomBuild, 'scons_build': SconsBuild},
31+
distclass=BinaryDistribution,
2532
)

0 commit comments

Comments
 (0)