Skip to content

Commit d009eda

Browse files
committed
Update cookiecutter
1 parent b8df1a7 commit d009eda

5 files changed

Lines changed: 24 additions & 13 deletions

File tree

.ci/run_container.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ else
6969
fi
7070
export PULP_CONTENT_ORIGIN
7171

72-
PULP_DJANGO_SECRET="$(python3 -c "import secrets; print(secrets.token_urlsafe(50))")"
73-
export PULP_DJANGO_SECRET
72+
PULP_SECRET_KEY="$(python3 -c "import secrets; print(secrets.token_urlsafe(50))")"
73+
export PULP_SECRET_KEY
7474

7575
"${CONTAINER_RUNTIME}" \
7676
run ${RM:+--rm} \
@@ -82,7 +82,7 @@ export PULP_DJANGO_SECRET
8282
${PULP_DOMAIN_ENABLED:+--env PULP_DOMAIN_ENABLED} \
8383
${PULP_ENABLED_PLUGINS:+--env PULP_ENABLED_PLUGINS} \
8484
--env PULP_CONTENT_ORIGIN \
85-
--env PULP_DJANGO_SECRET \
85+
--env PULP_SECRET_KEY \
8686
--detach \
8787
--name "pulp-ephemeral" \
8888
--volume "${PULP_CLI_TEST_TMPDIR}/settings:/etc/pulp${SELINUX:+:Z}" \

.ci/scripts/check_click_for_mypy.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# "packaging>=25.0,<25.1",
66
# ]
77
# ///
8-
8+
import sys
99
from importlib import metadata
1010

1111
from packaging.version import Version
@@ -15,4 +15,4 @@
1515
if click_version < Version("8.1.1"):
1616
print("🚧 Linting with mypy is currently only supported with click>=8.1.1. 🚧")
1717
print("🔧 Please run `pip install click>=8.1.1` first. 🔨")
18-
exit(1)
18+
sys.exit(1)

.ci/scripts/collect_changes.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@
99

1010
import itertools
1111
import re
12+
import typing as t
1213
from pathlib import Path
1314

1415
import tomllib
1516
from git import GitCommandError, Repo
17+
from packaging.version import Version
1618
from packaging.version import parse as parse_version
1719

1820
# Read Towncrier settings
@@ -51,29 +53,29 @@
5153
)
5254

5355

54-
def get_changelog(repo, branch):
56+
def get_changelog(repo: Repo, branch: str) -> str:
5557
branch_tc_settings = tomllib.loads(repo.git.show(f"{branch}:pyproject.toml"))["tool"][
5658
"towncrier"
5759
]
5860
branch_changelog_file = branch_tc_settings.get("filename", "NEWS.rst")
5961
return repo.git.show(f"{branch}:{branch_changelog_file}") + "\n"
6062

6163

62-
def _tokenize_changes(splits):
64+
def _tokenize_changes(splits: list[str]) -> t.Iterator[list[Version | str]]:
6365
assert len(splits) % 3 == 0
6466
for i in range(len(splits) // 3):
6567
title = splits[3 * i]
6668
version = parse_version(splits[3 * i + 1])
6769
yield [version, title + splits[3 * i + 2]]
6870

6971

70-
def split_changelog(changelog):
72+
def split_changelog(changelog: str) -> tuple[str, list[list[Version | str]]]:
7173
preamble, rest = changelog.split(START_STRING, maxsplit=1)
7274
split_rest = re.split(TITLE_REGEX, rest)
7375
return preamble + START_STRING + split_rest[0], list(_tokenize_changes(split_rest[1:]))
7476

7577

76-
def main():
78+
def main() -> None:
7779
repo = Repo(Path.cwd())
7880
remote = repo.remotes[0]
7981
branches = [ref for ref in remote.refs if re.match(r"^([0-9]+)\.([0-9]+)$", ref.remote_head)]
@@ -91,7 +93,7 @@ def main():
9193
except GitCommandError:
9294
print("No changelog found on this branch.")
9395
continue
94-
dummy, changes = split_changelog(changelog)
96+
_dummy, changes = split_changelog(changelog)
9597
new_changes = sorted(main_changes + changes, key=lambda x: x[0], reverse=True)
9698
# Now remove duplicates (retain the first one)
9799
main_changes = [new_changes[0]]

pulp-glue-workflow/pyproject.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,11 @@ line-length = 100
4747
[tool.ruff.lint]
4848
# This section is managed by the cookiecutter templates.
4949
select = ["E4", "E7", "E9", "F"]
50-
extend-select = ["I", "INT", "PTH"]
50+
extend-select = ["FURB", "I", "INT", "PTH", "SIM1", "TID", "T10", "UP"]
51+
52+
[tool.ruff.lint.flake8-tidy-imports.banned-api]
53+
# This section is managed by the cookiecutter templates.
54+
"distutils".msg = "The 'distutils' module has been deprecated since Python 3.9."
5155

5256

5357
[tool.mypy]

pyproject.toml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,13 +188,18 @@ line-length = 100
188188
[tool.ruff.lint]
189189
# This section is managed by the cookiecutter templates.
190190
select = ["E4", "E7", "E9", "F"]
191-
extend-select = ["I", "INT", "PTH"]
191+
extend-select = ["FURB", "I", "INT", "PTH", "SIM1", "TID", "T10", "UP"]
192192

193193
[tool.ruff.lint.isort]
194194
# This section is managed by the cookiecutter templates.
195195
sections = { second-party = ["pulp_glue"] }
196196
section-order = ["future", "standard-library", "third-party", "second-party", "first-party", "local-folder"]
197197

198+
[tool.ruff.lint.flake8-tidy-imports.banned-api]
199+
# This section is managed by the cookiecutter templates.
200+
"distutils".msg = "The 'distutils' module has been deprecated since Python 3.9."
201+
"pulpcore.cli.common.generic".msg = "This module moved to 'pulp_cli.generic'."
202+
198203

199204
[tool.mypy]
200205
# This section is managed by the cookiecutter templates.
@@ -225,7 +230,7 @@ dev = [
225230
lint = [
226231
{include-group = "test"},
227232
"mypy~=1.20.0",
228-
"ruff~=0.15.1",
233+
"ruff~=0.16.0",
229234
"shellcheck-py~=0.11.0.1",
230235
"types-pygments",
231236
"types-pyyaml",

0 commit comments

Comments
 (0)