Skip to content

Commit 62e3b41

Browse files
authored
chore(docs): allow specifying reno options per-version (backport #3541) (#3544)
This is an automatic backport of pull request #3541 done by [Mergify](https://mergify.com). --- <details> <summary>Mergify commands and options</summary> <br /> More conditions and actions can be found in the [documentation](https://docs.mergify.com/). You can also trigger Mergify actions by commenting on this pull request: - `@Mergifyio refresh` will re-evaluate the rules - `@Mergifyio rebase` will rebase this PR on its base branch - `@Mergifyio update` will merge the base branch into this PR - `@Mergifyio backport <destination>` will backport this PR on `<destination>` branch Additionally, on Mergify [dashboard](https://dashboard.mergify.com/) you can: - look at your merge queues - generate the Mergify configuration with the config editor. Finally, you can contact us on https://mergify.com </details>
1 parent ffda3c2 commit 62e3b41

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

docs/conf.py

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
from datetime import datetime
2121
import os.path
2222
import re
23+
from typing import Any
2324
from typing import Optional
2425

2526
from docutils import nodes
@@ -33,6 +34,7 @@
3334
from reno import loader
3435
from sphinx.util import logging
3536
from sphinx.util.nodes import nested_parse_with_titles
37+
import yaml
3638

3739

3840
# from setuptools-scm
@@ -394,6 +396,17 @@ class DDTraceReleaseNotesDirective(rst.Directive):
394396
release branch with only prereleases we will resolve to the rc1 version
395397
for that release. If there are any non-prereleases for that branch we will
396398
resolve to the first non-rc release.
399+
400+
401+
This directive's content can be a yaml config mapping per-version specific
402+
`reno options <https://docs.openstack.org/reno/latest/user/usage.html#configuring-reno>`.
403+
404+
For example::
405+
406+
.. ddtrace-release-notes::
407+
"1.0.0":
408+
ignore_notes:
409+
- "keep-alive-b5ec5febb435daad"
397410
"""
398411

399412
has_content = True
@@ -559,7 +572,14 @@ def run(self):
559572
4. Generate a reno config for reporting and generate the notes for each branch
560573
"""
561574
# This is where we will aggregate the generated notes
562-
title = " ".join(self.content)
575+
576+
# Parse version specific reno options from the directive
577+
version_options = {} # type: dict[Version, dict[str, Any]]
578+
if self.has_content:
579+
options = yaml.load("\n".join(self.content), Loader=yaml.CLoader)
580+
if options:
581+
version_options = {Version(version): data for version, data in options.items()}
582+
563583
result = statemachine.ViewList()
564584

565585
# Determine the max version we want to report for
@@ -596,6 +616,9 @@ def run(self):
596616
stop_at_branch_base=True,
597617
earliest_version=earliest_version,
598618
)
619+
if version in version_options:
620+
conf.override(**version_options[version])
621+
599622
LOG.info(
600623
"scanning %s for %s release notes, stopping at %s",
601624
os.path.join(self._repo.path, "releasenotes/notes"),
@@ -611,7 +634,6 @@ def run(self):
611634
ldr,
612635
conf,
613636
versions,
614-
title=title,
615637
branch=branch,
616638
)
617639

riotfile.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ def select_pys(min_version=MIN_PYTHON_VERSION, max_version=MAX_PYTHON_VERSION):
138138
"types-attrs": latest,
139139
"types-docutils": latest,
140140
"types-protobuf": latest,
141+
"types-PyYAML": latest,
141142
"types-setuptools": latest,
142143
"types-six": latest,
143144
},

0 commit comments

Comments
 (0)