chiaki-lib 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. chiaki_lib-0.1.0/.github/workflows/build-macos.yml +149 -0
  2. chiaki_lib-0.1.0/.github/workflows/build-raspberrypi.yml +156 -0
  3. chiaki_lib-0.1.0/.github/workflows/build-ubuntu.yml +96 -0
  4. chiaki_lib-0.1.0/.github/workflows/build-windows.yml +107 -0
  5. chiaki_lib-0.1.0/.github/workflows/publish.yml +66 -0
  6. chiaki_lib-0.1.0/.gitignore +15 -0
  7. chiaki_lib-0.1.0/CMakeLists.txt +135 -0
  8. chiaki_lib-0.1.0/LICENSE +672 -0
  9. chiaki_lib-0.1.0/PKG-INFO +134 -0
  10. chiaki_lib-0.1.0/README.md +102 -0
  11. chiaki_lib-0.1.0/chiaki_lib/SDL2.dll +0 -0
  12. chiaki_lib-0.1.0/chiaki_lib/__init__.py +9 -0
  13. chiaki_lib-0.1.0/chiaki_lib/_native/__init__.pyi +1486 -0
  14. chiaki_lib-0.1.0/chiaki_lib/_native/core/__init__.pyi +4 -0
  15. chiaki_lib-0.1.0/chiaki_lib/_native/core/common.pyi +16 -0
  16. chiaki_lib-0.1.0/chiaki_lib/_native/core/log.pyi +10 -0
  17. chiaki_lib-0.1.0/chiaki_lib/_native.cp311-win_amd64.pyd +0 -0
  18. chiaki_lib-0.1.0/chiaki_lib/avcodec-61.dll +4 -0
  19. chiaki_lib-0.1.0/chiaki_lib/avformat-61.dll +0 -0
  20. chiaki_lib-0.1.0/chiaki_lib/avutil-59.dll +0 -0
  21. chiaki_lib-0.1.0/chiaki_lib/core/__init__.py +12 -0
  22. chiaki_lib-0.1.0/chiaki_lib/core/common.py +6 -0
  23. chiaki_lib-0.1.0/chiaki_lib/core/log.py +6 -0
  24. chiaki_lib-0.1.0/chiaki_lib/event_core.dll +0 -0
  25. chiaki_lib-0.1.0/chiaki_lib/fmt.dll +0 -0
  26. chiaki_lib-0.1.0/chiaki_lib/json-c.dll +0 -0
  27. chiaki_lib-0.1.0/chiaki_lib/libcrypto-3-x64.dll +0 -0
  28. chiaki_lib-0.1.0/chiaki_lib/libplacebo-349.dll +0 -0
  29. chiaki_lib-0.1.0/chiaki_lib/libssh2.dll +0 -0
  30. chiaki_lib-0.1.0/chiaki_lib/miniupnpc.dll +0 -0
  31. chiaki_lib-0.1.0/chiaki_lib/opus.dll +0 -0
  32. chiaki_lib-0.1.0/chiaki_lib/py.typed +0 -0
  33. chiaki_lib-0.1.0/chiaki_lib/swresample-5.dll +0 -0
  34. chiaki_lib-0.1.0/chiaki_lib/swscale-8.dll +0 -0
  35. chiaki_lib-0.1.0/chiaki_lib/vulkan-1.dll +0 -0
  36. chiaki_lib-0.1.0/chiaki_lib/z.dll +0 -0
  37. chiaki_lib-0.1.0/chiaki_lib.egg-info/PKG-INFO +134 -0
  38. chiaki_lib-0.1.0/chiaki_lib.egg-info/SOURCES.txt +108 -0
  39. chiaki_lib-0.1.0/chiaki_lib.egg-info/dependency_links.txt +1 -0
  40. chiaki_lib-0.1.0/chiaki_lib.egg-info/requires.txt +4 -0
  41. chiaki_lib-0.1.0/chiaki_lib.egg-info/scm_file_list.json +88 -0
  42. chiaki_lib-0.1.0/chiaki_lib.egg-info/scm_version.json +8 -0
  43. chiaki_lib-0.1.0/chiaki_lib.egg-info/top_level.txt +1 -0
  44. chiaki_lib-0.1.0/cmake/BuildLibplacebo.cmake +102 -0
  45. chiaki_lib-0.1.0/examples/1.1_login.py +151 -0
  46. chiaki_lib-0.1.0/examples/1.2_discover_hosts.py +50 -0
  47. chiaki_lib-0.1.0/examples/1.3_register_console.py +71 -0
  48. chiaki_lib-0.1.0/examples/1.4.1_stream_cpu.py +50 -0
  49. chiaki_lib-0.1.0/examples/1.4.2_stream_cuda.py +54 -0
  50. chiaki_lib-0.1.0/examples/1.4.3_stream_vulkan.py +104 -0
  51. chiaki_lib-0.1.0/examples/cuda_gl.py +235 -0
  52. chiaki_lib-0.1.0/examples/fps_overlay.py +64 -0
  53. chiaki_lib-0.1.0/examples/glfw_video.py +71 -0
  54. chiaki_lib-0.1.0/examples/helpers.py +262 -0
  55. chiaki_lib-0.1.0/pybind/CMakeLists.txt +262 -0
  56. chiaki_lib-0.1.0/pybind/bindings/generate_bindings.py +377 -0
  57. chiaki_lib-0.1.0/pybind/bindings/module.cpp +32 -0
  58. chiaki_lib-0.1.0/pybind/bindings/pydef.h +24 -0
  59. chiaki_lib-0.1.0/pybind/bindings/pydef_audio.cpp +78 -0
  60. chiaki_lib-0.1.0/pybind/bindings/pydef_backend.cpp +106 -0
  61. chiaki_lib-0.1.0/pybind/bindings/pydef_chiaki.cpp +174 -0
  62. chiaki_lib-0.1.0/pybind/bindings/pydef_discovery.cpp +87 -0
  63. chiaki_lib-0.1.0/pybind/bindings/pydef_event_source.cpp +46 -0
  64. chiaki_lib-0.1.0/pybind/bindings/pydef_frame_handler.cpp +132 -0
  65. chiaki_lib-0.1.0/pybind/bindings/pydef_session.cpp +282 -0
  66. chiaki_lib-0.1.0/pybind/bindings/pydef_settings.cpp +273 -0
  67. chiaki_lib-0.1.0/pybind/bindings/pydef_vulkan_renderer.cpp +69 -0
  68. chiaki_lib-0.1.0/pybind/include/audio_handler.h +64 -0
  69. chiaki_lib-0.1.0/pybind/include/audio_output.h +47 -0
  70. chiaki_lib-0.1.0/pybind/include/backend.h +277 -0
  71. chiaki_lib-0.1.0/pybind/include/chiaki_py_controller.h +160 -0
  72. chiaki_lib-0.1.0/pybind/include/chiakipysession.h +400 -0
  73. chiaki_lib-0.1.0/pybind/include/cuda_driver.h +216 -0
  74. chiaki_lib-0.1.0/pybind/include/discovery_manager.h +80 -0
  75. chiaki_lib-0.1.0/pybind/include/elapsed_timer.h +47 -0
  76. chiaki_lib-0.1.0/pybind/include/event_queue.h +41 -0
  77. chiaki_lib-0.1.0/pybind/include/event_source.h +167 -0
  78. chiaki_lib-0.1.0/pybind/include/exception.h +19 -0
  79. chiaki_lib-0.1.0/pybind/include/frame_handler.h +227 -0
  80. chiaki_lib-0.1.0/pybind/include/host.h +137 -0
  81. chiaki_lib-0.1.0/pybind/include/nv12_to_rgb_ptx.h +160 -0
  82. chiaki_lib-0.1.0/pybind/include/placebo_vulkan.h +55 -0
  83. chiaki_lib-0.1.0/pybind/include/pylog.h +50 -0
  84. chiaki_lib-0.1.0/pybind/include/sessionlog.h +38 -0
  85. chiaki_lib-0.1.0/pybind/include/settings.h +300 -0
  86. chiaki_lib-0.1.0/pybind/include/timer.h +63 -0
  87. chiaki_lib-0.1.0/pybind/include/utils.h +51 -0
  88. chiaki_lib-0.1.0/pybind/include/vulkan_renderer.h +70 -0
  89. chiaki_lib-0.1.0/pybind/src/audio_handler.cpp +103 -0
  90. chiaki_lib-0.1.0/pybind/src/audio_output.cpp +91 -0
  91. chiaki_lib-0.1.0/pybind/src/backend.cpp +42 -0
  92. chiaki_lib-0.1.0/pybind/src/chiaki_py_controller.cpp +340 -0
  93. chiaki_lib-0.1.0/pybind/src/chiakipysession.cpp +704 -0
  94. chiaki_lib-0.1.0/pybind/src/cuda/nv12_to_rgb.cl +59 -0
  95. chiaki_lib-0.1.0/pybind/src/discovery_manager.cpp +380 -0
  96. chiaki_lib-0.1.0/pybind/src/frame_handler.cpp +527 -0
  97. chiaki_lib-0.1.0/pybind/src/host.cpp +99 -0
  98. chiaki_lib-0.1.0/pybind/src/libav_impl.c +7 -0
  99. chiaki_lib-0.1.0/pybind/src/placebo_vulkan.cpp +271 -0
  100. chiaki_lib-0.1.0/pybind/src/pylog.cpp +141 -0
  101. chiaki_lib-0.1.0/pybind/src/sessionlog.cpp +118 -0
  102. chiaki_lib-0.1.0/pybind/src/settings.cpp +209 -0
  103. chiaki_lib-0.1.0/pybind/src/utils.cpp +94 -0
  104. chiaki_lib-0.1.0/pybind/src/vulkan_renderer.cpp +420 -0
  105. chiaki_lib-0.1.0/pyproject.toml +59 -0
  106. chiaki_lib-0.1.0/requirements-dev.txt +10 -0
  107. chiaki_lib-0.1.0/requirements.txt +1 -0
  108. chiaki_lib-0.1.0/setup.cfg +4 -0
  109. chiaki_lib-0.1.0/setup.py +10 -0
  110. chiaki_lib-0.1.0/vcpkg.json +23 -0
