Skip to content

Commit deb2319

Browse files
committed
meta: lint-generated-project
1 parent f6f892e commit deb2319

File tree

6 files changed

+37
-30
lines changed

6 files changed

+37
-30
lines changed

noxfile.py

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import os
44
import shlex
5-
65
from pathlib import Path
76
from textwrap import dedent
87
from typing import List
@@ -50,9 +49,7 @@
5049
@nox.session(python=None, name="setup-git", tags=[ENV])
5150
def setup_git(session: Session) -> None:
5251
"""Set up the git repo for the current project."""
53-
session.run(
54-
"python", SCRIPTS_FOLDER / "setup-git.py", REPO_ROOT, external=True
55-
)
52+
session.run("python", SCRIPTS_FOLDER / "setup-git.py", REPO_ROOT, external=True)
5653

5754

5855
@nox.session(python=None, name="setup-venv", tags=[ENV])
@@ -61,7 +58,6 @@ def setup_venv(session: Session) -> None:
6158
session.run("python", SCRIPTS_FOLDER / "setup-venv.py", REPO_ROOT, "-p", PYTHON_VERSIONS[0], external=True)
6259

6360

64-
6561
@nox.session(python=DEFAULT_PYTHON_VERSION, name="pre-commit", tags=[CI])
6662
def precommit(session: Session) -> None:
6763
"""Lint using pre-commit."""
@@ -129,13 +125,7 @@ def tests_python(session: Session) -> None:
129125
test_results_dir.mkdir(parents=True, exist_ok=True)
130126
junitxml_file = test_results_dir / f"test-results-py{session.python}.xml"
131127

132-
session.run(
133-
"pytest",
134-
"--cov={}".format(PACKAGE_NAME),
135-
"--cov-report=xml",
136-
f"--junitxml={junitxml_file}",
137-
"tests/"
138-
)
128+
session.run("pytest", "--cov={}".format(PACKAGE_NAME), "--cov-report=xml", f"--junitxml={junitxml_file}", "tests/")
139129

140130

141131
@nox.session(python=DEFAULT_PYTHON_VERSION, name="docs-build", tags=[DOCS, BUILD])
@@ -194,7 +184,15 @@ def build_container(session: Session) -> None:
194184

195185
session.log(f"Building Docker image using {container_cli}.")
196186
project_image_name = PACKAGE_NAME.replace("_", "-").lower()
197-
session.run(container_cli, "build", str(current_dir), "-t", f"{project_image_name}:latest", "--progress=plain", external=True)
187+
session.run(
188+
container_cli,
189+
"build",
190+
str(current_dir),
191+
"-t",
192+
f"{project_image_name}:latest",
193+
"--progress=plain",
194+
external=True,
195+
)
198196

199197
session.log(f"Container image {project_image_name}:latest built locally.")
200198

@@ -243,15 +241,13 @@ def release(session: Session) -> None:
243241
cz_bump_args = ["uvx", "cz", "bump", "--changelog"]
244242

245243
if increment:
246-
cz_bump_args.append(f"--increment={increment}")
244+
cz_bump_args.append(f"--increment={increment}")
247245

248246
session.log("Running cz bump with args: %s", cz_bump_args)
249247
session.run(*cz_bump_args, success_codes=[0, 1], external=True)
250248

251249
session.log("Version bumped and tag created locally via Commitizen/uvx.")
252-
session.log(
253-
"IMPORTANT: Push commits and tags to remote (`git push --follow-tags`) to trigger CD pipeline."
254-
)
250+
session.log("IMPORTANT: Push commits and tags to remote (`git push --follow-tags`) to trigger CD pipeline.")
255251

256252

