Skip to content

Commit

Permalink
Rebase with master
Browse files Browse the repository at this point in the history
  • Loading branch information
mondeja committed Jan 22, 2021
2 parents fe68ad6 + 8cc3eeb commit 5f709d0
Show file tree
Hide file tree
Showing 54 changed files with 145 additions and 122 deletions.
1 change: 0 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ Delete them if they are not appropriate for this pull request.
- [ ] I have added suitable tests demonstrating a fixed bug or new/changed feature to the test suite in `tests/`
- [ ] I have properly documented new or changed features in the documentation or in the docstrings
- [ ] I have properly explained unusual or unexpected code in the comments around it
- [ ] I have formatted my code using `black -t py36`
15 changes: 15 additions & 0 deletions .github/workflows/format_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,18 @@ jobs:
run: flake8 tests --show-source
- name: Lint moviepy
run: flake8 moviepy --show-source
isort:
runs-on: ubuntu-latest
name: isort
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install isort
- name: Check imports
run: isort --check-only moviepy tests examples docs/conf.py
22 changes: 22 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
repos:
- repo: https://gitlab.com/pycqa/flake8
rev: master
hooks:
- id: flake8
additional_dependencies:
- flake8-implicit-str-concat
- flake8-absolute-import
name: flake8-test
files: \.py$
- repo: https://github.com/PyCQA/isort
rev: master
hooks:
- id: isort
args: ['--check-only', '--filter-files']
files: \.py$
- repo: https://github.com/psf/black
rev: stable
hooks:
- id: black
language_version: python3.6
files: \.py$
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,23 @@
- Do not push any commit that changes the API without prior discussion.

## Preparing for development

