Skip to content

Commit

Permalink
MAINT: Use towncrier for release notes
Browse files Browse the repository at this point in the history
  • Loading branch information
larsoner committed Dec 15, 2023
1 parent b1329c3 commit 848659c
Show file tree
Hide file tree
Showing 19 changed files with 115 additions and 91 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/check_changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Check PR change log

on: # yamllint disable-line rule:truthy
pull_request:
types: [opened, synchronize, labeled, unlabeled]

jobs:
changelog_checker:
name: Check if towncrier change log entry is correct
runs-on: ubuntu-latest
steps:
- uses: scientific-python/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BOT_USERNAME: changelog-bot
80 changes: 28 additions & 52 deletions doc/changes/devel.rst
Original file line number Diff line number Diff line change
@@ -1,55 +1,31 @@
.. NOTE: we use cross-references to highlight new functions and classes.
Please follow the examples below like :func:`mne.stats.f_mway_rm`, so the
whats_new page will have a link to the function/class documentation.
.. NOTE: there are 3 separate sections for changes, based on type:
- "Enhancements" for new features
- "Bugs" for bug fixes
- "API changes" for backward-incompatible changes
.. NOTE: changes from first-time contributors should be added to the TOP of
the relevant section (Enhancements / Bugs / API changes), and should look
like this (where xxxx is the pull request number):
- description of enhancement/bugfix/API change (:gh:`xxxx` by
:newcontrib:`Firstname Lastname`)
Also add a corresponding entry for yourself in doc/changes/names.inc
.. NOTE: we use standard sphinx cross-references to highlight new functions and classes.
References must be to where they are documented in the built API documentation, e.g.,
:class:`mne.Epochs` not :class:`mne.epochs.Epochs` (even though the class is defined
in mne/epochs.py).
There are 5 separate sections for changes, based on type.
Each should have a filename in this directory of the form NNNNN.<type>.rst,
where NNNNN is the PR number (e.g., 12345.bugfix.rst). The types are:
notable
For overarching changes, e.g., adding type hints package-wide. These are rare.
dependency
For changes to dependencies, e.g., adding a new dependency or changing
the minimum version of an existing dependency.
bugfix
For bug fixes. Can change code behavior with no deprecation period.
deprecation
Code behavior changes that require a deprecation period.
enhancement
For new features.
other
For changes that don't fit into any of the above categories, e.g.,
internal refactorings.
First-time contributors should use :newcontrib:`Firstname Lastname` instead of
`Firstname Lastname`_ in their entries. Also add a corresponding entry for
yourself in doc/changes/names.inc
.. _current:

Version 1.7.dev0 (development)
------------------------------

In this version, we started adding type hints (also known as "type annotations") to select parts of the codebase.
This meta information will be used by development environments (IDEs) like VS Code and PyCharm automatically to provide
better assistance such as tab completion or error detection even before running your code.

So far, we've only added return type hints to :func:`mne.io.read_raw`, :func:`mne.read_epochs`, :func:`mne.read_evokeds` and
all format-specific ``read_raw_*()`` and ``read_epochs_*()`` functions. Now your editors will know:
these functions return evoked and raw data, respectively. We are planning add type hints to more functions after careful
evaluation in the future.

You don't need to do anything to benefit from these changes – your editor will pick them up automatically and provide the
enhanced experience if it supports it!

Enhancements
~~~~~~~~~~~~
- Speed up export to .edf in :func:`mne.export.export_raw` by using ``edfio`` instead of ``EDFlib-Python`` (:gh:`12218` by :newcontrib:`Florian Hofer`)
- Inform the user about channel discrepancy between provided info, forward operator, and/or covariance matrices in :func:`mne.beamformer.make_lcmv` (:gh:`12238` by :newcontrib:`Nikolai Kapralov`)
- We added type hints for the return values of raw, epochs, and evoked reading functions. Development environments like VS Code or PyCharm will now provide more help when using these functions in your code. (:gh:`12250`, :gh:`12297` by `Richard Höchenberger`_ and `Eric Larson`_)
- Add ``method="polyphase"`` to :meth:`mne.io.Raw.resample` and related functions to allow resampling using :func:`scipy.signal.upfirdn` (:gh:`12268` by `Eric Larson`_)
- The package build backend was switched from ``setuptools`` to ``hatchling``. This will only affect users who build and install MNE-Python from source. (:gh:`12269`, :gh:`12281` by `Richard Höchenberger`_)
- :meth:`mne.Annotations.to_data_frame` can now output different formats for the ``onset`` column: seconds, milliseconds, datetime objects, and timedelta objects. (:gh:`12289` by `Daniel McCloy`_)

