Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 14 additions & 18 deletions .github/workflows/smoke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ jobs:
- name: Checkout
uses: actions/checkout@v7
- name: Python
uses: actions/setup-python@v6
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
with:
activate-environment: true
python-version: "3.14"
- name: Linters
run: make lint
Expand All @@ -50,10 +51,10 @@ jobs:
name: Checkout

- name: Python ${{ matrix.config.python }}
uses: actions/setup-python@v6
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
with:
activate-environment: true
python-version: ${{ matrix.config.python }}
allow-prereleases: true

- name: OS Packages
run: |
Expand Down Expand Up @@ -163,27 +164,22 @@ jobs:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
- name: Set up host Python 3.12
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Set up host Python 3.14t
uses: actions/setup-python@v6
with:
python-version: "3.14t"
- name: Set up uv
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
- name: Install build tooling
run: |
for py in python3.12 python3.14t; do
$py -m pip install -U "cython>=3.1.0,<4" "setuptools>=77.0" wheel
done
uv venv --seed --python 3.12 .venv-3.12
uv venv --seed --python 3.14t .venv-3.14t
uv pip install --python .venv-3.12/bin/python -U "cython>=3.1.0,<4" "setuptools>=77.0" wheel
uv pip install --python .venv-3.14t/bin/python -U "cython>=3.1.0,<4" "setuptools>=77.0" wheel
# patchelf 0.18 (ubuntu-24.04's system version) corrupts ELF files
# with large p_align; pin <0.18 for auditwheel to use.
python3.12 -m pip install -U ziglang auditwheel 'patchelf<0.18'
uv pip install --python .venv-3.12/bin/python -U ziglang auditwheel 'patchelf<0.18'
- name: Cross-compile armv7l wheels with zig
env:
HOST_PY312: python3.12
HOST_PY314T: python3.14t
TOOLS_PY: python3.12
HOST_PY312: .venv-3.12/bin/python
HOST_PY314T: .venv-3.14t/bin/python
TOOLS_PY: .venv-3.12/bin/python
run: bash scripts/build-armv7l-cross.sh
- name: Set up QEMU
uses: docker/setup-qemu-action@v4
Expand Down
36 changes: 17 additions & 19 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ jobs:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v6
- uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
with:
activate-environment: true
python-version: "3.14"
- name: Build source package
run: |
pip install -U cython setuptools
uv pip install -U cython setuptools
python scripts/fetch-vendor.py --config-file scripts/ffmpeg-latest.json /tmp/vendor
PKG_CONFIG_PATH=/tmp/vendor/lib/pkgconfig python setup.py sdist
- name: Upload source package
Expand Down Expand Up @@ -42,8 +43,9 @@ jobs:
arch: ARM64
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v6
- uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
with:
activate-environment: true
python-version: "3.14"
- name: Set Minimum MacOS Target
if: runner.os == 'macOS'
Expand All @@ -64,10 +66,11 @@ jobs:
CIBW_ENVIRONMENT_WINDOWS: INCLUDE=C:\\cibw\\vendor\\include LIB=C:\\cibw\\vendor\\lib PYAV_SKIP_TESTS=unicode_filename
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: delvewheel repair --add-path C:\cibw\vendor\bin -w {dest_dir} {wheel}
CIBW_BUILD: "cp312* cp314t*"
CIBW_BUILD_FRONTEND: uv
CIBW_TEST_COMMAND: mv {project}/av {project}/av.disabled && python -m pytest {package}/tests && mv {project}/av.disabled {project}/av
CIBW_TEST_REQUIRES: pytest numpy
run: |
pip install cibuildwheel delvewheel
uv pip install cibuildwheel delvewheel
cibuildwheel --output-dir dist
shell: bash
- name: Upload wheels
Expand All @@ -83,27 +86,22 @@ jobs:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
- name: Set up host Python 3.12
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Set up host Python 3.14t
uses: actions/setup-python@v6
with:
python-version: "3.14t"
- name: Set up uv
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
- name: Install build tooling
run: |
for py in python3.12 python3.14t; do
$py -m pip install -U "cython>=3.1.0,<4" "setuptools>=77.0" wheel
done
uv venv --seed --python 3.12 .venv-3.12
uv venv --seed --python 3.14t .venv-3.14t
uv pip install --python .venv-3.12/bin/python -U "cython>=3.1.0,<4" "setuptools>=77.0" wheel
uv pip install --python .venv-3.14t/bin/python -U "cython>=3.1.0,<4" "setuptools>=77.0" wheel
# patchelf 0.18 (ubuntu-24.04's system version) corrupts ELF files
# with large p_align; pin <0.18 for auditwheel to use.
python3.12 -m pip install -U ziglang auditwheel 'patchelf<0.18'
uv pip install --python .venv-3.12/bin/python -U ziglang auditwheel 'patchelf<0.18'
- name: Cross-compile armv7l wheels with zig
env:
HOST_PY312: python3.12
HOST_PY314T: python3.14t
TOOLS_PY: python3.12
HOST_PY312: .venv-3.12/bin/python
HOST_PY314T: .venv-3.14t/bin/python
TOOLS_PY: .venv-3.12/bin/python
run: bash scripts/build-armv7l-cross.sh
- name: Upload wheels
uses: actions/upload-artifact@v6
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ LDFLAGS ?= ""
CFLAGS ?= "-O0 -Wno-unreachable-code"

