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

📝 Integrate Towncrier #654

Merged
merged 3 commits into from
Apr 8, 2024
Merged

Commits on Apr 8, 2024

  1. 📝 Integrate Towncrier

    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)
    webknjaz committed Apr 8, 2024
    Configuration menu
    Copy the full SHA
    bceba9b View commit details
    Browse the repository at this point in the history
  2. 📝🎨 Mark versions as known word spellings

    Otherwise, `sphinxcontrib.spelling` would complain about `dev` and
    two/three-letter local version identifier segments as misspelled[[1]].
    
    [1]: sphinx-contrib/spelling#224
    webknjaz committed Apr 8, 2024
    Configuration menu
    Copy the full SHA
    d76e62a View commit details
    Browse the repository at this point in the history
  3. 🧪 Integrate changelog generation into CI/CD

    This includes GitHub Actions CI/CD, tox and lockfiles.
    webknjaz committed Apr 8, 2024
    Configuration menu
    Copy the full SHA
    f8babb3 View commit details
    Browse the repository at this point in the history