Bugs
~~~~
- Allow :func:`mne.viz.plot_compare_evokeds` to plot eyetracking channels, and improve error handling (:gh:`12190` by `Scott Huberty`_)
- Fix bug with accessing the last data sample using ``raw[:, -1]`` where an empty array was returned (:gh:`12248` by `Eric Larson`_)
- Remove incorrect type hints in :func:`mne.io.read_raw_neuralynx` (:gh:`12236` by `Richard Höchenberger`_)
- Fix bug where parent directory existence was not checked properly in :meth:`mne.io.Raw.save` (:gh:`12282` by `Eric Larson`_)
- ``defusedxml`` is now an optional (rather than required) dependency and needed when reading EGI-MFF data, NEDF data, and BrainVision montages (:gh:`12264` by `Eric Larson`_)

API changes
~~~~~~~~~~~
- None yet
.. towncrier-draft-entries:: Version |release| (development)
34 changes: 0 additions & 34 deletions doc/changes/devel.rst.template

This file was deleted.

1 change: 1 addition & 0 deletions doc/changes/devel/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
!.gitignore
1 change: 1 addition & 0 deletions doc/changes/devel/12190.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Allow :func:`mne.viz.plot_compare_evokeds` to plot eyetracking channels, and improve error handling, y `Scott Huberty`_.
1 change: 1 addition & 0 deletions doc/changes/devel/12218.enhancement.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Speed up export to .edf in :func:`mne.export.export_raw` by using ``edfio`` instead of ``EDFlib-Python``.
1 change: 1 addition & 0 deletions doc/changes/devel/12236.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove incorrect type hints in :func:`mne.io.read_raw_neuralynx`, by `Richard Höchenberger`_.
1 change: 1 addition & 0 deletions doc/changes/devel/12238.enhancement.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Inform the user about channel discrepancy between provided info, forward operator, and/or covariance matrices in :func:`mne.beamformer.make_lcmv`, by :newcontrib:`Nikolai Kapralov`.
1 change: 1 addition & 0 deletions doc/changes/devel/12248.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix bug with accessing the last data sample using ``raw[:, -1]`` where an empty array was returned, by `Eric Larson`_.
1 change: 1 addition & 0 deletions doc/changes/devel/12250.enhancement.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
We added type hints for the return values of :func:`mne.read_evokeds` and :func:`mne.io.read_raw`. Development environments like VS Code or PyCharm will now provide more help when using these functions in your code. By `Richard Höchenberger`_ and `Eric Larson`_.
11 changes: 11 additions & 0 deletions doc/changes/devel/12250.notable.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
In this version, we started adding type hints (also known as "type annotations") to select parts of the codebase.
This meta information will be used by development environments (IDEs) like VS Code and PyCharm automatically to provide
better assistance such as tab completion or error detection even before running your code.

So far, we've only added return type hints to :func:`mne.io.read_raw`, :func:`mne.read_epochs`, :func:`mne.read_evokeds` and
all format-specific ``read_raw_*()`` and ``read_epochs_*()`` functions. Now your editors will know:
these functions return evoked and raw data, respectively. We are planning add type hints to more functions after careful
evaluation in the future.

