A community-maintained Python framework for creating mathematical animations.
New feature: Added --version command line flag (#970)
KingWampy8fce5a74cbd6
diff --git a/docs/source/tutorials/configuration.rst b/docs/source/tutorials/configuration.rstindex 219b981e7..27b6dd544 100644--- a/docs/source/tutorials/configuration.rst+++ b/docs/source/tutorials/configuration.rst@@ -437,6 +437,7 @@ A list of all CLI flags--custom_folders Use the folders defined in the [custom_folders] section of the config file to define the output folder structure-v {DEBUG,INFO,WARNING,ERROR,CRITICAL}, --verbosity {DEBUG,INFO,WARNING,ERROR,CRITICAL}Verbosity level. Also changes the ffmpeg log level unless the latter is specified in the config+ --version Print the current version of Manim you are using--progress_bar True/FalseDisplay the progress bardiff --git a/manim/__init__.py b/manim/__init__.pyindex f652438fb..8bd563361 100644--- a/manim/__init__.py+++ b/manim/__init__.py@@ -90,3 +90,10 @@ from .utils.tex_templates import *from .utils import unitfrom .plugins import *++try:+ import importlib.metadata as importlib_metadata+except ModuleNotFoundError:+ import importlib_metadata++__version__ = importlib_metadata.version(__name__)diff --git a/manim/_config/main_utils.py b/manim/_config/main_utils.pyindex aee2ec76d..68cbe312c 100644--- a/manim/_config/main_utils.py+++ b/manim/_config/main_utils.py@@ -3,7 +3,8 @@import osimport argparseimport typing-from manim import constants+import sys+from manim import constants, __version____all__ = ["parse_args"]@@ -109,6 +110,9 @@ def parse_args(args: list) -> argparse.Namespace:return _parse_args_cfg_subcmd(args)elif subcmd == "plugins":return _parse_args_plugins(args)+ elif args[1] == "--version":+ print(f"Manim Community Edition v{ __version__ }")+ sys.exit()# elif subcmd == some_other_future_subcmd:# return _parse_args_some_other_subcmd(args)elif subcmd is None:@@ -445,6 +449,12 @@ def _parse_args_no_subcmd(args: list) -> argparse.Namespace:choices=constants.VERBOSITY_CHOICES,)+ parser.add_argument(+ "--version",+ action="store_true",+ help="Print the current version of Manim you are using",+ )+# Specify if the progress bar should be displayedparser.add_argument("--progress_bar",diff --git a/poetry.lock b/poetry.lockindex 7eaffdc71..8e330654b 100644--- a/poetry.lock+++ b/poetry.lock@@ -228,19 +228,18 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"[[package]]name = "importlib-metadata"-version = "3.4.0"+version = "1.7.0"description = "Read metadata from Python packages"-category = "dev"+category = "main"optional = false-python-versions = ">=3.6"+python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7"[package.dependencies]-typing-extensions = {version = ">=3.6.4", markers = "python_version < \"3.8\""}zipp = ">=0.5"[package.extras]-docs = ["sphinx", "jaraco.packaging (>=8.2)", "rst.linker (>=1.9)"]-testing = ["pytest (>=3.5,!=3.7.3)", "pytest-checkdocs (>=1.2.3)", "pytest-flake8", "pytest-cov", "pytest-enabler", "packaging", "pep517", "pyfakefs", "flufl.flake8", "pytest-black (>=0.3.7)", "pytest-mypy", "importlib-resources (>=1.3)"]+docs = ["sphinx", "rst.linker"]+testing = ["packaging", "pep517", "importlib-resources (>=1.3)"][[package]]name = "iniconfig"@@ -482,7 +481,7 @@ python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*"[[package]]name = "pytest"-version = "6.2.1"+version = "6.2.2"description = "pytest: simple powerful testing with Python"category = "dev"optional = false@@ -599,8 +598,8 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*"[[package]]name = "snowballstemmer"-version = "2.0.0"-description = "This package provides 26 stemmers for 25 languages generated from Snowball algorithms."+version = "2.1.0"+description = "This package provides 29 stemmers for 28 languages generated from Snowball algorithms."category = "dev"optional = falsepython-versions = "*"@@ -745,7 +744,7 @@ python-versions = "*"[[package]]name = "urllib3"-version = "1.26.2"+version = "1.26.3"description = "HTTP library with thread-safe connection pooling, file post, and more."category = "dev"optional = false@@ -779,7 +778,7 @@ python-versions = "*"name = "zipp"version = "3.4.0"description = "Backport of pathlib-compatible object wrapper for zip files"-category = "dev"+category = "main"optional = falsepython-versions = ">=3.6"@@ -793,7 +792,7 @@ js_renderer = ["grpcio", "grpcio-tools", "watchdog"][metadata]lock-version = "1.1"python-versions = "^3.6"-content-hash = "5a0c8d8c8c581f09f6a663c3d793a85673d6897e4cd2778b42bd44ba6e65e189"+content-hash = "3a37f76430e459101d3b50813cc0496e422a5ca3ff4786333298a46e26a1010b"[metadata.files]alabaster = [@@ -971,8 +970,8 @@ imagesize = [{file = "imagesize-1.2.0.tar.gz", hash = "sha256:b1f6b5a4eab1f73479a50fb79fcf729514a900c341d8503d62a62dbc4127a2b1"},]importlib-metadata = [- {file = "importlib_metadata-3.4.0-py3-none-any.whl", hash = "sha256:ace61d5fc652dc280e7b6b4ff732a9c2d40db2c0f92bc6cb74e07b73d53a1771"},- {file = "importlib_metadata-3.4.0.tar.gz", hash = "sha256:fa5daa4477a7414ae34e95942e4dd07f62adf589143c875c133c1e53c4eff38d"},+ {file = "importlib_metadata-1.7.0-py2.py3-none-any.whl", hash = "sha256:dc15b2969b4ce36305c51eebe62d418ac7791e9a157911d58bfb1f9ccd8e2070"},+ {file = "importlib_metadata-1.7.0.tar.gz", hash = "sha256:90bb658cdbbf6d1735b6341ce708fc7024a3e14e99ffdc5783edea9f9b077f83"},]iniconfig = [{file = "iniconfig-1.1.1-py2.py3-none-any.whl", hash = "sha256:011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3"},@@ -1192,21 +1191,25 @@ pillow = [{file = "Pillow-8.1.0-cp36-cp36m-macosx_10_10_x86_64.whl", hash = "sha256:d355502dce85ade85a2511b40b4c61a128902f246504f7de29bbeec1ae27933a"},{file = "Pillow-8.1.0-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:93a473b53cc6e0b3ce6bf51b1b95b7b1e7e6084be3a07e40f79b42e83503fbf2"},{file = "Pillow-8.1.0-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:2353834b2c49b95e1313fb34edf18fca4d57446675d05298bb694bca4b194174"},+ {file = "Pillow-8.1.0-cp36-cp36m-manylinux2014_aarch64.whl", hash = "sha256:1d208e670abfeb41b6143537a681299ef86e92d2a3dac299d3cd6830d5c7bded"},{file = "Pillow-8.1.0-cp36-cp36m-win32.whl", hash = "sha256:dd9eef866c70d2cbbea1ae58134eaffda0d4bfea403025f4db6859724b18ab3d"},{file = "Pillow-8.1.0-cp36-cp36m-win_amd64.whl", hash = "sha256:b09e10ec453de97f9a23a5aa5e30b334195e8d2ddd1ce76cc32e52ba63c8b31d"},{file = "Pillow-8.1.0-cp37-cp37m-macosx_10_10_x86_64.whl", hash = "sha256:b02a0b9f332086657852b1f7cb380f6a42403a6d9c42a4c34a561aa4530d5234"},{file = "Pillow-8.1.0-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:ca20739e303254287138234485579b28cb0d524401f83d5129b5ff9d606cb0a8"},{file = "Pillow-8.1.0-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:604815c55fd92e735f9738f65dabf4edc3e79f88541c221d292faec1904a4b17"},+ {file = "Pillow-8.1.0-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:cf6e33d92b1526190a1de904df21663c46a456758c0424e4f947ae9aa6088bf7"},{file = "Pillow-8.1.0-cp37-cp37m-win32.whl", hash = "sha256:47c0d93ee9c8b181f353dbead6530b26980fe4f5485aa18be8f1fd3c3cbc685e"},{file = "Pillow-8.1.0-cp37-cp37m-win_amd64.whl", hash = "sha256:96d4dc103d1a0fa6d47c6c55a47de5f5dafd5ef0114fa10c85a1fd8e0216284b"},{file = "Pillow-8.1.0-cp38-cp38-macosx_10_10_x86_64.whl", hash = "sha256:7916cbc94f1c6b1301ac04510d0881b9e9feb20ae34094d3615a8a7c3db0dcc0"},{file = "Pillow-8.1.0-cp38-cp38-manylinux1_i686.whl", hash = "sha256:3de6b2ee4f78c6b3d89d184ade5d8fa68af0848f9b6b6da2b9ab7943ec46971a"},{file = "Pillow-8.1.0-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:cdbbe7dff4a677fb555a54f9bc0450f2a21a93c5ba2b44e09e54fcb72d2bd13d"},+ {file = "Pillow-8.1.0-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:f50e7a98b0453f39000619d845be8b06e611e56ee6e8186f7f60c3b1e2f0feae"},{file = "Pillow-8.1.0-cp38-cp38-win32.whl", hash = "sha256:cb192176b477d49b0a327b2a5a4979552b7a58cd42037034316b8018ac3ebb59"},{file = "Pillow-8.1.0-cp38-cp38-win_amd64.whl", hash = "sha256:6c5275bd82711cd3dcd0af8ce0bb99113ae8911fc2952805f1d012de7d600a4c"},{file = "Pillow-8.1.0-cp39-cp39-macosx_10_10_x86_64.whl", hash = "sha256:165c88bc9d8dba670110c689e3cc5c71dbe4bfb984ffa7cbebf1fac9554071d6"},{file = "Pillow-8.1.0-cp39-cp39-manylinux1_i686.whl", hash = "sha256:5e2fe3bb2363b862671eba632537cd3a823847db4d98be95690b7e382f3d6378"},{file = "Pillow-8.1.0-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:7612520e5e1a371d77e1d1ca3a3ee6227eef00d0a9cddb4ef7ecb0b7396eddf7"},+ {file = "Pillow-8.1.0-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:d673c4990acd016229a5c1c4ee8a9e6d8f481b27ade5fc3d95938697fa443ce0"},{file = "Pillow-8.1.0-cp39-cp39-win32.whl", hash = "sha256:dc577f4cfdda354db3ae37a572428a90ffdbe4e51eda7849bf442fb803f09c9b"},{file = "Pillow-8.1.0-cp39-cp39-win_amd64.whl", hash = "sha256:22d070ca2e60c99929ef274cfced04294d2368193e935c5d6febfd8b601bf865"},{file = "Pillow-8.1.0-pp36-pypy36_pp73-macosx_10_10_x86_64.whl", hash = "sha256:a3d3e086474ef12ef13d42e5f9b7bbf09d39cf6bd4940f982263d6954b13f6a9"},@@ -1274,8 +1277,8 @@ pyparsing = [{file = "pyparsing-2.4.7.tar.gz", hash = "sha256:c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1"},]pytest = [- {file = "pytest-6.2.1-py3-none-any.whl", hash = "sha256:1969f797a1a0dbd8ccf0fecc80262312729afea9c17f1d70ebf85c5e76c6f7c8"},- {file = "pytest-6.2.1.tar.gz", hash = "sha256:66e419b1899bc27346cb2c993e12c5e5e8daba9073c1fbce33b9807abc95c306"},+ {file = "pytest-6.2.2-py3-none-any.whl", hash = "sha256:b574b57423e818210672e07ca1fa90aaf194a4f63f3ab909a2c67ebb22913839"},+ {file = "pytest-6.2.2.tar.gz", hash = "sha256:9d1edf9e7d0b84d72ea3dbcdfd22b35fb543a5e8f2a60092dd578936bf63d7f9"},]python-dateutil = [{file = "python-dateutil-2.8.1.tar.gz", hash = "sha256:73ebfe9dbf22e832286dafa60473e4cd239f8592f699aa5adaf10050e6e1823c"},@@ -1372,8 +1375,8 @@ six = [{file = "six-1.15.0.tar.gz", hash = "sha256:30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259"},]snowballstemmer = [- {file = "snowballstemmer-2.0.0-py2.py3-none-any.whl", hash = "sha256:209f257d7533fdb3cb73bdbd24f436239ca3b2fa67d56f6ff88e86be08cc5ef0"},- {file = "snowballstemmer-2.0.0.tar.gz", hash = "sha256:df3bac3df4c2c01363f3dd2cfa78cce2840a79b9f1c2d2de9ce8d31683992f52"},+ {file = "snowballstemmer-2.1.0-py2.py3-none-any.whl", hash = "sha256:b51b447bea85f9968c13b650126a888aabd4cb4463fca868ec596826325dedc2"},+ {file = "snowballstemmer-2.1.0.tar.gz", hash = "sha256:e997baa4f2e9139951b6f4c631bad912dfd3c792467e2f03d7239464af90e914"},]sphinx = [{file = "Sphinx-3.4.3-py3-none-any.whl", hash = "sha256:c314c857e7cd47c856d2c5adff514ac2e6495f8b8e0f886a8a37e9305dfea0d8"},@@ -1449,8 +1452,8 @@ typing-extensions = [{file = "typing_extensions-3.7.4.3.tar.gz", hash = "sha256:99d4073b617d30288f569d3f13d2bd7548c3a7e4c8de87db09a9d29bb3a4a60c"},]urllib3 = [- {file = "urllib3-1.26.2-py2.py3-none-any.whl", hash = "sha256:d8ff90d979214d7b4f8ce956e80f4028fc6860e4431f731ea4a8c08f23f99473"},- {file = "urllib3-1.26.2.tar.gz", hash = "sha256:19188f96923873c92ccb987120ec4acaa12f0461fa9ce5d3d0772bc965a39e08"},+ {file = "urllib3-1.26.3-py2.py3-none-any.whl", hash = "sha256:1b465e494e3e0d8939b50680403e3aedaa2bc434b7d5af64dfd3c958d7f5ae80"},+ {file = "urllib3-1.26.3.tar.gz", hash = "sha256:de3eedaad74a2683334e282005cd8d7f22f4d55fa690a2a1020a416cb0a47e73"},]watchdog = [{file = "watchdog-1.0.2-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:e2a531e71be7b5cc3499ae2d1494d51b6a26684bcc7c3146f63c810c00e8a3cc"},diff --git a/pyproject.toml b/pyproject.tomlindex 01fc8dac6..42b8d50a8 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -39,6 +39,7 @@ grpcio = { version = "1.33.*", optional = true }grpcio-tools = { version = "1.33.*", optional = true }watchdog = { version = "*", optional = true }networkx = "^2.5"+importlib-metadata = {version = "^1.0", python = "<3.8"}[tool.poetry.extras]js_renderer = ["grpcio","grpcio-tools","watchdog"]diff --git a/tests/test_version.py b/tests/test_version.pynew file mode 100644index 000000000..c660402df--- /dev/null+++ b/tests/test_version.py@@ -0,0 +1,6 @@+from manim import __version__+import pkg_resources+++def test_version():+ assert __version__ == pkg_resources.get_distribution("manim").version