Merge pull request #64807 from ClickHouse/adjust-changelogs

Migrate changelog.py to a descendant of fuzzywuzzy
This commit is contained in:
Mikhail f. Shiryaev 2024-06-04 20:31:54 +00:00 committed by GitHub
commit 20acb38271
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 19 additions and 17 deletions

View File

@ -15,7 +15,6 @@ RUN apt-get update && env DEBIAN_FRONTEND=noninteractive apt-get install --yes \
file \
libxml2-utils \
moreutils \
python3-fuzzywuzzy \
python3-pip \
yamllint \
locales \
@ -23,8 +22,18 @@ RUN apt-get update && env DEBIAN_FRONTEND=noninteractive apt-get install --yes \
&& rm -rf /var/lib/apt/lists/* /var/cache/debconf /tmp/*
# python-magic is the same version as in Ubuntu 22.04
RUN pip3 install black==23.12.0 boto3 codespell==2.2.1 mypy==1.8.0 PyGithub unidiff pylint==3.1.0 \
python-magic==0.4.24 requests types-requests \
RUN pip3 install \
PyGithub \
black==23.12.0 \
boto3 \
codespell==2.2.1 \
mypy==1.8.0 \
pylint==3.1.0 \
python-magic==0.4.24 \
requests \
thefuzz \
types-requests \
unidiff \
&& rm -rf /root/.cache/pip
RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && locale-gen en_US.UTF-8

View File

@ -6,7 +6,7 @@ Generate github token:
Dependencies:
```
sudo apt-get update
sudo apt-get install git python3 python3-fuzzywuzzy python3-github
sudo apt-get install git python3 python3-thefuzz python3-github
python3 changelog.py -h
```
@ -15,10 +15,7 @@ Usage example:
Note: The working directory is ClickHouse/utils/changelog
```bash
export GITHUB_TOKEN="<your token>"
git fetch --tags # changelog.py depends on having the tags available, this will fetch them.
# If you are working from a branch in your personal fork, then you may need `git fetch --all`
GITHUB_TOKEN="<your token>"
python3 changelog.py --output=changelog-v22.4.1.2305-prestable.md --gh-user-or-token="$GITHUB_TOKEN" v21.6.2.7-prestable
python3 changelog.py --output=changelog-v22.4.1.2305-prestable.md --gh-user-or-token="$USER" --gh-password="$PASSWORD" v21.6.2.7-prestable

View File

@ -10,9 +10,9 @@ from datetime import date, timedelta
from subprocess import DEVNULL, CalledProcessError
from typing import Dict, List, Optional, TextIO
from fuzzywuzzy.fuzz import ratio # type: ignore
from github.GithubException import RateLimitExceededException, UnknownObjectException
from github.NamedUser import NamedUser
from thefuzz.fuzz import ratio # type: ignore
from git_helper import git_runner as runner
from git_helper import is_shallow
@ -100,17 +100,14 @@ def get_descriptions(prs: PullRequests) -> Dict[str, List[Description]]:
# obj._rawData doesn't spend additional API requests
# We'll save some requests
# pylint: disable=protected-access
repo_name = pr._rawData["base"]["repo"]["full_name"] # type: ignore
repo_name = pr._rawData["base"]["repo"]["full_name"]
# pylint: enable=protected-access
if repo_name not in repos:
repos[repo_name] = pr.base.repo
in_changelog = False
merge_commit = pr.merge_commit_sha
try:
runner.run(f"git rev-parse '{merge_commit}'")
except CalledProcessError:
# It's possible that commit not in the repo, just continue
logging.info("PR %s does not belong to the repo", pr.number)
if merge_commit is None:
logging.warning("PR %s does not have merge-commit, skipping", pr.number)
continue
in_changelog = merge_commit in SHA_IN_CHANGELOG

View File

@ -1,3 +1,2 @@
fuzzywuzzy
thefuzz
PyGitHub
python-Levenshtein