8000 Ts/minor updates release process (#903) · kylebarron/datafusion-python@cdec202 · GitHub
[go: up one dir, main page]

Skip to content

Commit cdec202

Browse files
authored
Ts/minor updates release process (apache#903)
* Add instructions for updating submodule to test a release * Apply formatting to changelog script
1 parent af2d665 commit cdec202

File tree

2 files changed

+48
-29
lines changed

2 files changed

+48
-29
lines changed

dev/release/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ cd datafusion-python
169169
# checkout the release commit
170170
git fetch --tags
171171
git checkout 40.0.0-rc1
172+
git submodule update --init --recursive
172173

173174
# create the env
174175
python3 -m venv venv

dev/release/generate-changelog.py

Lines changed: 47 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,22 @@
2222
import re
2323
import subprocess
2424

25+
2526
def print_pulls(repo_name, title, pulls):
26-
if len(pulls) > 0:
27+
if len(pulls) > 0:
2728
print("**{}:**".format(title))
2829
print()
29-
for (pull, commit) in pulls:
30+
for pull, commit in pulls:
3031
url = "https://github.com/{}/pull/{}".format(repo_name, pull.number)
31-
print("- {} [#{}]({}) ({})".format(pull.title, pull.number, url, commit.author.login))
32+
print(
33+
"- {} [#{}]({}) ({})".format(
34+
pull.title, pull.number, url, commit.author.login
35+
)
36+
)
3237
print()
3338

3439

3540
def generate_changelog(repo, repo_name, tag1, tag2, version):
36-
3741
# get a list of commits between two tags
3842
print(f"Fetching list of commits between {tag1} and {tag2}", file=sys.stderr)
3943
comparison = repo.compare(tag1, tag2)
@@ -61,29 +65,27 @@ def generate_changelog(repo, repo_name, tag1, tag2, version):
6165

6266
# categorize the pull requests based on GitHub labels
6367
print("Categorizing pull requests", file=sys.stderr)
64-
for (pull, commit) in all_pulls:
65-
68+
for pull, commit in all_pulls:
6669
# see if PR title uses Conventional Commits
67-
cc_type = ''
68-
cc_scope = ''
69-
cc_breaking = ''
70-
parts = re.findall(r'^([a-z]+)(\([a-z]+\))?(!)?:', pull.title)
70+
cc_type = ""
71+
cc_breaking = ""
72+
parts = re.findall(r"^([a-z]+)(\([a-z]+\))?(!)?:", pull.title)
7173
if len(parts) == 1:
7274
parts_tuple = parts[0]
73-
cc_type = parts_tuple[0] # fix, feat, docs, chore
74-
cc_scope = parts_tuple[1] # component within project
75-
cc_breaking = parts_tuple[2] == '!'
75+
cc_type = parts_tuple[0] # fix, feat, docs, chore
76+
# cc_scope = parts_tuple[1] # component within project
77+
cc_breaking = parts_tuple[2] == "!"
7678

7779
labels = [label.name for label in pull.labels]
78-
if 'api change' in labels or cc_breaking:
80+
if "api change" in labels or cc_breaking:
7981
breaking.append((pull, commit))
80-
elif 'bug' in labels or cc_type == 'fix':
82+
elif "bug" in labels or cc_type == "fix":
8183
bugs.append((pull, commit))
82-
elif 'performance' in labels or cc_type == 'perf':
84+
elif "performance" in labels or cc_type == "perf":
8385
performance.append((pull, commit))
84-
elif 'enhancement' in labels or cc_type == 'feat':
86+
elif "enhancement" in labels or cc_type == "feat":
8587
enhancements.append((pull, commit))
86-
elif 'documentation' in labels or cc_type == 'docs' or cc_type == 'doc':
88+
elif "documentation" in labels or cc_type == "docs" or cc_type == "doc":
8789
docs.append((pull, commit))
8890
else:
8991
other.append((pull, commit))
@@ -114,13 +116,19 @@ def generate_changelog(repo, repo_name, tag1, tag2, version):
114116
print(f"# Apache DataFusion Python {version} Changelog\n")
115117

116118
# get the number of commits
117-
commit_count = subprocess.check_output(f"git log --pretty=oneline {tag1}..{tag2} | wc -l", shell=True, text=True).strip()
119+
commit_count = subprocess.check_output(
120+
f"git log --pretty=oneline {tag1}..{tag2} | wc -l", shell=True, text=True
121+
).strip()
118122

119123
# get number of contributors
120-
contributor_count = subprocess.check_output(f"git shortlog -sn {tag1}..{tag2} | wc -l", shell=True, text=True).strip()
124+
contributor_count = subprocess.check_output(
125+
f"git shortlog -sn {tag1}..{tag2} | wc -l", shell=True, text=True
126+
).strip()
121127

122-
print(f"This release consists of {commit_count} commits from {contributor_count} contributors. "
123-
f"See credits at the end of this changelog for more information.\n")
128+
print(
129+
f"This release consists of {commit_count} commits from {contributor_count} contributors. "
130+
f"See credits at the end of this changelog for more information.\n"
131+
)
124132

125133
print_pulls(repo_name, "Breaking changes", breaking)
126134
print_pulls(repo_name, "Performance related", performance)
@@ -130,17 +138,24 @@ def generate_changelog(repo, repo_name, tag1, tag2, version):
130138
print_pulls(repo_name, "Other", other)
131139

132140
# show code contributions
133-
credits = subprocess.check_output(f"git shortlog -sn {tag1}..{tag2}", shell=True, text=True).rstrip()
141+
credits = subprocess.check_output(
142+
f"git shortlog -sn {tag1}..{tag2}", shell=True, text=True
143+
).rstrip()
134144

135145
print("## Credits\n")
136-
print("Thank you to everyone who contributed to this release. Here is a breakdown of commits (PRs merged) "
137-
"per contributor.\n")
146+
print(
147+
"Thank you to everyone who contributed to this release. Here is a breakdown of commits (PRs merged) "
148+
"per contributor.\n"
149+
)
138150
print("```")
139151
print(credits)
140152
print("```\n")
141153

142-
print("Thank you also to everyone who contributed in other ways such as filing issues, reviewing "
143-
"PRs, and providing feedback on this release.\n")
154+
print(
155+
"Thank you also to everyone who contributed in other ways such as filing issues, reviewing "
156+
"PRs, and providing feedback on this release.\n"
157+
)
158+
144159

145160
def cli(args=None):
146161
"""Process command line arguments."""
@@ -150,7 +165,9 @@ def cli(args=None):
150165
parser = argparse.ArgumentParser()
151166
parser.add_argument("tag1", help="The previous commit or tag (e.g. 0.1.0)")
152167
parser.add_argument("tag2", help="The current commit or tag (e.g. HEAD)")
153-
parser.add_argument("version", help="The version number to include in the changelog")
168+
parser.add_argument(
169+
"version", help="The version number to include in the changelog"
170+
)
154171
args = parser.parse_args()
155172

156173
token = os.getenv("GITHUB_TOKEN")
@@ -160,5 +177,6 @@ def cli(args=None):
160177
repo = g.get_repo(project)
161178
generate_changelog(repo, project, args.tag1, args.tag2, args.version)
162179

180+
163181
if __name__ == "__main__":
164-
cli()
182+
cli()

0 commit comments

Comments
 (0)
0