Skip to content

Commit

Permalink
Update Zulko#530 - Split reqs and add setup.py handling
Browse files Browse the repository at this point in the history
  • Loading branch information
mbeacom committed Apr 12, 2017
1 parent 7216089 commit e78928e
Show file tree
Hide file tree
Showing 9 changed files with 123 additions and 19 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
dist
build
eggs
.eggs
parts
bin
var
Expand Down Expand Up @@ -53,3 +54,7 @@ nosetests.xml

# Tests
tests/media
media/

# Documentation
docs/build/
26 changes: 25 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ If you have neither ``setuptools`` nor ``ez_setup`` installed, the command above
Optional 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 ::
Expand All @@ -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="@*" /> -->.
Expand All @@ -88,6 +93,24 @@ PyGame_ is needed for video and sound previews (useless if you intend to work wi
For 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
----------

Expand Down Expand Up @@ -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/Zulko
Expand Down
4 changes: 2 additions & 2 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
#

# You can set these variables from the command line.
SPHINXOPTS =
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = ../../docs
BUILDDIR = build
PDFBUILDDIR = /tmp
PDF = ../manual.pdf

Expand Down
7 changes: 4 additions & 3 deletions docs/makehtml.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
make html
#!/bin/sh
make clean html

# open generated HTML files
if [[ $(uname) == 'Darwin' ]]; then
open '../../docs/html/index.html' -a Firefox
open 'build/html/index.html' -a Firefox
elif [[ $(uname) == 'Linux' ]]; then
firefox ../../docs/html/index.html
firefox build/html/index.html
fi
4 changes: 4 additions & 0 deletions requirements/base.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
imageio==2.1.2
numpy==1.12.1
decorator==4.0.11
tqdm==4.11.2
3 changes: 1 addition & 2 deletions requirements_docs.txt → requirements/docs.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
-r optional.txt
Sphinx>=1.5.2
sphinx_rtd_theme>=0.1.10b0
numpydoc>=0.6.0
pygame==1.9.3
scipy==0.19.0
tqdm==4.11.2
4 changes: 4 additions & 0 deletions requirements/optional.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-r base.txt
scikit-image==0.13.0
scipy==0.19.0
matplotlib==2.0.0
4 changes: 4 additions & 0 deletions requirements/test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-r optional.txt
nose==1.3.7
pytest==3.0.7
sklearn==0.18.1
85 changes: 74 additions & 11 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 TestCommand
except ImportError:
try:
import ez_setup
ez_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_packages

exec(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}
)

0 comments on commit e78928e

Please sign in to comment.