257253
@nox.session(venv_backend="none")
@@ -285,7 +281,9 @@ def coverage(session: Session) -> None:
285281
(e.g., via `nox -s test-python`).
286282
"""
287283
session.log("Collecting and reporting coverage across all test runs.")
288-
session.log("Note: Ensure 'nox -s test-python' was run across all desired Python versions first to generate coverage data.")
284+
session.log(
285+
"Note: Ensure 'nox -s test-python' was run across all desired Python versions first to generate coverage data."
286+
)
289287

290288
session.log("Installing dependencies for coverage report session...")
291289
session.install("-e", ".", "--group", "dev")
@@ -298,9 +296,9 @@ def coverage(session: Session) -> None:
298296
session.log(f"Combined coverage data into {coverage_combined_file.resolve()}")
299297
except CommandFailed as e:
300298
if e.returncode == 1:
301-
session.log("No coverage data found to combine. Run tests first with coverage enabled.")
299+
session.log("No coverage data found to combine. Run tests first with coverage enabled.")
302300
else:
303-
session.error(f"Failed to combine coverage data: {e}")
301+
session.error(f"Failed to combine coverage data: {e}")
304302
session.skip("Could not combine coverage data.")
305303

306304
session.log("Generating HTML coverage report.")

scripts/setup-git.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
33
Since this is a first time setup script, we intentionally only use builtin Python dependencies.
44
"""
5+
56
import argparse
67
import subprocess
78
from pathlib import Path
@@ -49,5 +50,5 @@ def get_parser() -> argparse.ArgumentParser:
4950
return parser
5051

5152

52-
if __name__ == '__main__':
53+
if __name__ == "__main__":
5354
main()

scripts/setup-remote.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
33
Since this is a first time setup script, we intentionally only use builtin Python dependencies.
44
"""
5+
56
import argparse
67
import subprocess
78
from pathlib import Path

scripts/setup-venv.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
33
Since this a first time setup script, we intentionally only use builtin Python dependencies.
44
"""
5+
56
import argparse
67
import shutil
78
import subprocess
@@ -22,8 +23,7 @@ def main() -> None:
2223
def get_parser() -> argparse.ArgumentParser:
2324
"""Creates the argument parser for setup-venv."""
2425
parser: argparse.ArgumentParser = argparse.ArgumentParser(
25-
prog="setup-venv",
26-
usage="python ./scripts/setup-venv.py . -p '3.9'"
26+
prog="setup-venv", usage="python ./scripts/setup-venv.py . -p '3.9'"
2727
)
2828
parser.add_argument(
2929
"path",
@@ -35,7 +35,7 @@ def get_parser() -> argparse.ArgumentParser:
3535
"-p",
3636
"--python",
3737
dest="python_version",
38-
help="The Python version that will serve as the main working version used by the IDE."
38+
help="The Python version that will serve as the main working version used by the IDE.",
3939
)
4040
return parser
4141

@@ -47,7 +47,7 @@ def setup_venv(path: Path, python_version: str) -> None:
4747
["uv", "venv", ".venv"],
4848
["uv", "python", "install", python_version],
4949
["uv", "python", "pin", python_version],
50-
["uv", "sync", "--all-groups"]
50+
["uv", "sync", "--all-groups"],
5151
]
5252
check_dependencies(path=path, dependencies=["uv"])
5353

@@ -59,5 +59,5 @@ def setup_venv(path: Path, python_version: str) -> None:
5959
subprocess.run(command, cwd=path, capture_output=True)
6060

6161

62-
if __name__ == '__main__':
62+
if __name__ == "__main__":
6363
main()

scripts/util.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Module containing util."""
2+
23
import argparse
34
import stat
45
import subprocess
@@ -9,12 +10,17 @@
910

1011
class MissingDependencyError(Exception):
1112
"""Exception raised when a depedency is missing from the system running setup-repo."""
13+
1214
def __init__(self, project: Path, dependency: str):
1315
"""Initializes MisssingDependencyError."""
14-
super().__init__("\n".join([
15-
f"Unable to find {dependency=}.",
16-
f"Please ensure that {dependency} is installed before setting up the repo at {project.absolute()}"
17-
]))
16+
super().__init__(
17+
"\n".join(
18+
[
19+
f"Unable to find {dependency=}.",
20+
f"Please ensure that {dependency} is installed before setting up the repo at {project.absolute()}",
21+
]
22+
)
23+
)
1824

1925

2026
def check_dependencies(path: Path, dependencies: list[str]) -> None:

src/robust_python_demo/__main__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
app: typer.Typer = typer.Typer()
77

8+
89
@app.command(name="robust-python-demo")
910
def main() -> None:
1011
"""Robust Python Demo."""

0 commit comments

Comments
 (0)