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

Upgrade sphinxcontrib-towncrier to 0.2.0a0 #9805

Merged
merged 2 commits into from
Apr 17, 2021

Conversation

uranusjr
Copy link
Member

See sphinx-contrib/sphinxcontrib-towncrier#44. Let’s see if this works.

@uranusjr uranusjr added the skip news Does not need a NEWS file entry (eg: trivial changes) label Apr 14, 2021
@webknjaz

This comment has been minimized.

@uranusjr
Copy link
Member Author

uranusjr commented Apr 14, 2021

Hmm, it seems like the “Unreleased as on” part is rendered wrong. @webknjaz Do you think this is an issue with pip’s usage or the plugin?

This is how pip does it:

pip/docs/html/news.rst

Lines 1 to 12 in e6a65fc

=========
Changelog
=========
.. attention::
Major and minor releases of pip also include changes listed within
prior beta releases.
.. towncrier-draft-entries:: |release|, unreleased as on
.. pip-news-include:: ../../NEWS.rst

The incorrect result: https://pip--9805.org.readthedocs.build/en/9805/news/

Expected result (from the main branch): https://pip.pypa.io/en/latest/news/

@webknjaz
Copy link
Member

Yes, this is weird. OTOH the only thing that changed functionally is try/except when calling a private function to get the config... Probably needs investigation.

@webknjaz
Copy link
Member

And since the extension basically dumps towncrier --draft ... output, I wonder if it's towncrier that now does something differently...

@webknjaz webknjaz self-assigned this Apr 14, 2021
@webknjaz
Copy link
Member

I wonder if it's towncrier that now does something differently...

Yep, I just confirmed that towncrier no longer prints out the title.

@webknjaz
Copy link
Member

webknjaz commented Apr 14, 2021

This was what I thought: they started passing {{ top_line }} into the Jinja2 template context instead of rendering themselves and since pip's template does not have it — nothing is rendered there.

Ref: twisted/towncrier#276.

@uranusjr this will fix the problem

diff --git a/tools/news/template.rst b/tools/news/template.rst
index 7ea90573d..d17faa414 100644
--- a/tools/news/template.rst
+++ b/tools/news/template.rst
@@ -1,3 +1,5 @@
+{{ top_line }}
+
 {% for section in sections %}
 {% set underline = "-" %}
 {% if section %}

Extension-wise, we could probably add a check for the top_line presence in the template and issue a warning but that's about it...

This allows sphinxcontrib-towncrier to render it in the documentation.
The rendering of NEWS.rst is unchanged since Towncrier detects
automatically if that line exists and does not render a duplicated
section title.
@uranusjr
Copy link
Member Author

That seems to work (I added a couple of extra newline controls for cosmetics).

@uranusjr uranusjr marked this pull request as ready for review April 14, 2021 23:24
@uranusjr uranusjr requested a review from webknjaz April 15, 2021 00:04
@webknjaz
Copy link
Member

Yeah, I tested on your branch locally before posting that diff :)

@uranusjr uranusjr merged commit c6ab30a into pypa:main Apr 17, 2021
@uranusjr uranusjr deleted the sphinxcontrib-towncrier-020a0 branch April 17, 2021 15:47
@webknjaz
Copy link
Member

@uranusjr I overlooked one thing — it appears that your change adding -}} breaks the title now: https://pip--9805.org.readthedocs.build/en/9805/news/#changelog

@webknjaz
Copy link
Member

So that Towncrier regression makes normal and draft runs produce different outputs: twisted/towncrier#105. Possible fix: twisted/towncrier#303.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
skip news Does not need a NEWS file entry (eg: trivial changes)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants