PyAV-Org / PyAV

Pythonic bindings for FFmpeg's libraries.
https://pyav.basswood-io.com/
BSD 3-Clause "New" or "Revised" License
2.43k stars 359 forks source link

Allow building extensions without recompiling av #1356

Closed voxeljorge closed 1 month ago

voxeljorge commented 5 months ago

Any attempt to from av.packet cimport Packet and build shows a failure that looks like this:

Error compiling Cython file:
------------------------------------------------------------
...
cimport libav as lib
       ^
------------------------------------------------------------

/home/jorge/.local/lib/python3.8/site-packages/av/packet.pxd:1:8: 'libav.pxd' not found

Error compiling Cython file:
------------------------------------------------------------
...
cimport libav as lib

Overview

It looks like while the base pxd files are included, there are some missing which will cause a build failure. If libav.pxd and other files in include were included in the distribution somehow this would allow someone with the correct ffmpeg headers to build extensions on top of pyav without having to fully build pyav itself.

Expected behavior

Build should succeed

Actual behavior

Build fails

Build report:

I'm not actually building pyav from source, i'm using a pip installed version and trying to use the pxd files included in the pip package.

Investigation

I looked in site-packages/av and found that libav.pxd is completely missing.

Reproduction

Run this in a jupyter notebook:

%%cython
from av.packet cimport Packet

Versions

Research

I have done the following:

voxeljorge commented 5 months ago

I wasn't sure which tag to file this under, maybe bug is more appropriate?

voxeljorge commented 5 months ago

@WyattBlue This seems at minimum like a bug. The current pyav distribution includes pxd files which are impossible to use, so they should either be removed or fixed.

edit: the current pypi* distribution that is

WyattBlue commented 4 months ago

@WyattBlue This seems at minimum like a bug. The current pyav distribution includes pxd files which are impossible to use, so they should either be removed or fixed.

*edit: the current pypi distribution that is

I don't have the admin permissions to modify or remove any release on the av namespace. I'm labeling this as a feature request instead of a bug because, to my knowledge, no av release ever had this behaviour before and I don't think anyone expected this before.

The next step for this would be to find a minimal Cython project that demonstrations the settings needed to do this. Then a PR could be made.