-
Notifications
You must be signed in to change notification settings - Fork 196
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
Add initial Towncrier integration #469
base: master
Are you sure you want to change the base?
Conversation
Thanks for submitting your first pull request! You are awesome! 🤗 |
Codecov ReportBase: 89.86% // Head: 89.86% // No change to project coverage 👍
Additional details and impacted files@@ Coverage Diff @@
## master #469 +/- ##
=======================================
Coverage 89.86% 89.86%
=======================================
Files 21 21
Lines 2150 2150
=======================================
Hits 1932 1932
Misses 218 218
Flags with carried forward coverage won't be shown. Click here to find out more. Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
f1cb2f3
to
c0a76ec
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chrisjsewell I've annotated some parts of the patch to make it easier for you to understand it. It's similar to how most of the projects in the wider Python community use it but with a few tiny adjustments to make it work in this one.
@@ -0,0 +1,11 @@ | |||
--- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a config for a GitHub App that is able to help with checking whether a change fragment is present in a given PR. It allows skipping this requirement by labeling a PR and for PRs created by certain robots. It needs to be installed separately from the PR but I've copied the config just in case.
@@ -1,5 +1,23 @@ | |||
# Changelog | |||
|
|||
[//]: # (DO-NOT-REMOVE-versioning-promise-START) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A marker for inclusion in Sphinx
https://github.com/executablebooks/MyST-Parser/tree/master/docs/changelog-fragments.d#adding-change-notes-with-your-prs | ||
--> | ||
|
||
<!-- towncrier release notes start --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Below this marker, Towncrier will inject the release entry using the j2 template.
@@ -0,0 +1,31 @@ | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the template Towncrier is set up to use. You can change virtually anything. Changing it won't affect the historic entries because Towncrier only adds new ones and doesn't touch anything that is already present in CHANGELOG.md
.
@@ -0,0 +1,25 @@ | |||
* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a safety thing, so undesired files can't be included by accident.
[[tool.towncrier.section]] | ||
path = "" | ||
|
||
[[tool.towncrier.type]] | ||
directory = "bugfix" | ||
name = "Bugfixes" | ||
showcontent = true | ||
|
||
[[tool.towncrier.type]] | ||
directory = "feature" | ||
name = "Features" | ||
showcontent = true | ||
|
||
[[tool.towncrier.type]] | ||
directory = "deprecation" | ||
name = "Deprecations (removal in next major release)" | ||
showcontent = true | ||
|
||
[[tool.towncrier.type]] | ||
directory = "breaking" | ||
name = "Backward incompatible changes" | ||
showcontent = true | ||
|
||
[[tool.towncrier.type]] | ||
directory = "doc" | ||
name = "Documentation" | ||
showcontent = true | ||
|
||
[[tool.towncrier.type]] | ||
directory = "misc" | ||
name = "Miscellaneous" | ||
showcontent = true | ||
|
||
[[tool.towncrier.type]] | ||
directory = "internal" | ||
name = "Contributor-facing changes" | ||
showcontent = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is where you can specify custom types.
setup.cfg
Outdated
@@ -65,12 +65,14 @@ linkify = | |||
# Note: This is only required for internal use | |||
rtd = | |||
ipython | |||
setuptools-scm ~= 6.3.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is used for an SCM-referencing version representation in Sphinx.
setup.cfg
Outdated
sphinx-book-theme~=0.1.0 | ||
sphinx-panels~=0.5.2 | ||
sphinxcontrib-bibtex~=2.1 | ||
sphinxext-rediraffe~=0.2 | ||
sphinxcontrib.mermaid~=0.6.3 | ||
sphinxext-opengraph~=0.4.2 | ||
sphinxcontrib-towncrier ~= 0.2.0a0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This allows embedding the "next release" changelog preview.
-git fetch --unshallow | ||
-git fetch --tags |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is necessary for setuptools-scm
to calculate the distance to the closest tag.
@@ -52,6 +57,41 @@ commands = | |||
-n -b {posargs:html} docs/ docs/_build/{posargs:html} | |||
|
|||
|
|||
[testenv:make-changelog] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use this command to preview the changelog draft on CLI or actually prepare the next release changelog entry if you pass an explicit version as mentioned in the description.
cheers @webknjaz! |
docs/conf.py
Outdated
github_url = "https://github.com" | ||
github_repo_org = "ansible" | ||
github_repo_name = "ansible-language-server" | ||
github_repo_slug = f"{github_repo_org}/{github_repo_name}" | ||
github_repo_url = f"{github_url}/{github_repo_slug}" | ||
github_sponsors_url = f"{github_url}/sponsors" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a copy-pasta?
Can this be all moved down with the extlinks configuration: I'm guessing that is only where it is being used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is. I have it here in all the projects because it's where the common args are defined + these can be reused in other places if necessary. Keeping such things in the same place across projects, makes sure that when I sync the configuration into various repos, there's not many conflicts, it's easier from the maintenance perspective.
from functools import partial | ||
from pathlib import Path | ||
|
||
from setuptools_scm import get_version |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I note that setuptools_scm
says "It is discouraged to use setuptools_scm from Sphinx itself": https://github.com/pypa/setuptools_scm/#usage-from-sphinx
thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds reasonable. Although, this code is what I use right now in many places and it works. Reading the version from metadata means that the project needs to be pip install
ed into the same venv where sphinx is. It would subsequently pull more dependencies which is not possible or desirable in some cases.
OTOH it's not possible to switch the solution right now because MyST does not use setuptools-scm
to generate the distribution version — we'd not have the desired information before such a switch.
But if you want, I can contribute that separately, after this PR is in, for example.
Sorry, I will eventually get round to addressing this 😅 |
7c01fc2
to
c866013
Compare
@chrisjsewell I've updated this for you |
c866013
to
b5d9fe2
Compare
Preview: https://myst-parser--469.org.readthedocs.build/en/469/develop/_changelog.html#changelog.
Resolves #454