Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Improve changelog generation script (#1231)

Benjamin Hackl47e65fe8d8f9
diff --git a/docs/source/changelog.rst b/docs/source/changelog.rst
index 8226b5a80..fb20c6cc1 100644
--- a/docs/source/changelog.rst
+++ b/docs/source/changelog.rst
@@ -2,11 +2,6 @@
Changelog
#########
-****************
-Upcoming release
-****************
-
-:Date: TBD
.. toctree::
:glob:
diff --git a/docs/source/changelog/0.5.0-changelog.rst b/docs/source/changelog/0.5.0-changelog.rst
index fec292f32..1feaeeebb 100644
--- a/docs/source/changelog/0.5.0-changelog.rst
+++ b/docs/source/changelog/0.5.0-changelog.rst
@@ -1,7 +1,13 @@
+******
+v0.5.0
+******
+
+:Date: April 02, 2021
+
Contributors
============
-A total of 33 people contributed to this
+A total of 35 people contributed to this
release. People with a '+' by their names authored a patch for the first
time.
@@ -30,6 +36,7 @@ time.
* friedkeenan
* hydrobeam +
* kolibril13
+* sparshg
* tfglynn +
@@ -51,181 +58,243 @@ the following contributors.
* Mohammad Al-Fetyani
* Naveen M K
* Oliver
+* Ricky Chon
* vector67
Pull requests merged
====================
-A total of 53 pull requests were merged for this release.
+A total of 64 pull requests were merged for this release.
-Highlight
----------
+Highlights
+----------
* `#1075 <https://github.com/ManimCommunity/manim/pull/1075>`__: Add OpenGL Renderer
- Adds an OpenGLRenderer, OpenGLCamera, OpenGL-enabled Mobjects, and a `--use_opengl_renderer` flag. When this flag is passed, you can pass the `-p` flag to preview animations, the `-w` flag to generate video, and the `-q` flag to specify render quality. If you don't pass either the `-p` or the `-w` flag, nothing will happen. Scenes rendered with the OpenGL renderer must *only* use OpenGL-enabled Mobjects.
-New feature
------------
+ Adds an OpenGLRenderer, OpenGLCamera, OpenGL-enabled Mobjects, and a ``--use_opengl_renderer`` flag. When this flag is passed, you can pass the ``-p`` flag to preview animations, the ``-w`` flag to generate video, and the ``-q`` flag to specify render quality. If you don't pass either the ``-p`` or the ``-w`` flag, nothing will happen. Scenes rendered with the OpenGL renderer must *only* use OpenGL-enabled Mobjects.
+
+Deprecated classes and functions
+--------------------------------
+
+* `#1124 <https://github.com/ManimCommunity/manim/pull/1124>`__: Deprecated :class:`ShowCreation` in favor of :class:`Create`
+ 1. Deprecated :class:`ShowCreation` in favor of :class:`Create` across the library with the exception of the `show_creation` boolean variable `vector_space_scene.py`
+ 2. Added a deprecation warning in the original :class:`ShowCreation` class.
+
+* `#1110 <https://github.com/ManimCommunity/manim/pull/1110>`__: Deprecated SmallDot + OpenGLSmallDot
+ `SmallDot` isn't necessary and a deprecation warning will be raised. This will be removed in a future release.
+
+New features
+------------
* `#1037 <https://github.com/ManimCommunity/manim/pull/1037>`__: Added new fade and transform animations (:class:`~.TransformMatchingShapes`, :class:`~.TransformMatchingTex`, :class:`~.FadeTransform`) from 3b1b/manim
Added new Fade animation: :class:`~FadeOutToPoint`
Added :class:`~FadeTransform` and :class:`~FadeTransformPieces` for transforming mobjects and submobjects with a fade
Added :class:`~TransformMatchingShapes` and :class:`~TransformMatchingTex` for transforming mobjects and tex that have matching parts
+
* `#1097 <https://github.com/ManimCommunity/manim/pull/1097>`__: Added 3D Mobject :class:`~.Dot3D`
+
* `#1074 <https://github.com/ManimCommunity/manim/pull/1074>`__: Added jupyter media_width option to the config
+
* `#1107 <https://github.com/ManimCommunity/manim/pull/1107>`__: Added :class:`~.Unwrite` animation class to complement :class:`~.Write`
Added :class:`Unwrite` which inherits from :class:`~.Write`. It automatically reverses the animation of :class:`~.Write` by passing the reversed rate function, but it also takes an additional boolean parameter `reverse` which, if `False`, renders the animation from left to right (assuming text oriented in the usual way), but if `True`, it renders right to left.
+
* `#1085 <https://github.com/ManimCommunity/manim/pull/1085>`__: Added :class:`~.Angle` and :class:`~.RightAngle` for intersecting lines
:class:`~.Angle` and :class:`~.RightAngle` both take two lines as input. If they intersect, or share a common vertex, an angle is drawn between them. Users can customize the look of the angle and also use a dotted right angle.
-Enhancement
------------
+
+Enhancements
+------------
* `#1144 <https://github.com/ManimCommunity/manim/pull/1144>`__: Improved quality of GIFs
+
* `#1157 <https://github.com/ManimCommunity/manim/pull/1157>`__: Refresh triangulation on call to :meth:`~.OpenGLVMobject.apply_points_function`
Rotate called apply_points_function, which was previous not subclassed by OpenGLMobject - now it is. Then, the vertex normals can be updated too.
Additionally, the old_points matrix would change after rotating, making the old points / new points test irrelevant. This is addressed with a .copy call.
+
* `#1151 <https://github.com/ManimCommunity/manim/pull/1151>`__: Added parametric function support to :class:`OpenGLSurface`
+
* `#1139 <https://github.com/ManimCommunity/manim/pull/1139>`__: In-Code `config["preview"]` Support
+
* `#1123 <https://github.com/ManimCommunity/manim/pull/1123>`__: Added caching, skipping, and user-specified background colors to the OpenGL renderer
OpenGL play logic has been improved to support caching and skipping with `-n` argument ( it is now similar to Cairo play logic). A random bug was fixed in OpenGLSurface and OpenGL background color can now be changed via `background_color` argument.
+
* `#1118 <https://github.com/ManimCommunity/manim/pull/1118>`__: Allow passing animation arguments with .animate syntax
Users will now be able to do things like `obj.animate(run_time=2).method(arg)` if they want to specify animation arguments for an individual `.animate` call, and can still not specify any arguments like `obj.animate.method(arg)`.
Passing animation arguments is only allowed directly after `.animate` is accessed, if passed elsewhere then a `ValueError` is raised.
+
* `#718 <https://github.com/ManimCommunity/manim/pull/718>`__: Rotating the numbers in y axis
In Axes, the y axis will be rotated 90deg but the numbers are
also rotated and shouldn't be. Fixes this issue.
-* `#1070 <https://github.com/ManimCommunity/manim/pull/1070>`__: Raise FileNotFoundError when unable to locate the .cfg file specified via `--config_file`
+
+* `#1070 <https://github.com/ManimCommunity/manim/pull/1070>`__: Raise FileNotFoundError when unable to locate the .cfg file specified via ``--config_file``
Raising the error will stop script execution and let the user know that there are problems with the `--config_file` location instead of reverting back to the default configuration.
-Bug
----
-* `#1193 <https://github.com/ManimCommunity/manim/pull/1193>`__: Fixed using :class:`Animation`s without a child :class:`~.Mobject` in :class:`~.AnimationGroup`
+Fixed bugs
+----------
+
+* `#1224 <https://github.com/ManimCommunity/manim/pull/1224>`__: Fixed :class:`~.ShowIncreasingSubsets`, :class:`~.ShowSubmobjectsOneByOne`, and :class:`~.AddTextLetterByLetter`
+
+
+* `#1201 <https://github.com/ManimCommunity/manim/pull/1201>`__: Prevent crash on :meth:`~.Scene.embed` for empty scenes
+
+
+* `#1192 <https://github.com/ManimCommunity/manim/pull/1192>`__: Fixed issue when an animation is cached, manim can't merge the partial movie files.
+
+
+* `#1193 <https://github.com/ManimCommunity/manim/pull/1193>`__: Fixed using :class:`~.Animation` without a child :class:`~.Mobject` in :class:`~.AnimationGroup`
`AnimationGroup` may now take `Animation` objects which do not have a child `Mobject`, such as `Wait`.
+
* `#1170 <https://github.com/ManimCommunity/manim/pull/1170>`__: Fixed minor SVG parsing bugs
+
* `#1159 <https://github.com/ManimCommunity/manim/pull/1159>`__: Added support for multiple transforms in the same SVG element
+
* `#1156 <https://github.com/ManimCommunity/manim/pull/1156>`__: Fixed :class:`~.DrawBorderThenFill` to support OpenGL and improved type hints for some functions
Fixed a bug in :class:`~.DrawBorderThenFill` that prevented :class:`~.Write` animations from working with :class:`~.OpenGLVMobjects` and slightly improved type hints for some animation functions to include :class:`~.OpenGLVMobject`.
+
* `#1134 <https://github.com/ManimCommunity/manim/pull/1134>`__: Fixed the `-a` flag.
- The `-a`/`--write-all` flag was broken. When used, it would cause Manim to crash just after beginning to render the second scene.
+ The ``-a`` / ``--write-all`` flag was broken. When used, it would cause Manim to crash just after beginning to render the second scene.
+
* `#1115 <https://github.com/ManimCommunity/manim/pull/1115>`__: Fixed bugs in :class:`~.OpenGLMobject` and added :class:`ApplyMethod` support
Fixed undefined variables and converted :class:`Mobject` to :class:`OpenGLMobject`. Also, fixed assert statement in :class:`ApplyMethod`.
+
* `#1092 <https://github.com/ManimCommunity/manim/pull/1092>`__: Refactored coordinate_systems.py, fixed bugs, added :class:`~.NumberPlane` test
The default behavior of :meth:`~.Mobject.rotate` is to rotate about the center of :class:`~.Mobject`. :class:`~.NumberLine` is symmetric about the point at the number 0 only when ``|x_min|`` == ``|x_max|``. Ideally, the rotation should coincide with
the point at number 0 on the line.
Added a regression test and additionally fixed some bugs introduced in :pr:`718`.
+
* `#1078 <https://github.com/ManimCommunity/manim/pull/1078>`__: Removed stray print statements from `__main__.py`
Uses rich's print traceback instead and fixes an issue in printing the version twice when `manim --version` is called.
+
* `#1086 <https://github.com/ManimCommunity/manim/pull/1086>`__: Fixed broken line spacing in :class:`~.Text`
The `line_spacing` kwarg was missing when creating :class:`Text` Mobjects; this adds it.
+
* `#1083 <https://github.com/ManimCommunity/manim/pull/1083>`__: Corrected the shape of :class:`~.Torus`
:class:`Torus` draws a surface with an elliptical cross-section when `minor_radius` is different from 1. This PR ensures the cross-section is always a circle.
-Deprecation
------------
-* `#1124 <https://github.com/ManimCommunity/manim/pull/1124>`__: Deprecated :class:`ShowCreation` in favor of :class:`Create`
- 1. Deprecated :class:`ShowCreation` in favor of :class:`Create` across the library with the exception of the `show_creation` boolean variable `vector_space_scene.py`
- 2. Added a deprecation warning in the original :class:`ShowCreation` class.
-* `#1110 <https://github.com/ManimCommunity/manim/pull/1110>`__: Deprecated SmallDot + OpenGLSmallDot
- `SmallDot` isn't necessary and a deprecation warning will be raised. This will be removed in a future release.
-Documentation
--------------
+Documentation-related changes
+-----------------------------
+
+* `#1217 <https://github.com/ManimCommunity/manim/pull/1217>`__: Copyedited the document on testing in our documentation
+
+
+* `#1206 <https://github.com/ManimCommunity/manim/pull/1206>`__: Added Docstrings to :class:`~.Mobject`
+
+
+* `#1218 <https://github.com/ManimCommunity/manim/pull/1218>`__: Removed BezierSpline from the example gallery
+
+
+* `#1219 <https://github.com/ManimCommunity/manim/pull/1219>`__: Updated Dockerfile (include dependencies for building documentation), moved documentation to main README
+
+
+* `#1209 <https://github.com/ManimCommunity/manim/pull/1209>`__: Added :ref_methods: to the manim directive
+ This allows class methods to be linked in the documentation. Checkout the `example references <https://docs.manim.community/en/latest/examples.html#movingaround>`_ below the code to see how this is used!
+
+* `#1204 <https://github.com/ManimCommunity/manim/pull/1204>`__: Added rotation example to example gallery
+
+
+* `#1137 <https://github.com/ManimCommunity/manim/pull/1137>`__: Added GitHub Wiki pages on adding testing/documentation to Sphinx Docs
+
* `#1114 <https://github.com/ManimCommunity/manim/pull/1114>`__: Added examples for :class:`~.Ellipse`, :class:`~.Polygon`, :class:`~.RegularPolygon`, :class:`~.Triangle` and :class:`~.RoundedRectangle`
+
* `#1195 <https://github.com/ManimCommunity/manim/pull/1195>`__: Removed SmallDot from example
+
* `#1130 <https://github.com/ManimCommunity/manim/pull/1130>`__: Added pre-commit to run black and flake8, updated contributing documentation accordingly
+
* `#1138 <https://github.com/ManimCommunity/manim/pull/1138>`__: Moved previous version changelogs to separate files; Added a Script to generate future changelogs
This script quickly generates a changelog for whoever is making the release.
+
* `#1190 <https://github.com/ManimCommunity/manim/pull/1190>`__: Added note in contributing guide to read the latest version of the documentation
+
* `#1188 <https://github.com/ManimCommunity/manim/pull/1188>`__: Added sounds example to docs
+
* `#1165 <https://github.com/ManimCommunity/manim/pull/1165>`__: Added documentation for installing Manim on Colab
+
* `#1128 <https://github.com/ManimCommunity/manim/pull/1128>`__: Added examples for :class:`~.DashedLine`, :class:`~.TangentLine`, :class:`~.Elbow`, :class:`~.Arrow`, :class:`~.Vector`, :class:`~.DoubleArrow`
+
* `#1177 <https://github.com/ManimCommunity/manim/pull/1177>`__: Replace links to the latest version of the documentation to the stable version
+
* `#1077 <https://github.com/ManimCommunity/manim/pull/1077>`__: Added details to :func:`~.Mobject.get_critical_point`
+
* `#1154 <https://github.com/ManimCommunity/manim/pull/1154>`__: Fixed some typing hints. (ints to floats)
+
* `#1036 <https://github.com/ManimCommunity/manim/pull/1036>`__: Added :class:`~.SurroundingRectangle` to the example gallery
+
* `#1103 <https://github.com/ManimCommunity/manim/pull/1103>`__: Added documentation and examples for Square, Dot, Circle and Rectangle
+
* `#1101 <https://github.com/ManimCommunity/manim/pull/1101>`__: Added documentation to :class:`~.Mobject`
- Methods for which documentation was added or improved:
- - :meth:`~.reset_points`
- - :meth:`~.init_colors`
- - :meth:`~.generate_points`
- - :meth:`~.add`
- - :meth:`~.add_to_back`
- - :meth:`~.remove`
- - :meth:`~.copy`
- - :meth:`~.update`
- - :meth:`~.get_time_based_updaters`
- - :meth:`~.has_time_based_updater`
- - :meth:`~.get_updaters`
- - :meth:`~.add_updater`
- - :meth:`~.remove_updater`
- - :meth:`~.clear_updaters`
- - :meth:`~.match_updaters`
- - :meth:`~.suspend_updating`
- - :meth:`~.resume_updating`
- - :meth:`~.apply_to_family`
- - :meth:`~.shift`
- - :meth:`~.scale`
- - :meth:`~.add_background_rectangle`
+
+
* `#1088 <https://github.com/ManimCommunity/manim/pull/1088>`__: Added new svg files to documentation and imports
In particular, SVGPathMobject, VMobjectFromPathstring, and the style_utils functions to manim's namespace.
+
* `#1076 <https://github.com/ManimCommunity/manim/pull/1076>`__: Improve documentation for GraphScene
Updated `coords_to_point` and `point_to_coords` under `manim/scene/graph_scene.py` as the dosctring of each function confusingly described the opposite of what it is supposed to do.
-Release
--------
-* `#1073 <https://github.com/ManimCommunity/manim/pull/1073>`__: Removed "one line summary" from PULL_REQUEST_TEMPLATE.md
-
-Testing
--------
+Changes concerning the testing system
+-------------------------------------
* `#1160 <https://github.com/ManimCommunity/manim/pull/1160>`__: Enable CI testing for OpenGL
+
* `#1100 <https://github.com/ManimCommunity/manim/pull/1100>`__: Rewrote test cases to use sys.executable in the command instead of "python"
Tests would fail due to `capture()` not spawning a subshell in the correct environment, so when python was called, the test would be unable to find necessary packages.
+
* `#1079 <https://github.com/ManimCommunity/manim/pull/1079>`__: Removed the hardcoded value, `manim`, in `test_version.py`
-Infrastructure
---------------
+
+Changes to our development infrastructure
+-----------------------------------------
+
+* `#1213 <https://github.com/ManimCommunity/manim/pull/1213>`__: Updated TinyTex dependencies
+
* `#1187 <https://github.com/ManimCommunity/manim/pull/1187>`__: Add CodeCov to Github Workflow
+
* `#1166 <https://github.com/ManimCommunity/manim/pull/1166>`__: CI: Use poetry's cache dir rather than pip
+
* `#1071 <https://github.com/ManimCommunity/manim/pull/1071>`__: Enable pytest-cov based code coverage
- Include pytest-cov as a python module as part of developer dependencies
- In updating poetry to include pytest-cov, manimpango moved from version 0.2.3 to 0.2.4, and libpango1.0-dev needed to be installed in Ubuntu.
- Add to the CI workflow (`ci.yml`) to create and upload test coverage.
-Maintenance
------------
+
+* `#1073 <https://github.com/ManimCommunity/manim/pull/1073>`__: Removed "one line summary" from PULL_REQUEST_TEMPLATE.md
+
+
+Code quality improvements and similar refactors
+-----------------------------------------------
* `#1167 <https://github.com/ManimCommunity/manim/pull/1167>`__: Merge :class:`~.OpenGLMobject` and :class:`~.Mobject`
+
* `#1164 <https://github.com/ManimCommunity/manim/pull/1164>`__: Fixed single PEP8 style in `cairo_renderer.py`
+
* `#1140 <https://github.com/ManimCommunity/manim/pull/1140>`__: Flake8 Compat & Code Cleanup
+
* `#1019 <https://github.com/ManimCommunity/manim/pull/1019>`__: Refactored :meth:`~.Scene.play`
- Removed the _**three**_ decorators of :meth:`~.Scene.play`, in particular: caching logic and file writer logic are now included within :meth:`~.Scene.play` (it wasn't possible before, because `scene.wait` and `scene.play` were two different things).
- Added `is_static_wait` attributes to Wait. (<=> if wait is a frozen frame).
@@ -235,3 +304,4 @@ Maintenance
- `renderer` starts the animation with `scene.begin_animations` (`scene.compile_animation_data` used to do this)
- The run time and the time progression generation is now done in `scene.play_internal` although it'd make more sense that renderer processes it later.
- Added a bunch of cool tests thanks to mocks, and thanks to the new syntax `scene.render`
+
diff --git a/scripts/dev_changelog.py b/scripts/dev_changelog.py
index ea7f5b46c..3633b7920 100755
--- a/scripts/dev_changelog.py
+++ b/scripts/dev_changelog.py
@@ -1,5 +1,6 @@
#!/usr/bin/env python
-"""Script to generate contributor and pull request lists
+"""Script to generate contributor and pull request lists.
+
This script generates contributor and pull request lists for release
changelogs using Github v3 protocol. Use requires an authentication token in
order to have sufficient bandwidth, you can get one following the directions at
@@ -9,30 +10,47 @@ token may be stored in an environment variable as you only get one chance to
see it.
Usage::
- $ ./scripts/dev_changelog.py <token> <revision range> <output_file>
+
+ $ ./scripts/dev_changelog.py [OPTIONS] TOKEN PRIOR TAG [ADDITIONAL]...
The output is utf8 rst.
Dependencies
------------
+
- gitpython
- pygithub
Examples
--------
-From the bash command line with $GITHUB token::
- $ ./scripts/dev_changelog.py $GITHUB v0.3.0..v0.4.0 -o 0.4.0-changelog.rst
+
+From a bash command line with $GITHUB environment variable as the GitHub token::
+
+ $ ./scripts/dev_changelog.py $GITHUB v0.3.0 v0.4.0
+
+This would generate 0.4.0-changelog.rst file and place it automatically under
+docs/source/changelog/.
+
+As another example, you may also run include PRs that have been excluded by
+providing a space separated list of ticket numbers after TAG::
+
+ $ ./scripts/dev_changelog.py $GITHUB v0.3.0 v0.4.0 1911 1234 1492 ...
+
Note
----
+
This script was taken from Numpy under the terms of BSD-3-Clause license.
"""
+
+import datetime
import re
-import sys
+import click
+
+from manim.constants import EPILOG, CONTEXT_SETTINGS
from collections import defaultdict
from textwrap import dedent, indent
from pathlib import Path
-import git
from tqdm import tqdm
from git import Repo
from github import Github
@@ -40,14 +58,28 @@ from github import Github
this_repo = Repo(str(Path(__file__).resolve().parent.parent))
-
-def get_authors_and_reviewers(revision_range, github_repo, pr_nums):
+PR_LABELS = {
+ "breaking changes": "Breaking changes",
+ "highlight": "Highlights",
+ "deprecation": "Deprecated classes and functions",
+ "new feature": "New features",
+ "enhancement": "Enhancements",
+ "bug": "Fixed bugs",
+ "documentation": "Documentation-related changes",
+ "testing": "Changes concerning the testing system",
+ "infrastructure": "Changes to our development infrastructure",
+ "maintenance": "Code quality improvements and similar refactors",
+ "reverts": "Changes that needed to be reverted again",
+ "unlabeled": "Unclassified changes",
+}
+
+
+def get_authors_and_reviewers(lst, cur, github_repo, pr_nums):
pat = r"^.*\t(.*)$"
- lst_release, cur_release = [r.strip() for r in revision_range.split("..")]
# authors, in current release and previous to current release.
- cur = set(re.findall(pat, this_repo.git.shortlog("-s", revision_range), re.M))
- pre = set(re.findall(pat, this_repo.git.shortlog("-s", lst_release), re.M))
+ cur = set(re.findall(pat, this_repo.git.shortlog("-s", f"{lst}..{cur}"), re.M))
+ pre = set(re.findall(pat, this_repo.git.shortlog("-s", lst), re.M))
# Append '+' to new authors.
authors = [s + " +" for s in cur - pre] + [s for s in cur & pre]
@@ -62,18 +94,18 @@ def get_authors_and_reviewers(revision_range, github_repo, pr_nums):
return {"authors": authors, "reviewers": reviewers}
-def get_pr_nums(revision_range):
+def get_pr_nums(lst, cur):
print("Getting PR Numbers:")
prnums = []
# From regular merges
- merges = this_repo.git.log("--oneline", "--merges", revision_range)
+ merges = this_repo.git.log("--oneline", "--merges", f"{lst}..{cur}")
issues = re.findall(r".*\(\#(\d+)\)", merges)
prnums.extend(int(s) for s in issues)
# From fast forward squash-merges
commits = this_repo.git.log(
- "--oneline", "--no-merges", "--first-parent", revision_range
+ "--oneline", "--no-merges", "--first-parent", f"{lst}..{cur}"
)
issues = re.findall(r"^.*\(\#(\d+)\)$", commits, re.M)
prnums.extend(int(s) for s in issues)
@@ -88,47 +120,16 @@ def sort_by_labels(github_repo, pr_nums):
This implementation sorts based on importance into a singular group. If a
PR uses multiple labels, it is sorted under one label.
- The importance order (for the end-user):
- - breaking changes
- - highlight
- - feature
- - enhancement
- - bug
- - documentation
- - testing
- - infrastructure
- - unlabeled
"""
pr_by_labels = defaultdict(list)
for num in tqdm(pr_nums, desc="Sorting by labels"):
pr = github_repo.get_pull(num)
- labels = [label.name for label in pr.labels]
- # TODO: Make use of label names directly from main
- if "breaking changes" in labels:
- pr_by_labels["breaking changes"].append(pr)
- elif "highlight" in labels:
- pr_by_labels["highlight"].append(pr)
- elif "new feature" in labels:
- pr_by_labels["new feature"].append(pr)
- elif "enhancement" in labels:
- pr_by_labels["enhancement"].append(pr)
- elif "bug" in labels:
- pr_by_labels["bug"].append(pr)
- elif "deprecation" in labels:
- pr_by_labels["deprecation"].append(pr)
- elif "documentation" in labels:
- pr_by_labels["documentation"].append(pr)
- elif "release" in labels:
- pr_by_labels["release"].append(pr)
- elif "testing" in labels:
- pr_by_labels["testing"].append(pr)
- elif "infrastructure" in labels:
- pr_by_labels["infrastructure"].append(pr)
- elif "maintenance":
- pr_by_labels["maintenance"].append(pr)
- elif "style" in labels:
- pr_by_labels["style"].append(pr)
- else: # PR doesn't have label :( Create one!
+ pr_labels = [label.name for label in pr.labels]
+ for label in PR_LABELS.keys():
+ if label in pr_labels:
+ pr_by_labels[label].append(pr)
+ break # ensure that PR is only added in one category
+ else:
pr_by_labels["unlabeled"].append(pr)
return pr_by_labels
@@ -142,16 +143,47 @@ def get_summary(body):
return has_changelog_pattern.group()[22:-21].strip()
-def main(token, revision_range, outfile=None):
- lst_release, cur_release = [r.strip() for r in revision_range.split("..")]
+ context_settings=CONTEXT_SETTINGS,
+ epilog=EPILOG,
+)
+ "additional",
+ nargs=-1,
+ required=False,
+)
+ "-o", "--outfile", type=str, help="Path and file name of the changelog output."
+)
+def main(token, prior, tag, additional, outfile):
+ """Generate Changelog/List of contributors/PRs for release.
+
+ TOKEN is your GitHub Personal Access Token.
+
+ PRIOR is the tag/commit SHA of the previous release.
+
+ TAG is the tag of the new release.
+
+ ADDITIONAL includes additional PR(s) that have not been recognized automatically.
+ """
+
+ lst_release, cur_release = prior, tag
github = Github(token)
github_repo = github.get_repo("ManimCommunity/manim")
- pr_nums = get_pr_nums(revision_range)
+ pr_nums = get_pr_nums(lst_release, cur_release)
+ if additional:
+ print(f"Adding {additional} to the mix!")
+ pr_nums = pr_nums + list(additional)
# document authors
- contributors = get_authors_and_reviewers(revision_range, github_repo, pr_nums)
+ contributors = get_authors_and_reviewers(
+ lst_release, cur_release, github_repo, pr_nums
+ )
authors = contributors["authors"]
reviewers = contributors["reviewers"]
@@ -159,11 +191,18 @@ def main(token, revision_range, outfile=None):
outfile = (
Path(__file__).resolve().parent.parent / "docs" / "source" / "changelog"
)
- outfile = outfile / f"{cur_release[1:]}-changelog.rst"
+ outfile = outfile / f"{tag[1:] if tag.startswith('v') else tag}-changelog.rst"
else:
outfile = Path(outfile).resolve()
with outfile.open("w", encoding="utf8") as f:
+ f.write("*" * len(tag) + "\n")
+ f.write(f"{tag}\n")
+ f.write("*" * len(tag) + "\n\n")
+
+ today = datetime.date.today()
+ f.write(f":Date: {today.strftime('%B %d, %Y')}\n\n")
+
heading = "Contributors"
f.write(f"{heading}\n")
f.write("=" * len(heading) + "\n\n")
@@ -202,29 +241,14 @@ def main(token, revision_range, outfile=None):
f"A total of {len(pr_nums)} pull requests were merged for this release.\n\n"
)
- # TODO: Use labels list in sort_by_labels, simplify logic
- labels = [
- "breaking changes",
- "highlight",
- "new feature",
- "enhancement",
- "bug",
- "deprecation",
- "documentation",
- "release",
- "testing",
- "infrastructure",
- "maintenance",
- "style",
- "unlabeled",
- ]
pr_by_labels = sort_by_labels(github_repo, pr_nums)
- for label in labels:
+ for label in PR_LABELS.keys():
pr_of_label = pr_by_labels[label]
if pr_of_label:
- f.write(f"{label.capitalize()}\n")
- f.write("-" * len(label) + "\n\n")
+ heading = PR_LABELS[label]
+ f.write(f"{heading}\n")
+ f.write("-" * len(heading) + "\n\n")
for PR in pr_by_labels[label]:
num = PR.number
@@ -234,21 +258,12 @@ def main(token, revision_range, outfile=None):
f.write(f"* `#{num} <{url}>`__: {title}\n")
overview = get_summary(PR.body)
if overview:
- f.write(indent(f"{overview}\n", " "))
+ f.write(indent(f"{overview}\n\n", " "))
else:
- f.write("\n")
+ f.write("\n\n")
print(f"Wrote changelog to: {outfile}")
if __name__ == "__main__":
- from argparse import ArgumentParser, FileType
-
- parser = ArgumentParser(description="Generate author/pr lists for release")
- parser.add_argument("token", help="github access token")
- parser.add_argument("revision_range", help="<revision>..<revision>")
- parser.add_argument(
- "-o", "--outfile", type=str, help="path and file name of the changelog output"
- )
- args = parser.parse_args()
- main(args.token, args.revision_range, args.outfile)
+ main()