Skip to content

Video editing with Python

Upgrade tooling (#1770)

Álvaro Mondéjar551e265f8bc4
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index 8db79409..cf1c2657 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -30,11 +30,11 @@ jobs:
steps:
- name: Checkout repository
- uses: actions/checkout@v2
+ uses: actions/checkout@v3
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
- uses: github/codeql-action/init@v1
+ uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -45,7 +45,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
- uses: github/codeql-action/autobuild@v1
+ uses: github/codeql-action/autobuild@v2
# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
@@ -59,4 +59,4 @@ jobs:
# make release
- name: Perform CodeQL Analysis
- uses: github/codeql-action/analyze@v1
+ uses: github/codeql-action/analyze@v2
diff --git a/.github/workflows/format_check.yml b/.github/workflows/format_check.yml
index 7583c712..4a44bf3a 100644
--- a/.github/workflows/format_check.yml
+++ b/.github/workflows/format_check.yml
@@ -1,6 +1,10 @@
name: Code Format Check
-on: [push, pull_request]
+on:
+ push:
+ branches:
+ - master
+ pull_request:
jobs:
@@ -8,20 +12,20 @@ jobs:
runs-on: ubuntu-latest
name: Black
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v3
- name: Set up Python
- uses: actions/setup-python@v2
+ uses: actions/setup-python@v3
- name: Black
- uses: psf/[email protected] # already includes args "--check --diff"
+ uses: psf/[email protected] # already includes args "--check --diff"
flake8:
runs-on: ubuntu-latest
name: Flake8
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v3
- name: Set up Python
- uses: actions/setup-python@v2
+ uses: actions/setup-python@v3
with:
- python-version: 3.9
+ python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade wheel pip
@@ -29,7 +33,7 @@ jobs:
- name: Lint examples
run: flake8 examples --show-source
- name: Lint scripts
- run: flake8 setup.py docs/conf.py --show-source
+ run: flake8 setup.py docs/conf.py scripts --show-source
- name: Lint tests
run: flake8 tests --show-source
- name: Lint moviepy
@@ -38,14 +42,14 @@ jobs:
runs-on: ubuntu-latest
name: isort
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v3
- name: Set up Python
- uses: actions/setup-python@v2
+ uses: actions/setup-python@v3
with:
- python-version: '3.x'
+ python-version: '3.9'
- 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
+ run: isort --check-only moviepy tests examples docs/conf.py scripts
diff --git a/.github/workflows/test_suite.yml b/.github/workflows/test_suite.yml
index e41c0c39..2f7c0a31 100644
--- a/.github/workflows/test_suite.yml
+++ b/.github/workflows/test_suite.yml
@@ -6,10 +6,8 @@ name: Run Test Suite
on:
push:
branches:
- - '**'
+ - master
pull_request:
- branches:
- - '**'
jobs:
# Uses Python Framework build because on macos matplotlib requires it
@@ -19,7 +17,7 @@ jobs:
matrix:
python-version: [3.7]
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v3
- uses: s-weigand/setup-conda@v1
with:
activate-conda: true
@@ -70,15 +68,15 @@ jobs:
python-version: [3.6, 3.7, 3.8, 3.9]
fail-fast: false
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
- uses: actions/setup-python@v2
+ uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Get ImageMagick installer from cache
id: imagemagick-installer-cache
- uses: actions/cache@v2
+ uses: actions/cache@v3
with:
path: |
ImageMagick.exe
@@ -135,9 +133,9 @@ jobs:
python-version: [3.6, 3.7, 3.8, 3.9]
fail-fast: false
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
- uses: actions/setup-python@v2
+ uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index a93cd567..a34ef1a9 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -1,23 +1,25 @@
repos:
- - repo: https://github.com/PyCQA/flake8
- rev: 3.9.2
+ - repo: https://github.com/psf/black
+ rev: 22.3.0
hooks:
- - id: flake8
- additional_dependencies:
- - flake8-implicit-str-concat
- - flake8-absolute-import
- name: flake8-test
+ - id: black
+ language_version: python3.6
files: \.py$
- repo: https://github.com/PyCQA/isort
- rev: 5.8.0
+ rev: 5.10.1
hooks:
- id: isort
args:
- '--filter-files'
files: \.py$
- - repo: https://github.com/psf/black
- rev: 20.8b1
+ - repo: https://github.com/PyCQA/flake8
+ rev: 4.0.1
hooks:
- - id: black
- language_version: python3.6
+ - id: flake8
+ additional_dependencies:
+ - flake8-absolute-import>=1.0
+ - flake8-docstrings>=1.6.0
+ - flake8-rst-docstrings>=0.2.5
+ - flake8-implicit-str-concat==0.3.0
+ name: flake8-test
files: \.py$
diff --git a/scripts/get-latest-imagemagick-win.py b/scripts/get-latest-imagemagick-win.py
index b48cc803..c51620d2 100644
--- a/scripts/get-latest-imagemagick-win.py
+++ b/scripts/get-latest-imagemagick-win.py
@@ -1,6 +1,9 @@
+"""Obtain the latest ImageMagick version from official repositories."""
+
import sys
from urllib.request import urlopen
+
BINARIES_URL = "https://download.imagemagick.org/ImageMagick/download/binaries/"
content = urlopen(BINARIES_URL).read().decode("utf-8")
diff --git a/setup.py b/setup.py
index e6b43224..e5b48d72 100644
--- a/setup.py
+++ b/setup.py
@@ -104,14 +104,14 @@ test_reqs = [
]
lint_reqs = [
- "black>=20.8b1",
- "flake8>3.7.0,<4.0.0",
+ "black>=22.3.0",
+ "flake8>=4.0.1",
"flake8-absolute-import>=1.0",
- "flake8-docstrings>=1.5.0",
- "flake8-rst-docstrings>=0.0.14",
- "flake8-implicit-str-concat==0.2.0",
- "isort>=5.7.0",
- "pre-commit>=2.9.3",
+ "flake8-docstrings>=1.6.0",
+ "flake8-rst-docstrings>=0.2.5",
+ "flake8-implicit-str-concat==0.3.0",
+ "isort>=5.10.1",
+ "pre-commit>=2.19.0",
]
extra_reqs = {
diff --git a/tests/test_fx.py b/tests/test_fx.py
index 4da6050e..23a646d9 100644
--- a/tests/test_fx.py
+++ b/tests/test_fx.py
@@ -1066,12 +1066,15 @@ def test_rotate_supported_PIL_kwargs(
translate=(1, 0),
)
- # assert number of warnings
- assert len(record.list) == len(unsupported_kwargs)
+ # assert number of warnings filtering other non related warnings
+ warning_records = list(
+ filter(lambda rec: rec.category.__name__ == "UserWarning", record.list)
+ )
+ assert len(warning_records) == len(unsupported_kwargs)
# assert messages contents
messages = []
- for warning in record.list:
+ for warning in warning_records:
messages.append(warning.message.args[0])
for unsupported_kwarg in unsupported_kwargs:
diff --git a/tests/test_videotools.py b/tests/test_videotools.py
index 8e636a78..8d126dbb 100644
--- a/tests/test_videotools.py
+++ b/tests/test_videotools.py
@@ -362,7 +362,10 @@ def test_FramesMatches_write_gifs(util):
assert isinstance(end, int)
assert isinstance(end, int)
- shutil.rmtree(gifs_dir)
+ try:
+ shutil.rmtree(gifs_dir)
+ except PermissionError:
+ pass
@pytest.mark.parametrize(