diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a6c5232b3..e9e4003b9 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -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: @@ -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 diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 6539f496d..000000000 --- a/MANIFEST.in +++ /dev/null @@ -1,7 +0,0 @@ -include *.txt *.md -recursive-include av *.pyx *.pxd -recursive-include docs *.rst *.py -recursive-include examples *.py -recursive-include include *.pxd *.h -recursive-include src/av *.c *.h -recursive-include tests *.py diff --git a/README.md b/README.md index 7e21198e7..232fd6743 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/pyproject.toml b/pyproject.toml index 73e3cf334..15ed77023 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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" @@ -13,4 +60,4 @@ max-line-length = 142 per-file-ignores = [ "__init__.py:E402,F401", "*.pyx,*.pxd:E211,E225,E227,E402,E999", -] +] \ No newline at end of file diff --git a/setup.py b/setup.py index d0bee300b..bef384515 100644 --- a/setup.py +++ b/setup.py @@ -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", @@ -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 @@ -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", - ], )