Skip to content

Commit

Permalink
Merge pull request ipython#4349 from takluyver/update-whatsnew
Browse files Browse the repository at this point in the history
Script to update What's New file
  • Loading branch information
minrk committed Oct 6, 2013
2 parents 3483b07 + 906123e commit e8d0209
Show file tree
Hide file tree
Showing 8 changed files with 110 additions and 27 deletions.
36 changes: 36 additions & 0 deletions docs/source/whatsnew/development.rst
Expand Up @@ -14,6 +14,24 @@ This document describes in-flight development work.
- `%%capture` cell magic now captures the rich display output, not just
stdout/stderr

Select Notebook Name When Renaming a Notebook
---------------------------------------------

The default notebook name is Untitled. It's unlikely you want to keep this name
or part of it when naming your notebook. Instead, IPython will select the text
in the input field so the user can easily type over the name and change it.

clear_output changes
--------------------

* There is no longer a 500ms delay when calling ``clear_output``.
* The ability to clear stderr and stdout individually was removed.
* A new ``wait`` flag that prevents ``clear_output`` from being executed until new
output is available. This eliminates animation flickering by allowing the
user to double buffer the output.
* The output div height is remembered when the ``wait=True`` flag is used.

.. DO NOT EDIT THIS LINE BEFORE RELEASE. FEATURE INSERTION POINT.
Backwards incompatible changes
------------------------------
Expand All @@ -24,3 +42,21 @@ Backwards incompatible changes
their `call` methods for them have been renamed to `preprocess`.
* The `call` methods of nbconvert post-processsors have been renamed to
`postprocess`.

* The module ``IPython.core.fakemodule`` has been removed.

* The alias system has been reimplemented to use magic functions. There should be little
visible difference while automagics are enabled, as they are by default, but parts of the
:class:`~IPython.core.alias.AliasManager` API have been removed.

* We fixed an issue with switching between matplotlib inline and GUI backends,
but the fix requires matplotlib 1.1 or newer. So from now on, we consider
matplotlib 1.1 to be the minimally supported version for IPython. Older
versions for the most part will work, but we make no guarantees about it.

* The :command:`pycolor` command has been removed. We recommend the much more capable
:command:`pygmentize` command from the `Pygments <http://pygments.org/>`_ project.
If you need to keep the exact output of :command:`pycolor`, you can still use
``python -m IPython.utils.PyColorize foo.py``.

.. DO NOT EDIT THIS LINE BEFORE RELEASE. INCOMPAT INSERTION POINT.
9 changes: 0 additions & 9 deletions docs/source/whatsnew/pr/clear_output.rst

This file was deleted.

3 changes: 0 additions & 3 deletions docs/source/whatsnew/pr/incompat-drop-alias.rst

This file was deleted.

1 change: 0 additions & 1 deletion docs/source/whatsnew/pr/incompat-drop-fakemodule.rst

This file was deleted.

4 changes: 0 additions & 4 deletions docs/source/whatsnew/pr/incompat-drop-pycolor.rst

This file was deleted.

4 changes: 0 additions & 4 deletions docs/source/whatsnew/pr/incompat-mpl-backend.rst

This file was deleted.

6 changes: 0 additions & 6 deletions docs/source/whatsnew/pr/select-notebook-rename.rst

This file was deleted.

74 changes: 74 additions & 0 deletions tools/update_whatsnew.py
@@ -0,0 +1,74 @@
"""Update the What's New doc (development version)
This collects the snippets from whatsnew/pr/, moves their content into
whatsnew/development.rst (chronologically ordered), and deletes the snippets.
"""

import io
import os
from os.path import dirname, basename, abspath, join as pjoin
from subprocess import check_call, check_output

repo_root = dirname(dirname(abspath(__file__)))
whatsnew_dir = pjoin(repo_root, 'docs', 'source', 'whatsnew')
pr_dir = pjoin(whatsnew_dir, 'pr')
target = pjoin(whatsnew_dir, 'development.rst')

FEATURE_MARK = ".. DO NOT EDIT THIS LINE BEFORE RELEASE. FEATURE INSERTION POINT."
INCOMPAT_MARK = ".. DO NOT EDIT THIS LINE BEFORE RELEASE. INCOMPAT INSERTION POINT."

# 1. Collect the whatsnew snippet files ---------------------------------------

files = set(os.listdir(pr_dir))
# Ignore explanatory and example files
files.difference_update({'README.md',
'incompat-switching-to-perl.rst',
'antigravity-feature.rst'}
)

# Absolute paths
files = {pjoin(pr_dir, f) for f in files}

def getmtime(f):
return check_output(['git', 'log', '-1', '--format="%ai"', '--', f])

files = sorted(files, key=getmtime)

features, incompats = [], []
for path in files:
with io.open(path, encoding='utf-8') as f:
content = f.read().rstrip()
if basename(path).startswith('incompat-'):
incompats.append(content)
else:
features.append(content)

# Put the insertion markers back on the end, so they're ready for next time.
feature_block = '\n\n'.join(features + [FEATURE_MARK])
incompat_block = '\n\n'.join(incompats + [INCOMPAT_MARK])

# 2. Update the target file ---------------------------------------------------

with io.open(target, encoding='utf-8') as f:
content = f.read()

assert content.count(FEATURE_MARK) == 1
assert content.count(INCOMPAT_MARK) == 1

content = content.replace(FEATURE_MARK, feature_block)
content = content.replace(INCOMPAT_MARK, incompat_block)

# Clean trailing whitespace
content = '\n'.join(l.rstrip() for l in content.splitlines())

with io.open(target, 'w', encoding='utf-8') as f:
f.write(content)

# 3. Stage the changes in git -------------------------------------------------

for file in files:
check_call(['git', 'rm', file])

check_call(['git', 'add', target])

print("Merged what's new changes. Check the diff and commit the change.")

0 comments on commit e8d0209

Please sign in to comment.