-
-
Notifications
You must be signed in to change notification settings - Fork 90
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
📝 Integrate Towncrier #654
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #654 +/- ##
=======================================
Coverage 83.58% 83.58%
=======================================
Files 28 28
Lines 4172 4172
=======================================
Hits 3487 3487
Misses 685 685 |
webknjaz
force-pushed
the
maintenance/towncrier
branch
7 times, most recently
from
April 2, 2024 23:51
21bda71
to
f1d7490
Compare
15 tasks
webknjaz
force-pushed
the
maintenance/towncrier
branch
9 times, most recently
from
April 8, 2024 17:54
3a82362
to
ed4bc54
Compare
This allows tracking change log entries within pull requests. Below is the script used to convert the old semi-dynamic changelog format into a static one: #! /usr/bin/env python3 import subprocess from pathlib import Path from re import sub as _re_replace from dateutil.parser import parse as parse_timestamp def _get_scm_timestamp_for(committish): """Retrieve the tag date from SCM.""" try: ts = subprocess.check_output( ('git', 'log', '-1', '--format=%aI', committish), stderr=subprocess.DEVNULL, text=True, ).strip() except subprocess.SubprocessError: raise ValueError( f'There is no `{committish}` in Git', ) from None return parse_timestamp(ts) def _retrieve_release_date(version_tag): try: version_date = _get_scm_timestamp_for(version_tag) except (ValueError, RuntimeError): return 'no Git tag matched' else: return f'{version_date:%Y-%m-%d}' changes_rst_path = Path('CHANGES.rst') changes_rst_txt = changes_rst_path.read_text() def _replace_version(ver_match_obj) -> str: version_str = ver_match_obj.group('version_string') prefixed_version_str = f'v{version_str !s}' release_date = _retrieve_release_date(prefixed_version_str) return f'{prefixed_version_str !s}\n{"=" * len(prefixed_version_str)}\n\n*({release_date !s})*' replaced_changes_rst_txt = _re_replace(r'.. scm-version-title:: v(?P<version_string>\d+.\d+.\d+)', _replace_version, changes_rst_txt) changes_rst_path.write_text(replaced_changes_rst_txt)
Otherwise, `sphinxcontrib.spelling` would complain about `dev` and two/three-letter local version identifier segments as misspelled[[1]]. [1]: sphinx-contrib/spelling#224
This includes GitHub Actions CI/CD, tox and lockfiles.
webknjaz
force-pushed
the
maintenance/towncrier
branch
from
April 8, 2024 23:26
ed4bc54
to
f8babb3
Compare
webknjaz
added a commit
that referenced
this pull request
Apr 16, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This allows tracking change log entries within pull requests.
Below is the script used to convert the old semi-dynamic changelog format into a static one:
❓ What kind of change does this PR introduce?
📋 What is the related issue number (starting with
#
)N/A
❓ What is the current behavior? (You can also link to an open issue here)
The resulting changelog is crafted manually with titles produced by a custom in-repo directive that retrieves the date from Git dynamically.
❓ What is the new behavior (if this is a feature change)?
The changelog file is static. News fragments are to be enclosed with pull requests.
📋 Other information:
N/A
📋 Contribution checklist:
(If you're a first-timer, check out
this guide on making great pull requests)
the changes have been approved
and description in grammatically correct, complete sentences
This change is