PYAV_PYTHON ?= python
PYAV_PIP ?= pip
PYAV_PIP ?= uv pip
PYTHON := $(PYAV_PYTHON)
PIP := $(PYAV_PIP)

Expand All @@ -29,11 +29,11 @@ fate-suite:
rsync -vrltLW rsync://fate-suite.ffmpeg.org/fate-suite/ tests/assets/fate-suite/

lint:
$(PIP) install -U ruff isort pillow numpy mypy==2.1.0 pytest
$(PIP) install --group lint
ruff format --check av examples tests setup.py
isort --check-only --diff av examples tests
mypy av tests

test:
$(PIP) install --upgrade cython numpy pillow pytest
$(PIP) install --group test
$(PYTHON) -m pytest
2 changes: 1 addition & 1 deletion docs/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SPHINXOPTS =
BUILDDIR = _build
PYAV_PIP ?= pip
PYAV_PIP ?= uv pip
PIP := $(PYAV_PIP)
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(SPHINXOPTS) .

Expand Down
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,10 @@ homepage = "https://pyav.basswood.io"
profile = "black"
known_first_party = ["av"]
skip = ["av/__init__.py"]

[tool.uv]
prerelease = "allow"

[dependency-groups]
test = ["cython>=3.3.0,<4", "numpy", "pillow", "pytest"]
lint = ["ruff", "isort", "mypy==2.1.0", {include-group = "test"}]
6 changes: 3 additions & 3 deletions scripts/activate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ if [[ "$PYAV_PYTHON" == *pypy* ]]; then
fi

export PYAV_PYTHON
export PYAV_PIP="${PYAV_PIP-$PYAV_PYTHON -m pip}"
export UV_PYTHON="$PYAV_PYTHON"
export PYAV_PIP="${PYAV_PIP-uv pip}"

if [[ "$GITHUB_ACTION" ]]; then

Expand All @@ -64,8 +65,7 @@ print("{}{}.{}".format(platform.python_implementation().lower(), *sys.version_in

if [[ ! -e "$PYAV_VENV/bin/python" ]]; then
mkdir -p "$PYAV_VENV"
virtualenv -p "$PYAV_PYTHON" "$PYAV_VENV"
"$PYAV_VENV/bin/pip" install --upgrade pip setuptools
uv venv -p "$PYAV_PYTHON" "$PYAV_VENV"
fi

if [[ -e "$PYAV_VENV/bin/activate" ]]; then
Expand Down
Loading