Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pseudo auto-generated notes for the 2.x+ release branch #339

Merged
merged 18 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ repos:
hooks:
- id: check-yaml
- id: end-of-file-fixer
exclude: ^(doc/source/releases.md)
- id: trailing-whitespace
exclude: ^.*\.(pdb)$
exclude: ^(.*\.(pdb)|doc/source/releases.md)$
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
Expand Down
1 change: 1 addition & 0 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ def sort_authors(filename):
"sphinxcontrib.bibtex",
"matplotlib.sphinxext.plot_directive",
"mdanalysis_sphinx_theme",
"myst_parser",
]

bibtex_bibfiles = ["references.bib"]
Expand Down
1 change: 1 addition & 0 deletions doc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ Wherever possible, do not take these conversations to private channels, includin
examples/quickstart
faq
examples/README
releases
IAlibay marked this conversation as resolved.
Show resolved Hide resolved

.. toctree::
:maxdepth: 1
Expand Down
7 changes: 7 additions & 0 deletions doc/source/preparing_releases_and_hotfixes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,13 @@ Create a release of the UserGuide

For now, the UserGuide is released at the same time as the core library. To make a release of the UserGuide you should:

#. Make a Pull Request with a re-generated ``releases.md`` which contains a copy of the GitHub release notes. This can be generated by doing:

.. code-block:: bash

cd doc/source/scripts
python gen_release_notes.py
IAlibay marked this conversation as resolved.
Show resolved Hide resolved

#. Create a new release tag and upload them for the UserGuide repository.

.. code-block:: bash
Expand Down
452 changes: 452 additions & 0 deletions doc/source/releases.md

Large diffs are not rendered by default.

48 changes: 48 additions & 0 deletions doc/source/scripts/gen_release_notes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import os
import pathlib
import re

from github import Github


def gen_release_notes(filename):
git = Github(os.environ["GITHUB_TOKEN"])
repo = git.get_repo("MDAnalysis/mdanalysis")
releases = repo.get_releases()
IAlibay marked this conversation as resolved.
Show resolved Hide resolved

parent_directory = pathlib.Path(__file__).parent.parent
parent_directory.mkdir(exist_ok=True, parents=True)
filename = parent_directory / filename

filetext = "# MDAnalysis Release Notes\n\n\n"

# Should be ordered
for release in repo.get_releases():
# MDAnalysis releases always follow a tag pattern of *-release_version
version = release.tag_name.split("-")[1]

# Only write out version 2.x+ since those are the only ones that
# we can guarantee similarly written notes for
if int(version.split(".")[0]) < 2:
continue

if release.body.startswith("###"):
filetext += release.body[1:]
else:
filetext += release.body

filetext += "\n\n"

# replace all @ starting handles with github links
# \b doesn't work so we're using \s and getting extra whitespace
handles = set(re.findall(r"\s@\w+", filetext))
for entry in handles:
new_word = f" [{entry[1:]}](https://github.com/{entry[2:]})"
filetext = filetext.replace(entry, new_word)

with open(filename, "w") as f:
f.write(filetext)


if __name__ == "__main__":
gen_release_notes("releases.md")
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ dependencies:
- ipython
- ipywidgets<8.0.0
- jupyter_contrib_nbextensions
- myst-parser
- nbconvert # not called by any notebook explicitly but to download notebooks, or in nbsphinx
- nbformat
- nbsphinx
Expand Down