8000 Added a utility to format changelogs from the auto-generated GitHub release notes by Nusnus · Pull Request #9408 · celery/celery · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Added a utility to format changelogs from the auto-generated GitHub release notes #9408

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

Merged
merged 2 commits into from
Nov 12, 2024

Conversation

Nusnus
Copy link
Member
@Nusnus Nusnus commented Nov 12, 2024

New Utility to Format Changelogs from Auto-Generated GitHub Release Notes

This PR introduces a utility script and updates the docs Makefile to streamline the process of generating formatted changelogs from GitHub's auto-generated release notes.

Changes Overview

  1. Added changelog_formatter.py script in the docs/ directory:

    • Reads the auto-generated release notes from the clipboard.
    • Processes the text to format the changelog entries.
    • Filters out unnecessary lines (e.g., pre-commit updates, new contributors).
    • Outputs a formatted changelog section ready to be pasted into Changelog.rst.
  2. Updated docs/Makefile:

    • Added a new changelog target that provides usage instructions and runs the changelog_formatter.py script.
    • Included help information for the new changelog target in the help section.
  3. Updated requirements/pkgutils.txt:

    • Added pyperclip==1.9.0 to handle clipboard operations within the script.

Detailed Description

1. changelog_formatter.py Script

  • Purpose: Automates the formatting of changelog entries from GitHub's release notes.

  • Features:

    • Clipboard Integration: Reads input directly from the clipboard to simplify the workflow.
    • Automatic Filtering: Removes lines related to pre-commit updates and other non-essential information.
    • Customizable Output: Outputs a formatted changelog section with placeholders for version, release date, and 8000 author.
  • Usage:

    • Copy the auto-generated release notes from GitHub to your clipboard.
    • Run the script via the Makefile target to process and format the changelog.
  • Example Output:

    Copy the following text to Changelog.rst:
    
    .. _version-x.y.z:
    
    x.y.z
    =====
    
    :release-date: <YYYY-MM-DD>
    :release-by: <FULL NAME>
    
    What's Changed
    ~~~~~~~~~~~~~~
    
    - Fix: Treat dbm.error as a corrupted schedule file (#9331)
    - Pin pre-commit to latest version 4.0.1 (#9343)
    - Bump mypy from 1.12.1 to 1.13.0 (#9373)
    - Pass timeout and confirm_timeout to producer.publish() (#9374)
    - Bump Kombu to v5.5.0rc2 (#9382)
    - Bump pytest-cov from 5.0.0 to 6.0.0 (#9388)
    - Default strict to False for Pydantic tasks (#9393)
    

2. docs/Makefile Updates

  • Added changelog Target:

    • Provides usage instructions directly in the terminal.
    • Executes the changelog_formatter.py script with the --clipboard option.
  • Updated help Section:

    • Included information about the new changelog target for easier discovery.
    .PHONY: changelog
    changelog:
    	@echo "Usage Instructions:"
    	@echo "1. Generate release notes using GitHub: https://github.com/celery/celery/releases/new"
    	@echo "   - Copy everything that's generated to your clipboard."
    	@echo "   - pre-commit lines will be removed automatically."
    	@echo "2. Run 'make -C docs changelog' from the root dir to process the changes and output the formatted text."
    	@echo ""
    	@echo "Processing changelog from clipboard..."
    	python ./changelog_formatter.py --clipboard

3. requirements/pkgutils.txt Update

  • Added Dependency:
    • pyperclip==1.9.0 is now required for clipboard operations used in the script.

Usage Instructions

  1. Generate Release Notes:

    • Navigate to GitHub Releases.
    • Generate the release notes for the new version.
    • Copy the entire generated content to your clipboard.
  2. Process the Changelog:

    • From the root directory of the project, run:
      make -C docs changelog
    • The script will output the formatted changelog to the terminal, highlighting sections with colors for better readability.
  3. Update Changelog.rst:

    • Copy the formatted output from the terminal.
    • Paste it into the Changelog.rst file within the appropriate version section.
    • Replace placeholders:
      • x.y.z with the new version number.
      • <YYYY-MM-DD> with the release date.
      • <FULL NAME> with your full name.

Benefits

  • Streamlined Workflow: Simplifies the process of updating the changelog with a consistent format.
  • Automation: Reduces manual editing by filtering out irrelevant information automatically.
  • Consistency: Ensures that all changelog entries adhere to the project's formatting standards.
  • Ease of Use: Integrates seamlessly with existing development workflows via the Makefile.

Additional Notes

  • Color Output: The script uses colorama to highlight sections when outputting to the terminal for better readability.
  • Dependencies: Ensure that all required packages are installed:
    pip install -r requirements/pkgutils.txt
  • Extensibility: The script can be further customized to adjust formatting or handle additional edge cases as needed.

Checklist

  • Added changelog_formatter.py script.
  • Updated docs/Makefile with a new changelog target and help information.
  • Updated requirements/pkgutils.txt to include pyperclip.
  • Tested the script to ensure it works as expected.
  • Updated documentation and usage instructions.

Warp 2024-11-12 18 09 59

Input (copied to clipboard):

## What's Changed
* Fix: Treat dbm.error as a corrupted schedule file by @stumpylog in https://github.com/celery/celery/pull/9331
* Pin pre-commit to latest version 4.0.1 by @pyup-bot in https://github.com/celery/celery/pull/9343
* [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci in https://github.com/celery/celery/pull/9369
* Bump mypy from 1.12.1 to 1.13.0 by @dependabot in https://github.com/celery/celery/pull/9373
* Pass timeout and confirm_timeout to producer.publish() by @thedrow in https://github.com/celery/celery/pull/9374
* [pre-commit.ci] pre-commit autoupdate by @pre-commit-ci in https://github.com/celery/celery/pull/9379
* Bump Kombu to v5.5.0rc2 by @Nusnus in https://github.com/celery/celery/pull/9382
* Bump pytest-cov from 5.0.0 to 6.0.0 by @dependabot in https://github.com/celery/celery/pull/9388
* default strict to False for pydantic tasks by @mathiasertl in https://github.com/celery/celery/pull/9393

## New Contributors
* @0x2b3bfa0 made their first contribution in https://github.com/celery/celery/pull/9361
* @hmnfalahi made their first contribution in https://github.com/celery/celery/pull/9362
* @Niennienzz made their first contribution in https://github.com/celery/celery/pull/9398
* @SlowMo24 made their first contribution in https://github.com/celery/celery/pull/9405

**Full Changelog**: https://github.com/celery/celery/compare/v5.5.0rc1...v5.5.0rc2

Output:
Warp 2024-11-12 18 09 44

Copy link
codecov bot commented Nov 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.15%. Comparing base (80dff7d) to head (53c86f1).
Report is 51 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #9408   +/-   ##
=======================================
  Coverage   78.15%   78.15%           
=======================================
  Files         151      151           
  Lines       18984    18984           
  Branches     2508     2508           
=======================================
  Hits        14836    14836           
- Misses       3858     3860    +2     
+ Partials      290      288    -2     
Flag Coverage Δ
unittests 78.12% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Nusnus Nusnus self-assigned this Nov 12, 2024
@Nusnus Nusnus added this to the 5.5.0 milestone Nov 12, 2024
@Nusnus Nusnus marked this pull request as ready for review November 12, 2024 16:25
@Nusnus Nusnus merged commit dfe241e into celery:main Nov 12, 2024
69 of 70 checks passed
@Nusnus Nusnus deleted the hotfix branch November 12, 2024 16:25
@Nusnus
Copy link
Member Author
Nusnus commented Nov 12, 2024

@auvipy @thedrow FYI, I got too tired from manually converting the changes each release so I’ve developed a tool to do it automatically. TL;DR, Generate Release Notes on GitHub -> Ctrl/Cmd+A -> Ctrl/Cmd+C -> make -C docs changelog:

make -C docs changelog
Usage Instructions:
1. Generate release notes using GitHub: https://github.com/celery/celery/releases/new
   - Copy everything that's generated to your clipboard.
   - pre-commit lines will be removed automatically.
2. Run 'make -C docs changelog' from the root dir, to manually process the changes and output the formatted text.

Processing changelog from clipboard...
python ./changelog_formatter.py --clipboard
Copy the following text to Changelog.rst:

.. _version-x.y.z:

x.y.z
=====

:release-date: <YYYY-MM-DD>
:release-by: <FULL NAME>

What's Changed
~~~~~~~~~~~~~~

- Fix: Treat dbm.error as a corrupted schedule file (#9331)
- Pin pre-commit to latest version 4.0.1 (#9343)
- Bump mypy from 1.12.1 to 1.13.0 (#9373)
- Pass timeout and confirm_timeout to producer.publish() (#9374)
- Bump Kombu to v5.5.0rc2 (#9382)
- Bump pytest-cov from 5.0.0 to 6.0.0 (#9388)
- default strict to False for pydantic tasks (#9393)

Or without anything usable in the clipboard:

make -C docs changelog
Usage Instructions:
1. Generate release notes using GitHub: https://github.com/celery/celery/releases/new
   - Copy everything that's generated to your clipboard.
   - pre-commit lines will be removed automatically.
2. Run 'make -C docs changelog' from the root dir, to manually process the changes and output the formatted text.

Processing changelog from clipboard...
python ./changelog_formatter.py --clipboard
Copy the following text to Changelog.rst:

.. _version-x.y.z:

x.y.z
=====

:release-date: <YYYY-MM-DD>
:release-by: <FULL NAME>

What's Changed
~~~~~~~~~~~~~~
8000

@Nusnus
Copy link
Member Author
Nusnus commented Nov 12, 2024

@cclauss FYI, might be useful in other places too. For now, I added it to the celery repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
0