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
20 changes: 1 addition & 19 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,6 @@ on:
types: [published]
workflow_dispatch:
jobs:
package-source:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Build source package
run: |
pip install setuptools cython
python scripts/fetch-vendor.py --config-file scripts/ffmpeg-7.1.json /tmp/vendor
PKG_CONFIG_PATH=/tmp/vendor/lib/pkgconfig python setup.py sdist
- name: Upload source package
uses: actions/upload-artifact@v4
with:
name: dist-source
path: dist/

package-wheel:
runs-on: ${{ matrix.os }}
strategy:
Expand Down Expand Up @@ -82,7 +64,7 @@ jobs:

publish:
runs-on: ubuntu-latest
needs: [package-source, package-wheel]
needs: [package-wheel]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
Expand Down
7 changes: 0 additions & 7 deletions MANIFEST.in

This file was deleted.

16 changes: 3 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,10 @@ conda install av -c conda-forge
See the [Conda install][conda-install] docs to get started with (mini)Conda.


Alternative installation methods
--------------------------------
Installing From Source
----------------------

Due to the complexity of the dependencies, PyAV is not always the easiest Python package to install from source. If you want to use your existing ffmpeg (must be the correct major version), the source version of PyAV is on [PyPI][pypi]:

```bash
pip install av --no-binary av
```

> [!WARNING]
> This installation method won't work for Windows or Debian based systems.


And if you want to build from the absolute source (POSIX only):
Here's how to build PyAV from source source. You must use [MSYS2](https://www.msys2.org/) when using Windows.

```bash
git clone https://github.com/PyAV-Org/PyAV.git
Expand Down
51 changes: 49 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,52 @@
[build-system]
requires = ["setuptools", "cython"]
requires = ["setuptools>61", "cython>=3,<4"]

[project]
name = "av"
description = "Pythonic bindings for FFmpeg's libraries."
readme = "README.md"
license = {text = "BSD-3-Clause"}
authors = [
{name = "WyattBlue", email = "wyattblue@auto-editor.com"},
{name = "Jeremy Lainé", email = "jeremy.laine@m4x.org"},
]
requires-python = ">=3.9"
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Natural Language :: English",
"Operating System :: MacOS :: MacOS X",
"Operating System :: POSIX",
"Operating System :: Unix",
"Operating System :: Microsoft :: Windows",
"Programming Language :: Cython",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Multimedia :: Sound/Audio",
"Topic :: Multimedia :: Sound/Audio :: Conversion",
"Topic :: Multimedia :: Video",
"Topic :: Multimedia :: Video :: Conversion",
]
dynamic = ["version"]

[tool.setuptools]
zip-safe = false

[tool.setuptools.dynamic]
version = {attr = "av.about.__version__"}

[project.urls]
"Bug Tracker" = "https://github.com/PyAV-Org/PyAV/discussions/new?category=4-bugs"
"Source Code" = "https://github.com/PyAV-Org/PyAV"
homepage = "https://pyav.basswood-io.com"

[project.scripts]
"pyav" = "av.__main__:main"

[tool.isort]
profile = "black"
Expand All @@ -13,4 +60,4 @@ max-line-length = 142
per-file-ignores = [
"__init__.py:E402,F401",
"*.pyx,*.pxd:E211,E225,E227,E402,E999",
]
]
85 changes: 10 additions & 75 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,21 @@ def is_virtualenv():
)
sleep(3)

# Don't show message when using our project tooling.
if not is_virtualenv() or os.getenv("_PYAV_ACTIVATED", "") != "1":
print(
"\n\033[1;91mWarning!\033[0m You are installing from source.\n"
"It is \033[1;37mEXPECTED\033[0m that it will fail. You are \033[1;37mREQUIRED\033[0m"
" to use ffmpeg 7.\nYou \033[1;37mMUST\033[0m have Cython, pkg-config, and a C compiler.\n"
)
if os.getenv("GITHUB_ACTIONS") != "true":
sleep(3)
print(
"\n\033[1;91mWarning!\033[0m You are installing from source.\n"
"It is \033[1;37mEXPECTED\033[0m that it will fail. You are \033[1;37mREQUIRED\033[0m"
" to use ffmpeg 7.\nYou \033[1;37mMUST\033[0m have Cython, pkg-config, and a C compiler.\n"
)
if os.getenv("GITHUB_ACTIONS") == "true" or is_virtualenv():
pass
else:
print("\033[1;91mWarning!\033[0m You are not using a virtual environment")


from Cython.Build import cythonize
from Cython.Compiler.AutoDocTransforms import EmbedSignature
from setuptools import Extension, find_packages, setup


FFMPEG_LIBRARIES = [
"avformat",
"avcodec",
Expand Down Expand Up @@ -202,12 +201,8 @@ def parse_cflags(raw_flags):
include_path=["include"],
)

# Construct the modules that we find in the "av" directory.
for dirname, dirnames, filenames in os.walk("av"):
for filename in filenames:
if filename == "loudnorm.pyx":
continue

# We are looking for Cython sources.
if filename.startswith(".") or os.path.splitext(filename)[1] != ".pyx":
continue
Expand Down Expand Up @@ -242,74 +237,14 @@ def parse_cflags(raw_flags):
for cfile in ext.sources:
insert_enum_in_generated_files(cfile)

# Read package metadata
about = {}
about_file = os.path.join(os.path.dirname(__file__), "av", "about.py")
with open(about_file, encoding="utf-8") as fp:
exec(fp.read(), about)

package_folders = pathlib.Path("av").glob("**/")
package_data = {
".".join(pckg.parts): ["*.pxd", "*.pyi", "*.typed"] for pckg in package_folders
}

# Add include/ headers to av.include
package_dir = {
".".join(["av", *pckg.parts]): str(pckg)
for pckg in pathlib.Path("include").glob("**/")
}
package_data.update({pckg: ["*.pxd"] for pckg in package_dir})


with open("README.md") as f:
long_description = f.read()

setup(
name="av",
version=about["__version__"],
description="Pythonic bindings for FFmpeg's libraries.",
long_description=long_description,
long_description_content_type="text/markdown",
license="BSD",
project_urls={
"Bug Reports": "https://github.com/PyAV-Org/PyAV/discussions/new?category=4-bugs",
"Documentation": "https://pyav.basswood-io.com",
"Download": "https://pypi.org/project/av",
},
author="Mike Boers",
author_email="pyav@mikeboers.com",
url="https://github.com/PyAV-Org/PyAV",
packages=find_packages(
exclude=["build*", "examples*", "tests*", "include*", "AUTHORS*"]
)
+ list(package_dir.keys()),
package_dir=package_dir,
packages=find_packages(include=["av*"]),
package_data=package_data,
python_requires=">=3.9",
zip_safe=False,
ext_modules=ext_modules,
entry_points={
"console_scripts": ["pyav = av.__main__:main"],
},
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Natural Language :: English",
"Operating System :: MacOS :: MacOS X",
"Operating System :: POSIX",
"Operating System :: Unix",
"Operating System :: Microsoft :: Windows",
"Programming Language :: Cython",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Multimedia :: Sound/Audio",
"Topic :: Multimedia :: Sound/Audio :: Conversion",
"Topic :: Multimedia :: Video",
"Topic :: Multimedia :: Video :: Conversion",
],
)
Loading