Skip to content

Commit e2eb74d

Browse files
committed
Restore print statements in scripts
1 parent f0e530a commit e2eb74d

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

scripts/create_django_issue.py

+12
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ def get_package_info(package: str) -> dict:
6363
# "django" converts to "Django" on redirect
6464
r = requests.get(f"https://pypi.org/pypi/{package}/json", allow_redirects=True) # noqa: S113
6565
if not r.ok:
66+
print(f"Couldn't find package: {package}")
6667
sys.exit(1)
6768
return r.json()
6869

@@ -95,12 +96,14 @@ def get_all_latest_django_versions(
9596
if django_max_version:
9697
_django_max_version = django_max_version
9798

99+
print("Fetching all Django versions from PyPI")
98100
base_txt = REQUIREMENTS_DIR / "base.txt"
99101
with base_txt.open() as f:
100102
for line in f.readlines():
101103
if "django==" in line.lower():
102104
break
103105
else:
106+
print(f"django not found in {base_txt}") # Huh...?
104107
sys.exit(1)
105108

106109
# Begin parsing and verification
@@ -149,6 +152,7 @@ def setup(self) -> None:
149152
self.load_existing_issues()
150153

151154
def load_requirements(self):
155+
print("Reading requirements")
152156
for requirements_file in self.requirements_files:
153157
with (REQUIREMENTS_DIR / f"{requirements_file}.txt").open() as f:
154158
for line in f.readlines():
@@ -167,6 +171,7 @@ def load_requirements(self):
167171

168172
def load_existing_issues(self):
169173
"""Closes the issue if the base Django version is greater than needed"""
174+
print("Load existing issues from GitHub")
170175
qualifiers = {
171176
"repo": GITHUB_REPO,
172177
"author": "app/github-actions",
@@ -175,6 +180,7 @@ def load_existing_issues(self):
175180
"in": "title",
176181
}
177182
issues = list(self.github.search_issues("[Django Update]", "created", "desc", **qualifiers))
183+
print(f"Found {len(issues)} issues matching search")
178184
for issue in issues:
179185
matches = re.match(r"\[Update Django] Django (\d+.\d+)$", issue.title)
180186
if not matches:
@@ -258,18 +264,23 @@ def generate_markdown(self, needed_dj_version: DjVersion):
258264

259265
def create_or_edit_issue(self, needed_dj_version: DjVersion, description: str):
260266
if issue := self.existing_issues.get(needed_dj_version):
267+
print(f"Editing issue #{issue.number} for Django {needed_dj_version}")
261268
issue.edit(body=description)
262269
else:
270+
print(f"Creating new issue for Django {needed_dj_version}")
263271
issue = self.repo.create_issue(f"[Update Django] Django {needed_dj_version}", description)
264272
issue.add_to_labels(f"django{needed_dj_version}")
265273

266274
@staticmethod
267275
def close_issue(issue: Issue):
268276
issue.edit(state="closed")
277+
print(f"Closed issue {issue.title} (ID: [{issue.id}]({issue.url}))")
269278

270279
def generate(self):
271280
for version in self.needed_dj_versions:
281+
print(f"Handling GitHub issue for Django {version}")
272282
md_content = self.generate_markdown(version)
283+
print(f"Generated markdown:\n\n{md_content}")
273284
self.create_or_edit_issue(version, md_content)
274285

275286

@@ -282,6 +293,7 @@ def main(django_max_version=None) -> None:
282293
manager.setup()
283294

284295
if not latest_djs:
296+
print("No new Django versions to update. Exiting...")
285297
sys.exit(0)
286298

287299
manager.generate()

scripts/update_changelog.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,31 @@ def main() -> None:
2626
merged_date = dt.date.today() - dt.timedelta(days=1) # noqa: DTZ011
2727
repo = Github(login_or_token=GITHUB_TOKEN).get_repo(GITHUB_REPO)
2828
merged_pulls = list(iter_pulls(repo, merged_date))
29+
print(f"Merged pull requests: {merged_pulls}")
2930
if not merged_pulls:
31+
print("Nothing was merged, existing.")
3032
return
3133

3234
# Group pull requests by type of change
3335
grouped_pulls = group_pulls_by_change_type(merged_pulls)
3436
if not any(grouped_pulls.values()):
37+
print("Pull requests merged aren't worth a changelog mention.")
3538
return
3639

3740
# Generate portion of markdown
3841
release_changes_summary = generate_md(grouped_pulls)
42+
print(f"Summary of changes: {release_changes_summary}")
3943

4044
# Update CHANGELOG.md file
4145
release = f"{merged_date:%Y.%m.%d}"
4246
changelog_path = ROOT / "CHANGELOG.md"
4347
write_changelog(changelog_path, release, release_changes_summary)
48+
print(f"Wrote {changelog_path}")
4449

4550
# Update version
4651
setup_py_path = ROOT / "pyproject.toml"
4752
update_version(setup_py_path, release)
53+
print(f"Updated version in {setup_py_path}")
4854

4955
# Run uv lock
5056
uv_lock_path = ROOT / "uv.lock"
@@ -54,11 +60,12 @@ def main() -> None:
5460
update_git_repo([changelog_path, setup_py_path, uv_lock_path], release)
5561

5662
# Create GitHub release
57-
repo.create_git_release(
63+
github_release = repo.create_git_release(
5864
tag=release,
5965
name=release,
6066
message=release_changes_summary,
6167
)
68+
print(f"Created release on GitHub {github_release}")
6269

6370

6471
def iter_pulls(
@@ -148,6 +155,7 @@ def update_git_repo(paths: list[Path], release: str) -> None:
148155
)
149156
repo.git.tag("-a", release, m=message)
150157
server = f"https://{GITHUB_TOKEN}@github.com/{GITHUB_REPO}.git"
158+
print(f"Pushing changes to {GIT_BRANCH} branch of {GITHUB_REPO}")
151159
repo.git.push(server, GIT_BRANCH)
152160
repo.git.push("--tags", server, GIT_BRANCH)
153161

scripts/update_contributors.py

+2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@ def main() -> None:
2626
# Add missing users to the JSON file
2727
contrib_file = ContributorsJSONFile()
2828
for author in recent_authors:
29+
print(f"Checking if {author.login} should be added")
2930
if author.login not in contrib_file:
3031
contrib_file.add_contributor(author)
32+
print(f"Added {author.login} to contributors")
3133
contrib_file.save()
3234

3335
# Generate MD file from JSON file

0 commit comments

Comments
 (0)