Quick Start¶
This topic shows the quickest way to get AVBlocks for Python running on macOS. You need a terminal, Python 3.12 or higher and nothing else: no IDE or project files. The steps are: install the Python SDK, download AVBlocks Core, point the SDK to it, and run a script.
Install the Xcode Command Line Tools and uv if you don’t have them:
xcode-select --install
curl -LsSf https://astral.sh/uv/install.sh | sh
1. Create a virtual environment and install the SDK¶
We use uv to install Python and to create the virtual environment. The Python must match the architecture of your machine, so that it can load the AVBlocks Core library (on Apple Silicon use an arm64 Python, on Intel Macs an x64 Python).
mkdir -p ~/avblocks/hello
cd ~/avblocks/hello
Select the Python architecture. Use one of the following two blocks, depending on your machine:
# x64 (x86_64): use this one or the arm64 one, not both
export UV_PYTHON_ARCH=x86_64
# arm64 (aarch64, Apple Silicon): use this one or the x64 one, not both
export UV_PYTHON_ARCH=aarch64
Create the virtual environment and install the SDK:
uv venv --python 3.12
source .venv/bin/activate
uv pip install git+https://github.com/avblocks/avblocks-py.git@3.4.0.2
2. Download AVBlocks Core¶
Download the demo version of AVBlocks Core into ./sdk:
AVBLOCKS_BASE_URL="https://github.com/avblocks/avblocks-core/releases/download"
AVBLOCKS_VERSION="v3.4.0-demo.1"
# select the build that matches the machine
case "$(uname -m)" in
arm64|aarch64) PLATFORM="darwin-arm64"; ARCH="arm64" ;;
*) PLATFORM="darwin"; ARCH="x64" ;;
esac
mkdir -p ./sdk
cd ./sdk
curl -L \
-o "avblocks-${AVBLOCKS_VERSION}-${PLATFORM}.zip" \
"${AVBLOCKS_BASE_URL}/${AVBLOCKS_VERSION}/avblocks-${AVBLOCKS_VERSION}-${PLATFORM}.zip"
unzip -q "avblocks-${AVBLOCKS_VERSION}-${PLATFORM}.zip"
cd ..
3. Point the SDK to AVBlocks Core¶
Set AVBLOCKS_CORE_PATH to the directory that contains libAVBlocks.dylib:
export AVBLOCKS_CORE_PATH=$PWD/sdk/lib/$ARCH
4. Run a script¶
Create the file hello.py:
from avblocks import Library
Library.initialize()
print(Library.description())
Library.shutdown()
Run it:
python hello.py
The output looks similar to this:
AVBlocks.Python 3.4.0, core: AVBlocks 3.4.0 (ba37215) x64 Release Demo OSX
The environment variable is only set in the current terminal. In a new terminal run source .venv/bin/activate and the export AVBLOCKS_CORE_PATH=... command again.
Next steps¶
Installation has the same steps for all platforms and the demo assets used by the samples.
Try the Simple Video Converter or the Simple Audio Converter.