- Fork the official MoviePy repository to your own GitHub account:
Use the "Fork" button in the top right corner of the GitHub interface while viewing [the official MoviePy](https://github.com/Zulko/moviepy) repository.
- Use your fork as the basis for cloning the repository to your local machine: `$ git clone URL_TO_YOUR_FORK`
You can get the appropriate URL (SSH- or HTTPS-based) by using the green "Code" button located at the top right of the repository view while looking at your fork. By default, Git refers to any remote you clone from – i.e. in this case your fork on GitHub – as `origin`.
- Enter your local clone and add the official MoviePy repository as a second remote, with alias `upstream`:
`$ git remote add upstream git@github.com:Zulko/moviepy.git` (using SSL) _or_
`$ git remote add upstream https://github.com/Zulko/moviepy.git` (using HTTPS).
- Install the library inside a [virtual environment](https://docs.python.org/3/tutorial/venv.html) with all dependencies included using `$ pip install -e ".[optional,doc,test,lint]"`
- Configure pre-commit hooks running `$ pre-commit install`

## Coding conventions, code quality

- Respect [PEP8](https://www.python.org/dev/peps/pep-0008/) conventions.
- Add just the "right" amount of comments. Try to write auto-documented code with very explicit variable names.
- If you introduce new functionality or fix a bug, document it in the docstring or with code comments.
- MoviePy's team adopted [black](https://github.com/psf/black) to autoformat code. This is enforced for any pull request.

> Tip: use `black -t py36 .` to autoformat your code, or set black as a [plugin for your editor](https://black.readthedocs.io/en/stable/editor_integration.html).
- MoviePy's team adopted [pre-commit](https://pre-commit.com/) to run code checks using black, flake8 and isort, so make sure that you've configured the pre-commit hooks with `pre-commit install`.


## Standard contribution workflow
Expand All @@ -48,7 +49,6 @@ You do not have to have finished your feature or bug fix before submitting a PR;

Before submitting PRs:

- make sure your code still conforms to the formatting standard (using Black formatter: `$ black -t py36 .`)
- run the test suite over your code to expose any problems: `$ pytest`
- push your local develop branch to your GitHub fork `$ git push origin YOUR_DEVELOP_BRANCH`

Expand Down
48 changes: 5 additions & 43 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ In this example we open a video file, select the subclip between t=50s and t=60s
Maintainers wanted!
-------------------

As there are more and more people seeking support (320 open issues as of Sept. 2019!) and all the MoviePy maintainers seem busy, we'd love to hear about developers interested in giving a hand and solving some of the issues (especially the ones that affect you) or reviewing pull requests. Open an issue or contact us directly if you are interested. Thanks!
As there are more and more people seeking support (270 open issues as of Jan. 2021!) and all the MoviePy maintainers seem busy, we'd love to hear about developers interested in giving a hand and solving some of the issues (especially the ones that affect you) or reviewing pull requests. Open an issue or contact us directly if you are interested. Thanks!

Installation
------------
Expand Down Expand Up @@ -103,7 +103,7 @@ For instance, using the method ``clip.resize`` requires that at least one of Sci
Documentation
-------------

Running `build_docs` has additional dependencies that require installation.
Building the documentation has additional dependencies that require installation.

.. code:: bash
Expand Down Expand Up @@ -148,44 +148,6 @@ Then at the beginning of your notebook enter:
Have a look at the Proglog project page for more options.

Running Tests
-------------

In order to run the test suite locally, first install the dependencies by navigating to the project directory and running:

.. code:: bash
$ (sudo) pip install moviepy[test]
The test suite can then be executed via:

.. code:: bash
$ pytest
Linting and formatting
----------------------

To make sure that all the code is well formatted and consistent, we use Black_ and Flake8_. Install them by navigating to the project directory and running:

.. code:: bash
$ (sudo) pip install moviepy[lint]
You can lint all files running:

.. code:: bash
$ flake8
To format the files properly use:

.. code:: bash
$ black -t py36 .
Contribute
----------

Expand All @@ -205,6 +167,7 @@ Maintainers
- `@overdrivr`_
- `@keikoro`_
- `@ryanfox`_
- `@mondeja`_


.. MoviePy links
Expand Down Expand Up @@ -234,8 +197,6 @@ Maintainers
.. _ImageMagick: https://www.imagemagick.org/script/index.php
.. _`Matplotlib`: https://matplotlib.org/
.. _`Sphinx`: https://www.sphinx-doc.org/en/master/setuptools.html
.. _`Black`: https://black.readthedocs.io/en/stable/
.. _`Flake8`: https://flake8.pycqa.org/en/latest/

.. People
.. _Zulko: https://github.com/Zulko
Expand All @@ -245,4 +206,5 @@ Maintainers
.. _`@mbeacom`: https://github.com/mbeacom
.. _`@overdrivr`: https://github.com/overdrivr
.. _`@keikoro`: https://github.com/keikoro
.. _`@ryanfox`: https://github.com/ryanfox
.. _`@ryanfox`: https://github.com/ryanfox
.. _`@mondeja`: https://github.com/mondeja
3 changes: 1 addition & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@
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.
Expand Down
1 change: 1 addition & 0 deletions examples/compo_from_image.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from moviepy import *
from moviepy.video.tools.segmenting import find_objects


# Load the image specifying the regions.
im = ImageClip("../../ultracompositing/motif.png")

Expand Down
1 change: 1 addition & 0 deletions examples/dancing_knights.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from moviepy.audio.tools.cuts import find_audio_period
from moviepy.video.tools.cuts import find_video_period


# Next lines are for downloading the required videos from Youtube.
# To do this you must have youtube-dl installed, otherwise you will need to
# download the videos by hand and rename them, as follows:
Expand Down
1 change: 1 addition & 0 deletions examples/example_with_sound.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from moviepy import *
from moviepy.video.tools.drawing import color_split


duration = 6 # duration of the final clip

# LOAD THE MAIN SCENE
Expand Down
3 changes: 2 additions & 1 deletion examples/headblur.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from moviepy import *
from moviepy.video.tools.tracking import manual_tracking # noqa 401
from moviepy.video.tools.interpolators import Trajectory
from moviepy.video.tools.tracking import manual_tracking # noqa 401


# LOAD THE CLIP (subclip 6'51 - 7'01 of a chaplin movie)
clip = VideoFileClip("media/chaplin.mp4")
Expand Down
1 change: 1 addition & 0 deletions examples/logo.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from moviepy import *


w, h = moviesize = (720, 380)

duration = 1
Expand Down
1 change: 1 addition & 0 deletions examples/masked_credits.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from moviepy import *
from moviepy.video.tools.credits import credits1


# Load the mountains clip, cut it, slow it down, make it look darker
clip = (
VideoFileClip("../../videos/badl-0001.mov", audio=False)
Expand Down
1 change: 1 addition & 0 deletions examples/moving_letters.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from moviepy import *
from moviepy.video.tools.segmenting import find_objects


# WE CREATE THE TEXT THAT IS GOING TO MOVE, WE CENTER IT.

screensize = (720, 460)
Expand Down
1 change: 1 addition & 0 deletions examples/painting_effect.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from moviepy import *


# WE TAKE THE SUBCLIPS WHICH ARE 2 SECONDS BEFORE & AFTER THE FREEZE

charade = VideoFileClip("../../videos/charade.mp4")
Expand Down
1 change: 1 addition & 0 deletions examples/soundtrack.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
""" A simple test script on how to put a soundtrack to a movie """
from moviepy import *


# We load a movie and replace the sound with some music:

movie = VideoFileClip("../../videos/dam.mov").with_audio(
Expand Down
3 changes: 2 additions & 1 deletion examples/star_worms.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
"""

import numpy as np
from skimage import transform as tf

from moviepy import *
from moviepy.video.tools.drawing import color_gradient
from skimage import transform as tf


# RESOLUTION

Expand Down
1 change: 1 addition & 0 deletions examples/the_end.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from moviepy import *
from moviepy.video.tools.drawing import circle


clip = (
VideoFileClip("../../videos/badl-0006.mov", audio=False).subclip(26, 31).add_mask()
)
Expand Down
1 change: 1 addition & 0 deletions examples/ukulele_concerto.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from moviepy import *


# UKULELE CLIP, OBTAINED BY CUTTING AND CROPPING
# RAW FOOTAGE

Expand Down
1 change: 1 addition & 0 deletions find_latest_imagemagick_version.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import re
from urllib import request


url = "https://legacy.imagemagick.org/script/index.php"

"""This little script parses url above to extract latest image magick version
Expand Down
43 changes: 17 additions & 26 deletions moviepy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,40 +11,31 @@

import inspect

from moviepy.version import __version__

# Clips
from moviepy.video.VideoClip import (
VideoClip,
ImageClip,
ColorClip,
TextClip,
BitmapClip,
)
from moviepy.video.io.VideoFileClip import VideoFileClip
from moviepy.video.compositing.CompositeVideoClip import CompositeVideoClip, clips_array
from moviepy.video.io.ImageSequenceClip import ImageSequenceClip

from moviepy.video.compositing.concatenate import concatenate_videoclips

from moviepy.video.io.downloader import download_webfile

from moviepy.audio import fx as afx
from moviepy.audio.AudioClip import (
AudioClip,
CompositeAudioClip,
concatenate_audioclips,
)
from moviepy.audio.io.AudioFileClip import AudioFileClip

# FX
from moviepy.video import fx as vfx
from moviepy.audio import fx as afx
from moviepy.tools import convert_to_seconds
from moviepy.version import __version__
from moviepy.video import fx as vfx, tools as videotools
from moviepy.video.compositing import transitions as transfx

# Tools
from moviepy.video import tools as videotools
from moviepy.video.compositing.CompositeVideoClip import CompositeVideoClip, clips_array
from moviepy.video.compositing.concatenate import concatenate_videoclips
from moviepy.video.io import ffmpeg_tools
from moviepy.tools import convert_to_seconds
from moviepy.video.io.downloader import download_webfile
from moviepy.video.io.ImageSequenceClip import ImageSequenceClip
from moviepy.video.io.VideoFileClip import VideoFileClip
from moviepy.video.VideoClip import (
BitmapClip,
ColorClip,
ImageClip,
TextClip,
VideoClip,
)


# Transforms the effects into Clip methods so that
# they can be called with clip.resize(width=500) instead of
Expand Down
1 change: 1 addition & 0 deletions moviepy/audio/fx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from moviepy.audio.fx.multiply_stereo_volume import multiply_stereo_volume
from moviepy.audio.fx.multiply_volume import multiply_volume


__all__ = (
"audio_fadein",
"audio_fadeout",
Expand Down
1 change: 1 addition & 0 deletions moviepy/audio/fx/all/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@

from .. import * # noqa 401,F403


warnings.warn(f"\nMoviePy: {__doc__}", UserWarning)
3 changes: 1 addition & 2 deletions moviepy/audio/fx/audio_normalize.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from moviepy.decorators import audio_video_fx

from moviepy.audio.fx.multiply_volume import multiply_volume
from moviepy.decorators import audio_video_fx


@audio_video_fx
Expand Down
3 changes: 2 additions & 1 deletion moviepy/audio/io/preview.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import time

import numpy as np

import pygame as pg

from moviepy.decorators import requires_duration


pg.init()
pg.display.set_caption("MoviePy")

Expand Down
2 changes: 1 addition & 1 deletion moviepy/audio/io/readers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import numpy as np

from moviepy.config import FFMPEG_BINARY
from moviepy.video.io.ffmpeg_reader import ffmpeg_parse_infos
from moviepy.tools import cross_platform_popen_params
from moviepy.video.io.ffmpeg_reader import ffmpeg_parse_infos


class FFMPEG_AudioReader:
Expand Down
Loading

0 comments on commit 5f709d0

Please sign in to comment.