@@ -0,0 +1,149 @@
1
+ name: Build (macOS)
2
+ # on:
3
+ # push:
4
+ # branches: [main]
5
+ # tags-ignore:
6
+ # - "**"
7
+ # pull_request:
8
+ # workflow_dispatch:
9
+ # workflow_call:
10
+
11
+ on:
12
+ workflow_dispatch:
13
+ workflow_call:
14
+
15
+ jobs:
16
+ build:
17
+ name: Build wheel (macosx_15_0_arm64, Python ${{ matrix.python-version }})
18
+ runs-on: macos-15
19
+ strategy:
20
+ fail-fast: false
21
+ matrix:
22
+ python-version: ["3.11", "3.12", "3.13", "3.14"]
23
+ env:
24
+ PYTHON_VERSION: ${{ matrix.python-version }}
25
+ MACOSX_DEPLOYMENT_TARGET: "15.0"
26
+
27
+ defaults:
28
+ run:
29
+ shell: bash
30
+
31
+ steps:
32
+ - uses: actions/checkout@v7
33
+ with:
34
+ fetch-depth: 0
35
+
36
+ - name: Set up Python ${{ env.PYTHON_VERSION }}
37
+ uses: actions/setup-python@v7
38
+ with:
39
+ python-version: ${{ env.PYTHON_VERSION }}
40
+
41
+ - name: Install Python build/CI tooling
42
+ run: |
43
+ python -m pip install --upgrade pip
44
+ python -m pip install --upgrade "protobuf==7.36.2" "grpcio-tools==1.84.0" build twine "delocate>=0.11"
45
+
46
+ - name: Install native dependencies
47
+ run: |
48
+ brew update
49
+ brew install \
50
+ cmake ninja nasm pkgconf \
51
+ protobuf openssl@3 fmt \
52
+ opus json-c miniupnpc libevent speexdsp \
53
+ ffmpeg hidapi fftw lcms2 \
54
+ vulkan-headers vulkan-loader
55
+
56
+ - name: Build SDL2 (real SDL2, not sdl2-compat)
57
+ run: |
58
+ brew unlink sdl2-compat || true
59
+ if pkg-config --exists sdl2-compat; then
60
+ echo "::error::sdl2-compat is still visible to pkg-config"
61
+ exit 1
62
+ fi
63
+ prefix="$RUNNER_TEMP/sdl2"
64
+ echo "SDL2_PREFIX=$prefix" >> "$GITHUB_ENV"
65
+ git clone --depth 1 --branch release-2.32.10 https://github.com/libsdl-org/SDL.git "$RUNNER_TEMP/SDL2-src"
66
+ cmake -S "$RUNNER_TEMP/SDL2-src" -B "$RUNNER_TEMP/SDL2-build" -G Ninja \
67
+ -DCMAKE_BUILD_TYPE=Release \
68
+ -DCMAKE_OSX_ARCHITECTURES=arm64 \
69
+ -DCMAKE_OSX_DEPLOYMENT_TARGET="$MACOSX_DEPLOYMENT_TARGET" \
70
+ -DCMAKE_INSTALL_PREFIX="$prefix" \
71
+ -DSDL_SHARED=ON -DSDL_STATIC=OFF -DSDL_TESTS=OFF
72
+ cmake --build "$RUNNER_TEMP/SDL2-build"
73
+ cmake --install "$RUNNER_TEMP/SDL2-build"
74
+
75
+ - name: Point compiler/linker at Homebrew
76
+ run: |
77
+ echo "CPATH=$(brew --prefix)/include" >> "$GITHUB_ENV"
78
+ echo "LIBRARY_PATH=$(brew --prefix)/lib" >> "$GITHUB_ENV"
79
+ echo "PKG_CONFIG_PATH=$SDL2_PREFIX/lib/pkgconfig:$(brew --prefix openssl@3)/lib/pkgconfig:$(brew --prefix protobuf)/lib/pkgconfig" >> "$GITHUB_ENV"
80
+ echo "$(brew --prefix protobuf)/bin" >> "$GITHUB_PATH"
81
+
82
+ - name: Configure
83
+ run: |
84
+ # Fail here, not at runtime, if the build would pick up the
85
+ # sdl2-compat shim instead of the real SDL2 built above.
86
+ pkg-config --modversion sdl2
87
+ if pkg-config --exists sdl2-compat; then
88
+ echo "::error::sdl2-compat is visible to pkg-config; the wheel would bundle the shim"
89
+ exit 1
90
+ fi
91
+ cmake --fresh -S . -B build-release -G Ninja -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
92
+ -DCMAKE_BUILD_TYPE=Release \
93
+ -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ \
94
+ -DCMAKE_OSX_ARCHITECTURES=arm64 \
95
+ -DCMAKE_OSX_DEPLOYMENT_TARGET="$MACOSX_DEPLOYMENT_TARGET" \
96
+ -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
97
+ -DPython3_EXECUTABLE="$(which python)" -DPython_EXECUTABLE="$(which python)" -DPYTHON_EXECUTABLE="$(which python)" \
98
+ -DCMAKE_PREFIX_PATH="$SDL2_PREFIX;$(brew --prefix);$(brew --prefix openssl@3);$(brew --prefix protobuf)" \
99
+ -DCMAKE_SHARED_LINKER_FLAGS="-Wl,-rpath,$(brew --prefix)/lib -Wl,-rpath,$SDL2_PREFIX/lib" \
100
+ -DCMAKE_MODULE_LINKER_FLAGS="-Wl,-rpath,$(brew --prefix)/lib -Wl,-rpath,$SDL2_PREFIX/lib"
101
+
102
+ - name: Build chiaki-lib
103
+ run: cmake --build build-release --config Release --target chiaki-lib-py -- -j"$(sysctl -n hw.ncpu)"
104
+
105
+ - name: Build wheel
106
+ env:
107
+ _PYTHON_HOST_PLATFORM: macosx-15.0-arm64
108
+ ARCHFLAGS: "-arch arm64"
109
+ run: python -m build --wheel --outdir wheelhouse-raw
110
+
111
+ - name: Repair wheel (bundle dylibs)
112
+ run: |
113
+ delocate-listdeps wheelhouse-raw/*.whl
114
+ delocate-wheel --require-archs arm64 -w dist -v wheelhouse-raw/*.whl
115
+
116
+ - name: Check distributions
117
+ run: python -m twine check dist/*
118
+
119
+ - name: Smoke test wheel
120
+ working-directory: ${{ runner.temp }}
121
+ timeout-minutes: 5
122
+ run: |
123
+ python -m venv smoke-venv
124
+ smoke-venv/bin/python -m pip install --no-deps "$GITHUB_WORKSPACE"/dist/*.whl
125
+ smoke-venv/bin/python -m pip install numpy
126
+
127
+ site="$(smoke-venv/bin/python -c 'import sysconfig; print(sysconfig.get_paths()["purelib"])')"
128
+ status=0
129
+ for f in "$site"/chiaki_lib/_native.*.so "$site"/chiaki_lib/.dylibs/*.dylib; do
130
+ if otool -L "$f" | tail -n +2 | grep -E '/opt/homebrew|/usr/local'; then
131
+ echo "::error::$f still links against Homebrew"
132
+ status=1
133
+ fi
134
+ done
135
+ [ "$status" -eq 0 ] || exit 1
136
+
137
+ smoke-venv/bin/python -X faulthandler -c "
138
+ import faulthandler
139
+ faulthandler.dump_traceback_later(60, exit=True)
140
+ import chiaki_lib as lib
141
+ print(lib.__file__)
142
+ assert 'site-packages' in lib.__file__
143
+ "
144
+
145
+ - uses: actions/upload-artifact@v7
146
+ with:
147
+ name: dist-macos-${{ matrix.python-version }}
148
+ path: dist/
149
+ if-no-files-found: error
@@ -0,0 +1,156 @@
1
+ name: Build (Raspberry Pi)
2
+ # on:
3
+ # push:
4
+ # branches: [main]
5
+ # tags-ignore:
6
+ # - "**"
7
+ # pull_request:
8
+ # workflow_dispatch:
9
+ # workflow_call:
10
+
11
+ on:
12
+ workflow_dispatch:
13
+ workflow_call:
14
+
15
+ jobs:
16
+ build:
17
+ name: Build wheel (linux_aarch64 for Raspberry Pi OS, Python ${{ matrix.python-version }})
18
+ # A native arm64 runner, but the build itself runs in Debian 12 (Bookworm), which is what 64-bit
19
+ # Raspberry Pi OS is based on: its glibc (2.36) decides the manylinux tag auditwheel can give the
20
+ # wheel, and one built on the runner's own Ubuntu 24.04 (glibc 2.39) would not install on a Pi.
21
+ # Bookworm only ships Python 3.11, so each version is a portable python-build-standalone build
22
+ # installed with uv; those need glibc 2.17 and run fine in the container.
23
+ # Raspberry Pi 3/4/5 (and Zero 2 W) running a 64-bit OS only; 32-bit (armhf) Pi OS is not covered.
24
+ runs-on: ubuntu-24.04-arm
25
+ container: debian:bookworm
26
+ strategy:
27
+ fail-fast: false
28
+ matrix:
29
+ python-version: ["3.11", "3.12", "3.13", "3.14"]
30
+ env:
31
+ # Bookworm's FFmpeg (5.1, also what Raspberry Pi OS ships) is too old for chiaki-ng, which needs
32
+ # AVFrame.duration (FFmpeg 6.0+), so a newer one is built here and auditwheel bundles it into the
33
+ # wheel. Only what chiaki-lib uses: the H.264/HEVC software decoders and swscale. LGPL, no --enable-gpl.
34
+ FFMPEG_VERSION: "7.1.1"
35
+ FFMPEG_PREFIX: /opt/ffmpeg
36
+
37
+ defaults:
38
+ run:
39
+ shell: bash
40
+
41
+ steps:
42
+ - name: Install native dependencies
43
+ env:
44
+ DEBIAN_FRONTEND: noninteractive
45
+ run: |
46
+ apt-get update
47
+ apt-get install -y --no-install-recommends \
48
+ ca-certificates git file curl xz-utils \
49
+ build-essential ninja-build cmake pkg-config \
50
+ python3 python3-dev python3-venv \
51
+ protobuf-compiler libprotobuf-dev \
52
+ libopus-dev libjson-c-dev libminiupnpc-dev libpsl-dev libevdev-dev libevent-dev \
53
+ libgf-complete-dev libspeexdsp-dev libidn2-dev libnghttp2-dev libssh2-1-dev \
54
+ libfmt-dev \
55
+ libsdl2-dev libhidapi-dev libssl-dev libfftw3-dev liblcms2-dev libvulkan-dev zlib1g-dev
56
+
57
+ - uses: actions/checkout@v7
58
+ with:
59
+ fetch-depth: 0
60
+
61
+ - name: Trust the checkout
62
+ # The workspace is owned by the runner's user, not the container's root; without this git
63
+ # refuses to read the repo, and setuptools-scm finds no version.
64
+ run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
65
+
66
+ - name: Cache FFmpeg
67
+ id: ffmpeg-cache
68
+ uses: actions/cache@v6
69
+ with:
70
+ path: ${{ env.FFMPEG_PREFIX }}
71
+ # Bump the trailing revision when the configure flags below change.
72
+ key: ffmpeg-${{ env.FFMPEG_VERSION }}-bookworm-arm64-r1
73
+
74
+ - name: Build FFmpeg ${{ env.FFMPEG_VERSION }}
75
+ if: steps.ffmpeg-cache.outputs.cache-hit != 'true'
76
+ working-directory: ${{ runner.temp }}
77
+ run: |
78
+ curl -fsSL "https://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.xz" | tar xJ
79
+ cd "ffmpeg-$FFMPEG_VERSION"
80
+ ./configure --prefix="$FFMPEG_PREFIX" \
81
+ --enable-shared --disable-static --enable-pic \
82
+ --disable-programs --disable-doc \
83
+ --disable-autodetect --enable-pthreads \
84
+ --disable-everything \
85
+ --disable-avdevice --disable-avfilter --disable-swresample \
86
+ --enable-decoder=h264,hevc --enable-parser=h264,hevc
87
+ make -j"$(nproc)"
88
+ make install
89
+
90
+ - name: Point the build at FFmpeg
91
+ # LD_LIBRARY_PATH too: the stub generator imports the module right after it is built, and
92
+ # auditwheel has to find the libraries to bundle them.
93
+ run: |
94
+ echo "PKG_CONFIG_PATH=$FFMPEG_PREFIX/lib/pkgconfig" >> "$GITHUB_ENV"
95
+ echo "LD_LIBRARY_PATH=$FFMPEG_PREFIX/lib" >> "$GITHUB_ENV"
96
+ PKG_CONFIG_PATH="$FFMPEG_PREFIX/lib/pkgconfig" pkg-config --modversion libavcodec libavformat libavutil libswscale
97
+
98
+ - name: Set up uv
99
+ uses: astral-sh/setup-uv@v10.2.0
100
+
101
+ - name: Set up Python ${{ matrix.python-version }} and build/CI tooling
102
+ run: |
103
+ uv python install ${{ matrix.python-version }}
104
+ echo "BUILD_PYTHON=$(uv python find ${{ matrix.python-version }})" >> "$GITHUB_ENV"
105
+ uv venv --seed --python ${{ matrix.python-version }} "$RUNNER_TEMP/venv"
106
+ echo "$RUNNER_TEMP/venv/bin" >> "$GITHUB_PATH"
107
+ "$RUNNER_TEMP/venv/bin/python" -m pip install --upgrade pip
108
+ "$RUNNER_TEMP/venv/bin/python" -m pip install --upgrade protobuf build twine auditwheel patchelf
109
+
110
+ - name: Configure
111
+ run: |
112
+ python --version
113
+ cmake --fresh -S . -B build-release -G Ninja -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
114
+ -DCMAKE_BUILD_TYPE=Release \
115
+ -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/g++ \
116
+ -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
117
+ -DPython3_EXECUTABLE="$(which python)" -DPython_EXECUTABLE="$(which python)" -DPYTHON_EXECUTABLE="$(which python)"
118
+
119
+ - name: Build chiaki-lib
120
+ run: cmake --build build-release --config Release --target chiaki-lib-py -- -j"$(nproc)"
121
+
122
+ - name: Build wheel
123
+ run: python -m build --wheel --outdir wheelhouse-raw
124
+
125
+ - name: Repair wheel (bundle shared libraries, manylinux tag)
126
+ run: |
127
+ auditwheel show wheelhouse-raw/*.whl
128
+ auditwheel repair wheelhouse-raw/*.whl --wheel-dir dist
129
+
130
+ - name: Check distributions
131
+ run: python -m twine check dist/*
132
+
133
+ - name: Smoke test wheel
134
+ working-directory: ${{ runner.temp }}
135
+ run: |
136
+ # Only what the wheel bundles may be used here, not the FFmpeg build it was made from.
137
+ unset LD_LIBRARY_PATH
138
+ "$BUILD_PYTHON" -m venv smoke-venv
139
+ smoke-venv/bin/python -m pip install --no-deps "$GITHUB_WORKSPACE"/dist/*.whl
140
+ smoke-venv/bin/python -m pip install numpy
141
+ smoke-venv/bin/python -c "import chiaki_lib as lib; print(lib.__file__); assert 'site-packages' in lib.__file__"
142
+ # SDL's audio subsystem has to start from the bundled library; runners have no sound card, hence the dummy driver.
143
+ SDL_AUDIODRIVER=dummy smoke-venv/bin/python -c "from chiaki_lib import AudioOutput; print('audio devices:', AudioOutput.get_devices())"
144
+ site="$(smoke-venv/bin/python -c 'import sysconfig; print(sysconfig.get_paths()["purelib"])')"
145
+ so=$(echo "$site"/chiaki_lib/_native.*.so)
146
+ file "$so"
147
+ if ldd "$so" | grep "not found"; then
148
+ echo "::error::$so has unresolved shared libraries"
149
+ exit 1
150
+ fi
151
+
152
+ - uses: actions/upload-artifact@v7
153
+ with:
154
+ name: dist-raspberrypi-${{ matrix.python-version }}
155
+ path: dist/
156
+ if-no-files-found: error
@@ -0,0 +1,96 @@
1
+ name: Build (Ubuntu)
2
+ # on:
3
+ # push:
4
+ # branches: [main]
5
+ # tags-ignore:
6
+ # - "**"
7
+ # pull_request:
8
+ # workflow_dispatch:
9
+ # workflow_call:
10
+
11
+ on:
12
+ workflow_dispatch:
13
+ workflow_call:
14
+
15
+ jobs:
16
+ build:
17
+ name: Build wheel (linux_x86_64, Python ${{ matrix.python-version }})
18
+ runs-on: ubuntu-24.04
19
+ strategy:
20
+ fail-fast: false
21
+ matrix:
22
+ python-version: ["3.11", "3.12", "3.13", "3.14"]
23
+ env:
24
+ PYTHON_VERSION: ${{ matrix.python-version }}
25
+
26
+ defaults:
27
+ run:
28
+ shell: bash
29
+
30
+ steps:
31
+ - uses: actions/checkout@v7
32
+ with:
33
+ fetch-depth: 0
34
+
35
+ - name: Set up Python ${{ env.PYTHON_VERSION }}
36
+ uses: actions/setup-python@v7
37
+ with:
38
+ python-version: ${{ env.PYTHON_VERSION }}
39
+
40
+ - name: Install Python build/CI tooling
41
+ run: |
42
+ python -m pip install --upgrade pip
43
+ python -m pip install --upgrade protobuf build twine
44
+
45
+ - name: Install native dependencies
46
+ run: |
47
+ sudo apt-get update
48
+ sudo apt-get install -y \
49
+ build-essential ninja-build cmake git pkg-config nasm \
50
+ python3-dev \
51
+ protobuf-compiler libprotobuf-dev \
52
+ libopus-dev libjson-c-dev libminiupnpc-dev libpsl-dev libevdev-dev libevent-dev \
53
+ libgf-complete-dev libspeexdsp-dev libidn2-dev libnghttp2-dev libssh2-1-dev \
54
+ libfmt-dev libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libavdevice-dev \
55
+ libsdl2-dev libhidapi-dev libssl-dev libfftw3-dev liblcms2-dev libvulkan-dev zlib1g-dev \
56
+ libplacebo-dev libx11-dev
57
+
58
+ - name: Configure
59
+ run: |
60
+ cmake --fresh -S . -B build-release -G Ninja -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
61
+ -DCMAKE_BUILD_TYPE=Release \
62
+ -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/g++ \
63
+ -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DPython3_EXECUTABLE="$(which python)" -DPython_EXECUTABLE="$(which python)" -DPYTHON_EXECUTABLE="$(which python)"
64
+
65
+ - name: Build chiaki-lib
66
+ run: cmake --build build-release --config Release --target chiaki-lib-py -- -j"$(nproc)"
67
+
68
+ - name: Build wheel
69
+ run: python -m build --wheel --outdir wheelhouse-raw
70
+
71
+ - name: Repair wheel (bundle shared libraries, manylinux tag)
72
+ run: |
73
+ python -m pip install auditwheel patchelf
74
+ auditwheel show wheelhouse-raw/*.whl
75
+ auditwheel repair wheelhouse-raw/*.whl --wheel-dir dist
76
+
77
+ - name: Check distributions
78
+ run: python -m twine check dist/*
79
+
80
+ - name: Smoke test wheel
81
+ working-directory: ${{ runner.temp }}
82
+ run: |
83
+ python -m venv smoke-venv
84
+ smoke-venv/bin/python -m pip install --no-deps "$GITHUB_WORKSPACE"/dist/*.whl
85
+ smoke-venv/bin/python -m pip install numpy
86
+ smoke-venv/bin/python -c "import chiaki_lib as lib; print(lib.__file__); assert 'site-packages' in lib.__file__"
87
+ # SDL's audio subsystem has to start from the bundled library; runners have no sound card, hence the dummy driver.
88
+ SDL_AUDIODRIVER=dummy smoke-venv/bin/python -c "from chiaki_lib import AudioOutput; print('audio devices:', AudioOutput.get_devices())"
89
+ site="$(smoke-venv/bin/python -c 'import sysconfig; print(sysconfig.get_paths()["purelib"])')"
90
+ ldd "$site"/chiaki_lib/_native.*.so
91
+
92
+ - uses: actions/upload-artifact@v7
93
+ with:
94
+ name: dist-ubuntu-${{ matrix.python-version }}
95
+ path: dist/
96
+ if-no-files-found: error
@@ -0,0 +1,107 @@
1
+ name: Build (Windows)
2
+ # on:
3
+ # push:
4
+ # branches: [main]
5
+ # tags-ignore:
6
+ # - "**"
7
+ # pull_request:
8
+ # workflow_dispatch:
9
+ # workflow_call:
10
+
11
+ on:
12
+ workflow_dispatch:
13
+ workflow_call:
14
+
15
+ jobs:
16
+ build:
17
+ name: Build wheel (win_amd64, Python ${{ matrix.python-version }})
18
+ runs-on: windows-latest
19
+ strategy:
20
+ fail-fast: false
21
+ matrix:
22
+ python-version: ["3.11", "3.12", "3.13", "3.14"]
23
+ env:
24
+ PYTHON_VERSION: ${{ matrix.python-version }}
25
+ VCPKG_ROOT: ${{ github.workspace }}\vcpkg
26
+ VCPKG_TAG: "2026.07.29"
27
+
28
+ defaults:
29
+ run:
30
+ shell: powershell
31
+
32
+ steps:
33
+ - uses: actions/checkout@v7
34
+ with:
35
+ fetch-depth: 0
36
+
37
+ - name: Set up Python ${{ env.PYTHON_VERSION }}
38
+ uses: actions/setup-python@v7
39
+ with:
40
+ python-version: ${{ env.PYTHON_VERSION }}
41
+ architecture: "x64"
42
+
43
+ - name: Install Python build/CI tooling
44
+ run: |
45
+ python -m pip install --upgrade pip
46
+ python -m pip install --upgrade "protobuf==7.36.2" "grpcio-tools==1.84.0" build twine meson
47
+
48
+ - name: Set up Ninja
49
+ run: choco install ninja --no-progress -y
50
+
51
+ - name: Set up CMake
52
+ run: |
53
+ choco install cmake --version=4.4.3 --installargs "ADD_CMAKE_TO_PATH=System" --no-progress -y --allow-downgrade --force
54
+ echo "$env:ProgramFiles\CMake\bin" >> $env:GITHUB_PATH
55
+
56
+ - name: Set up Clang
57
+ run: |
58
+ choco install llvm --version=20.1.8 --no-progress -y --allow-downgrade
59
+ echo "$env:ProgramFiles\LLVM\bin" >> $env:GITHUB_PATH
60
+
61
+ - name: Set up MSVC dev environment
62
+ uses: ilammy/msvc-dev-cmd@v1
63
+
64
+ - name: Reset VCPKG_ROOT
65
+ run: echo "VCPKG_ROOT=$env:GITHUB_WORKSPACE\vcpkg" >> $env:GITHUB_ENV
66
+
67
+ - name: Cache vcpkg binary cache
68
+ uses: actions/cache@v6
69
+ with:
70
+ path: ~\AppData\Local\vcpkg\archives
71
+ key: vcpkg-${{ runner.os }}-${{ env.VCPKG_TAG }}-${{ hashFiles('vcpkg.json') }}
72
+ restore-keys: |
73
+ vcpkg-${{ runner.os }}-${{ env.VCPKG_TAG }}-
74
+
75
+ - name: Set up vcpkg
76
+ run: |
77
+ git clone --branch "$env:VCPKG_TAG" --depth 1 https://github.com/microsoft/vcpkg "$env:VCPKG_ROOT"
78
+ & "$env:VCPKG_ROOT\bootstrap-vcpkg.bat"
79
+
80
+ - name: Configure
81
+ run: |
82
+ $py = (Get-Command python).Source
83
+ cmake --fresh -S . -B build-release -G Ninja -DCMAKE_POLICY_VERSION_MINIMUM="3.5" `
84
+ -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" `
85
+ -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl `
86
+ -DCMAKE_BUILD_TYPE=Release `
87
+ -DPython3_EXECUTABLE="$py" -DPython_EXECUTABLE="$py" -DPYTHON_EXECUTABLE="$py"
88
+
89
+ - name: Build chiaki-lib
90
+ run: cmake --build build-release --config Release --target chiaki-lib-py -- -j4
91
+
92
+ - name: Build wheel
93
+ run: python -m build --wheel
94
+
95
+ # One sdist is enough; the other matrix entries would upload identical copies.
96
+ - name: Build sdist
97
+ if: matrix.python-version == '3.11'
98
+ run: python -m build --sdist
99
+
100
+ - name: Check distributions
101
+ run: python -m twine check dist/*
102
+
103
+ - uses: actions/upload-artifact@v7
104
+ with:
105
+ name: dist-windows-${{ matrix.python-version }}
106
+ path: dist/
107
+ if-no-files-found: error
@@ -0,0 +1,66 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+ workflow_dispatch:
7
+
8
+ jobs:
9
+ build-windows:
10
+ uses: ./.github/workflows/build-windows.yml
11
+
12
+ build-ubuntu:
13
+ uses: ./.github/workflows/build-ubuntu.yml
14
+
15
+ build-macos:
16
+ uses: ./.github/workflows/build-macos.yml
17
+
18
+ build-raspberrypi:
19
+ uses: ./.github/workflows/build-raspberrypi.yml
20
+
21
+ publish-testpypi:
22
+ name: Publish to TestPyPI
23
+ if: github.event_name == 'workflow_dispatch'
24
+ needs: [build-windows, build-ubuntu, build-macos, build-raspberrypi]
25
+ runs-on: ubuntu-latest
26
+ environment:
27
+ name: testpypi
28
+ url: https://test.pypi.org/project/chiaki-lib/
29
+ permissions:
30
+ id-token: write
31
+ steps:
32
+ - uses: actions/download-artifact@v8
33
+ with:
34
+ pattern: dist-*
35
+ merge-multiple: true
36
+ path: dist/
37
+
38
+ - name: List distributions
39
+ run: ls -l dist/
40
+
41
+ - uses: pypa/gh-action-pypi-publish@release/v1
42
+ with:
43
+ repository-url: https://test.pypi.org/legacy/
44
+ skip-existing: true
45
+
46
+ publish:
47
+ name: Publish to PyPI
48
+ if: github.event_name == 'release'
49
+ needs: [build-windows, build-ubuntu, build-macos, build-raspberrypi]
50
+ runs-on: ubuntu-latest
51
+ environment:
52
+ name: pypi
53
+ url: https://pypi.org/project/chiaki-lib/
54
+ permissions:
55
+ id-token: write
56
+ steps:
57
+ - uses: actions/download-artifact@v8
58
+ with:
59
+ pattern: dist-*
60
+ merge-multiple: true
61
+ path: dist/
62
+
63
+ - name: List distributions
64
+ run: ls -l dist/
65
+
66
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,15 @@
1
+ build*/
2
+ deps/
3
+ libs/
4
+ vcpkg_installed/
5
+ *.log
6
+ __pycache__/
7
+ chiaki_lib/_native.*
8
+ chiaki_lib/*.dll
9
+ .vscode/
10
+
11
+ dist/
12
+ wheelhouse*/
13
+ *.egg-info/
14
+ scripts/
15
+ cache/