Video editing with Python
Update #530 - Split reqs and add setup.py handling
Mark Beacome78928e63cb0
diff --git a/.gitignore b/.gitignoreindex 4afc3b27..805b40e9 100644--- a/.gitignore+++ b/.gitignore@@ -10,6 +10,7 @@distbuildeggs+.eggspartsbinvar@@ -53,3 +54,7 @@ nosetests.xml# Teststests/media+media/++# Documentation+docs/build/diff --git a/README.rst b/README.rstindex 5c22a709..6298968d 100644--- a/README.rst+++ b/README.rst@@ -60,6 +60,10 @@ If you have neither ``setuptools`` nor ``ez_setup`` installed, the command aboveOptional but useful dependencies~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+You can install ``moviepy`` with all dependencies via:++ $ (sudo) pip install moviepy[optional]+ImageMagick_ is not strictly required, but needed if you want to incorporate texts. It can also be used as a backend for GIFs, though you can also create GIFs with MoviePy without ImageMagick.Once you have installed ImageMagick, it will be automatically detected by MoviePy, **except on Windows!** Windows users, before installing MoviePy by hand, need to edit ``moviepy/config_defaults.py`` to provide the path to the ImageMagick binary, which is called `convert`. It should look like this ::@@ -74,11 +78,12 @@ For advanced image processing, you will need one or several of the following pac- Scipy_ (for tracking, segmenting, etc.) can be used to resize video clips if PIL and OpenCV are not installed.- `Scikit Image`_ may be needed for some advanced image manipulation.- `OpenCV 2.4.6`_ or a more recent version (one that provides the package ``cv2``) may be needed for some advanced image manipulation.+- `Matplotlib`_Once you have installed it, ImageMagick will be automatically detected by MoviePy, (except for windows users and Ubuntu 16.04LTS users).For Windows users, before installing MoviePy by hand, go into the ``moviepy/config_defaults.py`` file and provide the path to the ImageMagick binary called `convert`. It should look like this ::-+IMAGEMAGICK_BINARY = "C:\\Program Files\\ImageMagick_VERSION\\convert.exe"For Ubuntu 16.04LTS users, after installing MoviePy on the terminal, IMAGEMAGICK will not be detected by moviepy. This bug can be fixed. Modify the file in this directory: /etc/ImageMagick-6/policy.xml, comment out the statement <!-- <policy domain="path" rights="none" pattern="@*" /> -->.@@ -88,6 +93,24 @@ PyGame_ is needed for video and sound previews (useless if you intend to work wiFor instance, using the method ``clip.resize`` requires that at least one of Scipy, PIL, Pillow or OpenCV is installed.+Documentation+-------------++The documentation can be generated and viewed via:++ $ cd docs/+ $ make clean html+ $ open build/html/index.html+++Running Tests+-------------++The testing suite can be executed via:++ $ python setup.py test++Contribute----------@@ -130,6 +153,7 @@ Maintainers.. _tqdm: https://github.com/noamraph/tqdm.. _ffmpeg: http://www.ffmpeg.org/download.html.. _ImageMagick: http://www.imagemagick.org/script/index.php+.. _`Matplotlib`: https://matplotlib.org/.. People.. _Zulko: https://github.com/Zulkodiff --git a/docs/Makefile b/docs/Makefileindex c077a760..5c6c2d7c 100644--- a/docs/Makefile+++ b/docs/Makefile@@ -2,10 +2,10 @@## You can set these variables from the command line.-SPHINXOPTS =+SPHINXOPTS =SPHINXBUILD = sphinx-buildPAPER =-BUILDDIR = ../../docs+BUILDDIR = buildPDFBUILDDIR = /tmpPDF = ../manual.pdfdiff --git a/docs/makehtml.sh b/docs/makehtml.shindex 6f848c3c..3bde8ca0 100755--- a/docs/makehtml.sh+++ b/docs/makehtml.sh@@ -1,8 +1,9 @@-make html+#!/bin/sh+make clean html# open generated HTML filesif [[ $(uname) == 'Darwin' ]]; then- open '../../docs/html/index.html' -a Firefox+ open 'build/html/index.html' -a Firefoxelif [[ $(uname) == 'Linux' ]]; then- firefox ../../docs/html/index.html+ firefox build/html/index.htmlfidiff --git a/requirements/base.txt b/requirements/base.txtnew file mode 100644index 00000000..e27389ea--- /dev/null+++ b/requirements/base.txt@@ -0,0 +1,4 @@+imageio==2.1.2+numpy==1.12.1+decorator==4.0.11+tqdm==4.11.2diff --git a/requirements_docs.txt b/requirements/docs.txtsimilarity index 73%rename from requirements_docs.txtrename to requirements/docs.txtindex d0375d93..1ba3f427 100644--- a/requirements_docs.txt+++ b/requirements/docs.txt@@ -1,6 +1,5 @@+-r optional.txtSphinx>=1.5.2sphinx_rtd_theme>=0.1.10b0numpydoc>=0.6.0pygame==1.9.3-scipy==0.19.0-tqdm==4.11.2\ No newline at end of filediff --git a/requirements/optional.txt b/requirements/optional.txtnew file mode 100644index 00000000..731e0252--- /dev/null+++ b/requirements/optional.txt@@ -0,0 +1,4 @@+-r base.txt+scikit-image==0.13.0+scipy==0.19.0+matplotlib==2.0.0diff --git a/requirements/test.txt b/requirements/test.txtnew file mode 100644index 00000000..ee2ac7aa--- /dev/null+++ b/requirements/test.txt@@ -0,0 +1,4 @@+-r optional.txt+nose==1.3.7+pytest==3.0.7+sklearn==0.18.1diff --git a/setup.py b/setup.pyindex ac0a4918..d8f9bf60 100644--- a/setup.py+++ b/setup.py@@ -2,28 +2,91 @@# This will try to import setuptools. If not here, it will reach for the embedded# ez_setup (or the ez_setup package). If none, it fails with a message+import sys+from codecs import open+try:- from setuptools import setup+ from setuptools import find_packages, setup+ from setuptools.command.test import test as TestCommandexcept ImportError:try:import ez_setupez_setup.use_setuptools()except ImportError:- raise ImportError("MoviePy could not be installed, probably because"- " neither setuptools nor ez_setup are installed on this computer."- "\nInstall ez_setup ([sudo] pip install ez_setup) and try again.")+ raise ImportError('MoviePy could not be installed, probably because'+ ' neither setuptools nor ez_setup are installed on this computer.'+ '\nInstall ez_setup ([sudo] pip install ez_setup) and try again.')+++class PyTest(TestCommand):+ """Handle test execution from setup."""++ user_options = [('pytest-args=', 'a', "Arguments to pass into py.test")]++ def initialize_options(self):+ """Initialize the PyTest options."""+ TestCommand.initialize_options(self)+ self.pytest_args = []++ def finalize_options(self):+ """Finalize the PyTest options."""+ TestCommand.finalize_options(self)+ self.test_args = []+ self.test_suite = True++ def run_tests(self):+ """Run the PyTest testing suite."""+ try:+ import pytest+ except ImportError:+ raise ImportError('Running tests requires additional dependencies.'+ '\nPlease run (pip install -r requirements/test.txt)')++ errno = pytest.main(self.pytest_args)+ sys.exit(errno)-from setuptools import setup, find_packagesexec(open('moviepy/version.py').read()) # loads __version__-setup(name='moviepy',+requires = ['numpy', 'decorator', 'imageio', 'tqdm']+test_requirements = ['pytest>=2.8.0', 'nose', 'sklearn']+optional_requirements = ['scikit-image', 'scipy']++with open('README.rst', 'r', 'utf-8') as f:+ readme = f.read()++setup(+ name='moviepy',version=__version__,author='Zulko 2017',description='Video editing with Python',- long_description=open('README.rst').read(),- url='http://zulko.github.io/moviepy/',+ long_description=readme,+ url='https://zulko.github.io/moviepy/',license='MIT License',- keywords="video editing audio compositing ffmpeg",- packages= find_packages(exclude='docs'),- install_requires= ['numpy', 'decorator', 'imageio', 'tqdm'])+ classifiers=(+ 'Development Status :: 5 - Production/Stable',+ 'Intended Audience :: Developers',+ 'Natural Language :: English',+ 'License :: OSI Approved :: MIT License',+ 'Programming Language :: Python',+ 'Programming Language :: Python :: 2.6',+ 'Programming Language :: Python :: 2.7',+ 'Programming Language :: Python :: 3',+ 'Programming Language :: Python :: 3.3',+ 'Programming Language :: Python :: 3.4',+ 'Programming Language :: Python :: 3.5',+ 'Programming Language :: Python :: 3.6',+ 'Topic :: Multimedia',+ 'Topic :: Multimedia :: Sound/Audio',+ 'Topic :: Multimedia :: Sound/Audio :: Analysis',+ 'Topic :: Multimedia :: Video',+ 'Topic :: Multimedia :: Video :: Capture',+ 'Topic :: Multimedia :: Video :: Conversion',+ ),+ keywords='video editing audio compositing ffmpeg',+ packages=find_packages(exclude='docs'),+ cmdclass={'test': PyTest},+ tests_require=test_requirements,+ install_requires=requires,+ extras_require={'optional': optional_requirements}+)