##// END OF EJS Templates
Require pygments>=2.4.0...
Require pygments>=2.4.0 As noted in #13441, running ipython with an old version of pygments leads to problems. Ipython sends ANSI color names to pygments to color output, but these names aren't in old versions of pygments. Before: with pygments 2.3.1 and ipython 8.0.0, opening an ipython instance and running In [1]: 1 / 0 # Expect ZeroDivisionError will crash ipython as `ansiyellow` is used to highlight the error. This PR requires pygments>=2.4.0, which is when pygments changed their ANSI color names.

File last commit:

r26016:50a8bd8a
r27425:e902466b
Show More
fixup_whats_new_pr.py
39 lines | 1.1 KiB | text/x-python | PythonLexer
/ tools / fixup_whats_new_pr.py
"""
This tool is used during CI testing to make sure sphinx raise no error.
During development, we like to have whatsnew/pr/*.rst documents to track
individual new features. Unfortunately they other either:
- have no title (sphinx complains)
- are not included in any toctree (sphinx complain)
This fix-them up by "inventing" a title, before building the docs. At release
time, these title and files will anyway be rewritten into the actual release
notes.
"""
from pathlib import Path
def main():
folder = Path("docs/source/whatsnew/pr/")
files = list(folder.glob("*.rst"))
print(files)
for filepath in files:
print("Adding pseudo-title to:", filepath.name)
title = filepath.name[:-4].split("/")[-1].replace("-", " ").capitalize()
data = filepath.read_text()
try:
if data and data.splitlines()[1].startswith('='):
continue
except IndexError:
pass
with filepath.open("w") as f:
f.write(title + "\n")
f.write("=" * len(title) + "\n\n")
f.write(data)
if __name__ == '__main__':
main()