Skip to content

Video editing with Python

Fix doc building and deploying pipeline and replace hard coded version strings with latest tag during CI

osaajanidf7b7340b4cc
diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml
index 79c14fbd..4110bb50 100644
--- a/.github/workflows/build-docs.yml
+++ b/.github/workflows/build-docs.yml
@@ -18,18 +18,23 @@ jobs:
with:
python-version: '3.x' # Specify Python version as needed
- - name: Build v1.0.3 documentation
+ - name: Build current documentation
run: |
git fetch --tags
- git checkout v1.0.3
- pip install "jinja2<3" "MarkupSafe<2" "alabaster==0.7.12"
+ latest_tag=$(git tag --sort=-v:refname | head -n 1)
+ echo "Latest tag: $latest_tag"
+ git checkout "$latest_tag"
pip install -e .
pip install -e ".[doc]"
cd docs
+
+ # Replace %VERSION% with the latest tag in conf.py
+ sed -i "s/%VERSION%/$latest_tag/g" conf.py
+
make html
- mkdir -p ../build/html/v1.0.3
- cp -r build/html/* ../build/html/v1.0.3/
+ mkdir -p "../build/html/$latest_tag"
+ cp -r build/html/* "../build/html/$latest_tag/"
rm -rf build/html
git stash
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index 7928c2fb..1f485eca 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -25,6 +25,19 @@ jobs:
- name: Install dependencies
run: |
pip install setuptools wheel build
+
+ - name: Set version from latest tag
+ run: |
+ git fetch --tags
+ latest_tag=$(git tag --sort=-v:refname | head -n 1)
+ echo "Latest tag: $latest_tag"
+
+ # Update version in pyproject.toml
+ sed -i "s/%VERSION%/$latest_tag/g" pyproject.toml
+
+ # Update version in moviepy/version.py
+ sed -i "s/%VERSION%/$latest_tag/g" moviepy/version.py
+
- name: Build
run: |
python -m build
diff --git a/moviepy/version.py b/moviepy/version.py
index 4eabd0b3..5405e814 100644
--- a/moviepy/version.py
+++ b/moviepy/version.py
@@ -1 +1,6 @@
-__version__ = "2.1.2"
+try:
+ from importlib.metadata import version
+
+ __version__ = version("moviepy")
+except Exception:
+ __version__ = "%VERSION%"
diff --git a/pyproject.toml b/pyproject.toml
index ff96c12d..80c13b96 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -4,11 +4,11 @@ build-backend = "setuptools.build_meta"
[project]
name = "moviepy"
-version = "2.1.2"
+version = "%VERSION%"
description = "Video editing with Python"
readme = "README.md"
license = { text = "MIT License" }
-authors = [{ name = "Zulko 2024" }]
+authors = [{ name = "Zulko 2025" }]
keywords = ["video", "editing", "audio", "compositing", "ffmpeg"]
classifiers = [
"Development Status :: 5 - Production/Stable",
@@ -19,6 +19,7 @@ classifiers = [
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
+ "Programming Language :: Python :: 3.12",
"Topic :: Multimedia",
"Topic :: Multimedia :: Sound/Audio",
"Topic :: Multimedia :: Sound/Audio :: Analysis",
@@ -61,4 +62,4 @@ lint = [
[tool.setuptools.packages.find]
include = ["moviepy*"]
-exclude = ["media", "tests", "docs"]
\ No newline at end of file
+exclude = ["media", "tests", "docs"]