Skip to content

Video editing with Python

Update #530 Use setup.py only dep handling

Mark Beacom0e5b06fa9af0
diff --git a/MANIFEST.in b/MANIFEST.in
index 3bbbaa25..761e0a52 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,5 +1,4 @@
include *.txt
-recursive-include docs *.txt
+recursive-include docs *
include *.rst
-recursive-include docs *.rst
include ez_setup.py
diff --git a/README.rst b/README.rst
index 6298968d..4accdb53 100644
--- a/README.rst
+++ b/README.rst
@@ -96,11 +96,19 @@ For instance, using the method ``clip.resize`` requires that at least one of Sci
Documentation
-------------
+Running `build_docs` has additional dependencies that require installation.
+
+ $ (sudo) pip install moviepy[docs]
+
The documentation can be generated and viewed via:
- $ cd docs/
- $ make clean html
- $ open build/html/index.html
+ $ python setup.py build_docs
+
+You can pass additional arguments to the documentation build, such as clean build:
+
+ $ python setup.py build_docs -E
+
+More information is available from the `Sphinx`_ documentation.
Running Tests
@@ -110,6 +118,11 @@ The testing suite can be executed via:
$ python setup.py test
+Running the test suite in this manner will install the testing dependencies.
+If you opt to run the test suite manually, you can install the dependencies via:
+
+ $ (sudo) pip install moviepy[test]
+
Contribute
----------
@@ -154,6 +167,7 @@ Maintainers
.. _ffmpeg: http://www.ffmpeg.org/download.html
.. _ImageMagick: http://www.imagemagick.org/script/index.php
.. _`Matplotlib`: https://matplotlib.org/
+.. _`Sphinx`: http://www.sphinx-doc.org/en/master/setuptools.html
.. People
.. _Zulko: https://github.com/Zulko
diff --git a/docs/conf.py b/docs/conf.py
index 70c947f3..d80d5a9a 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -11,12 +11,17 @@
# All configuration values have a default; values that are commented out
# serve to show the default.
-import sys, os
+import os
+import sys
+
+# The theme to use for HTML and HTML Help pages. See the documentation for
+# a list of builtin themes.
+import sphinx_rtd_theme
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
-#sys.path.insert(0, os.path.abspath('.'))
+sys.path.insert(0, os.path.abspath('.'))
# -- General configuration -----------------------------------------------------
@@ -53,9 +58,9 @@ copyright = u'2017, Zulko'
# built documents.
#
# The short X.Y version.
-version = '0.2'
+# version = '0.2'
# The full version, including alpha/beta/rc tags.
-release = '0.2.3.1'
+# release = '0.2.3.1'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
@@ -97,13 +102,9 @@ pygments_style = 'sphinx'
# -- Options for HTML output ---------------------------------------------------
-# The theme to use for HTML and HTML Help pages. See the documentation for
-# a list of builtin themes.
-import sphinx_rtd_theme
sys.path.append(os.path.abspath('_themes'))
-sys.path.append("../moviepy")
#html_theme_path = ['_themes']
-html_theme = "sphinx_rtd_theme" # formerly 'kr'
+html_theme = 'sphinx_rtd_theme' # formerly 'kr'
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
diff --git a/requirements/base.txt b/requirements/base.txt
deleted file mode 100644
index e27389ea..00000000
--- a/requirements/base.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-imageio==2.1.2
-numpy==1.12.1
-decorator==4.0.11
-tqdm==4.11.2
diff --git a/requirements/docs.txt b/requirements/docs.txt
deleted file mode 100644
index 1ba3f427..00000000
--- a/requirements/docs.txt
+++ /dev/null
@@ -1,5 +0,0 @@
--r optional.txt
-Sphinx>=1.5.2
-sphinx_rtd_theme>=0.1.10b0
-numpydoc>=0.6.0
-pygame==1.9.3
diff --git a/requirements/optional.txt b/requirements/optional.txt
deleted file mode 100644
index 731e0252..00000000
--- a/requirements/optional.txt
+++ /dev/null
@@ -1,4 +0,0 @@
--r base.txt
-scikit-image==0.13.0
-scipy==0.19.0
-matplotlib==2.0.0
diff --git a/requirements/test.txt b/requirements/test.txt
deleted file mode 100644
index ee2ac7aa..00000000
--- a/requirements/test.txt
+++ /dev/null
@@ -1,4 +0,0 @@
--r optional.txt
-nose==1.3.7
-pytest==3.0.7
-sklearn==0.18.1
diff --git a/setup.py b/setup.py
index d8f9bf60..d78240c3 100644
--- a/setup.py
+++ b/setup.py
@@ -46,12 +46,28 @@ class PyTest(TestCommand):
sys.exit(errno)
+cmdclass = {'test': PyTest} # Define custom commands.
+
+if 'build_docs' in sys.argv:
+ try:
+ from sphinx.setup_command import BuildDoc
+ except ImportError:
+ raise ImportError('Running the documenation builds has additional'
+ ' dependencies. Please run (pip install moviepy[docs])')
+
+ cmdclass['build_docs'] = BuildDoc
+
exec(open('moviepy/version.py').read()) # loads __version__
-requires = ['numpy', 'decorator', 'imageio', 'tqdm']
-test_requirements = ['pytest>=2.8.0', 'nose', 'sklearn']
-optional_requirements = ['scikit-image', 'scipy']
+# Define the requirements for specific execution needs.
+requires = ['numpy==1.12.1', 'decorator==4.0.11', 'imageio==2.1.2',
+ 'tqdm==4.11.2']
+optional_reqs = ['scikit-image==0.13.0', 'scipy==0.19.0', 'matplotlib==2.0.0']
+documentation_reqs = ['pygame==1.9.3', 'numpydoc>=0.6.0',
+ 'sphinx_rtd_theme>=0.1.10b0', 'Sphinx>=1.5.2'] + optional_reqs
+test_requirements = ['pytest>=2.8.0', 'nose', 'sklearn'] + optional_reqs
+# Load the README.
with open('README.rst', 'r', 'utf-8') as f:
readme = f.read()
@@ -85,8 +101,17 @@ setup(
),
keywords='video editing audio compositing ffmpeg',
packages=find_packages(exclude='docs'),
- cmdclass={'test': PyTest},
+ cmdclass=cmdclass,
+ command_options={
+ 'build_docs': {
+ 'build_dir': ('setup.py', './docs/build'),
+ 'config_dir': ('setup.py', './docs'),
+ 'version': ('setup.py', __version__.rsplit('.', 2)[0]),
+ 'release': ('setup.py', __version__)}},
tests_require=test_requirements,
install_requires=requires,
- extras_require={'optional': optional_requirements}
+ extras_require={
+ 'optional': optional_reqs,
+ 'docs': documentation_reqs,
+ 'test': test_requirements}
)