You don't need to do anything to benefit from these changes – your editor will pick them up automatically and provide the
enhanced experience if it supports it!
1 change: 1 addition & 0 deletions doc/changes/devel/12264.dependency.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
``defusedxml`` is now an optional (rather than required) dependency and needed when reading EGI-MFF data, NEDF data, and BrainVision montages, by `Eric Larson`_.
1 change: 1 addition & 0 deletions doc/changes/devel/12268.enhancement.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add ``method="polyphase"`` to :meth:`mne.io.Raw.resample` and related functions to allow resampling using :func:`scipy.signal.upfirdn`, by `Eric Larson`_.
1 change: 1 addition & 0 deletions doc/changes/devel/12269.enhancement.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The package build backend was switched from ``setuptools`` to ``hatchling``. This will only affect users who build and install MNE-Python from source. By `Richard Höchenberger`_.
1 change: 1 addition & 0 deletions doc/changes/devel/12282.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix bug where parent directory existence was not checked properly in :meth:`mne.io.Raw.save`, by `Eric Larson`_.
1 change: 1 addition & 0 deletions doc/changes/devel/12289.enhancement.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
:meth:`mne.Annotations.to_data_frame` can now output different formats for the ``onset`` column: seconds, milliseconds, datetime objects, and timedelta objects. By `Daniel McCloy`_.
1 change: 1 addition & 0 deletions doc/changes/devel/other.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Use ``towncrier`` for automated release note generation, by `Eric Larson`_.
14 changes: 9 additions & 5 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,8 @@
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
curdir = os.path.dirname(__file__)
sys.path.append(os.path.abspath(os.path.join(curdir, "..", "mne")))
sys.path.append(os.path.abspath(os.path.join(curdir, "sphinxext")))
curpath = Path(__file__).parent.resolve(strict=True)
sys.path.append(str(curpath / "sphinxext"))


# -- Project information -----------------------------------------------------
Expand Down Expand Up @@ -107,6 +106,7 @@
"sphinx_gallery.gen_gallery",
"sphinxcontrib.bibtex",
"sphinxcontrib.youtube",
"sphinxcontrib.towncrier.ext",
# homegrown
"contrib_avatars",
"gen_commands",
Expand All @@ -123,7 +123,7 @@
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ["_includes"]
exclude_patterns = ["_includes", "changes/devel"]

# The suffix of source filenames.
source_suffix = ".rst"
Expand All @@ -149,6 +149,10 @@
copybutton_prompt_text = r">>> |\.\.\. |\$ "
copybutton_prompt_is_regexp = True

# -- sphinxcontrib-towncrier configuration -----------------------------------

towncrier_draft_working_directory = str(curpath.parent)

# -- Intersphinx configuration -----------------------------------------------

intersphinx_mapping = {
Expand Down Expand Up @@ -804,7 +808,7 @@ def append_attr_meth_examples(app, what, name, obj, options, lines):
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
switcher_version_match = "dev" if release.endswith("dev0") else version
switcher_version_match = "dev" if ".dev" in version else version
html_theme_options = {
"icon_links": [
dict(
Expand Down
39 changes: 39 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ doc = [
"pydata_sphinx_theme==0.13.3",
"sphinx-gallery",
"sphinxcontrib-bibtex>=2.5",
"sphinxcontrib-towncrier",
"memory_profiler",
"neo",
"seaborn!=0.11.2",
Expand Down Expand Up @@ -289,6 +290,7 @@ ignore_directives = [
"toctree",
"rst-class",
"tab-set",
"towncrier-draft-entries",
]
ignore_messages = "^.*(Unknown target name|Undefined substitution referenced)[^`]*$"

Expand Down Expand Up @@ -321,3 +323,40 @@ disable_error_code = [
'assignment',
'operator',
]

[tool.towncrier]
package = "mne"
directory = "doc/changes/devel/"
filename = "doc/changes/devel.rst"
title_format = "{version} ({project_date})"
issue_format = "`#{issue} <https://github.com/mne-tools/mne-python/pulls/{issue}>`__"

[[tool.towncrier.type]]
directory = "notable"
name = "Notable changes"
showcontent = true

[[tool.towncrier.type]]
directory = "dependency"
name = "Dependencies"
showcontent = true

[[tool.towncrier.type]]
directory = "bugfix"
name = "Bugfixes"
showcontent = true

[[tool.towncrier.type]]
directory = "deprecation"
name = "Deprecations and API changes"
showcontent = true

[[tool.towncrier.type]]
directory = "enhancement"
name = "Enhancements"
showcontent = true

[[tool.towncrier.type]]
directory = "other"
name = "Other changes"
showcontent = true

0 comments on commit 848659c

Please sign in to comment.