afterpython 0.4.3__py3-none-any.whl → 0.4.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -25,13 +25,14 @@ def _find_ruff_config_conflicts() -> list[str]:
25
25
  return conflicts
26
26
 
27
27
 
28
- def init_ruff():
28
+ def init_ruff() -> str | None:
29
+ """Returns a skip notice when an existing config made it skip the setup, else None."""
29
30
  import tomlkit
30
31
 
31
32
  from afterpython.tools.pyproject import read_pyproject, write_pyproject
32
33
 
33
34
  if conflicts := _find_ruff_config_conflicts():
34
- click.echo(
35
+ return (
35
36
  click.style(
36
37
  f"Skipped ruff setup: found existing ruff config ({', '.join(conflicts)}).\n",
37
38
  fg="yellow",
@@ -45,7 +46,6 @@ def init_ruff():
45
46
  "To fix: remove the config(s) above (keep a copy of any settings you want), "
46
47
  "run `ap init ruff`, then add your settings to afterpython/ruff.toml."
47
48
  )
48
- return
49
49
 
50
50
  ruff_toml_path = ap.paths.afterpython_path / "ruff.toml"
51
51
  if ruff_toml_path.exists():
@@ -57,7 +57,7 @@ def init_ruff():
57
57
 
58
58
  data = read_pyproject()
59
59
  if "ruff" in data.get("tool", {}):
60
- return # already points to afterpython/ruff.toml (checked above)
60
+ return None # already points to afterpython/ruff.toml (checked above)
61
61
  if "tool" not in data:
62
62
  data["tool"] = tomlkit.table(is_super_table=True)
63
63
  ruff_table = tomlkit.table()
@@ -65,6 +65,7 @@ def init_ruff():
65
65
  data["tool"]["ruff"] = ruff_table
66
66
  write_pyproject(data)
67
67
  click.echo(f'Added [tool.ruff] extend = "{RUFF_EXTEND}" to pyproject.toml')
68
+ return None
68
69
 
69
70
 
70
71
  def _find_ty_config_conflicts() -> list[str]:
@@ -80,9 +81,10 @@ def _find_ty_config_conflicts() -> list[str]:
80
81
  return conflicts
81
82
 
82
83
 
83
- def init_ty():
84
+ def init_ty() -> str | None:
85
+ """Returns a skip notice when an existing config made it skip the setup, else None."""
84
86
  if conflicts := _find_ty_config_conflicts():
85
- click.echo(
87
+ return (
86
88
  click.style(
87
89
  f"Skipped ty setup: found existing ty config ({', '.join(conflicts)}).\n",
88
90
  fg="yellow",
@@ -96,14 +98,14 @@ def init_ty():
96
98
  "To fix: remove the config(s) above (keep a copy of any settings you want), "
97
99
  "run `ap init ty`, then add your settings to afterpython/ty.toml."
98
100
  )
99
- return
100
101
 
101
102
  ty_toml_path = ap.paths.afterpython_path / "ty.toml"
102
103
  if ty_toml_path.exists():
103
104
  click.echo(f"ty configuration file {ty_toml_path} already exists")
104
- return
105
+ return None
105
106
  shutil.copy(ap.paths.templates_path / "ty-template.toml", ty_toml_path)
106
107
  click.echo(f"Created {ty_toml_path}")
108
+ return None
107
109
 
108
110
 
109
111
  def _find_cliff_config_conflicts() -> list[str]:
@@ -119,9 +121,10 @@ def _find_cliff_config_conflicts() -> list[str]:
119
121
  return conflicts
120
122
 
121
123
 
122
- def init_cliff():
124
+ def init_cliff() -> str | None:
125
+ """Returns a skip notice when an existing config made it skip the setup, else None."""
123
126
  if conflicts := _find_cliff_config_conflicts():
124
- click.echo(
127
+ return (
125
128
  click.style(
126
129
  f"Skipped git-cliff setup: found existing git-cliff config ({', '.join(conflicts)}).\n",
127
130
  fg="yellow",
@@ -132,14 +135,14 @@ def init_cliff():
132
135
  "To fix: remove the config(s) above (keep a copy of any settings you want), "
133
136
  "run `ap init cliff`, then add your settings to afterpython/cliff.toml."
134
137
  )
135
- return
136
138
 
137
139
  cliff_toml_path = ap.paths.afterpython_path / "cliff.toml"
138
140
  if cliff_toml_path.exists():
139
141
  click.echo(f"git-cliff configuration file {cliff_toml_path} already exists")
140
- return
142
+ return None
141
143
  shutil.copy(ap.paths.templates_path / "cliff-template.toml", cliff_toml_path)
142
144
  click.echo(f"Created {cliff_toml_path}")
145
+ return None
143
146
 
144
147
 
145
148
  def init_faq():
@@ -265,6 +268,8 @@ def init(ctx, yes, skip_website: bool):
265
268
  _preflight_init(website="website" in steps)
266
269
 
267
270
  click.echo("Initializing afterpython...")
271
+ # printed after everything else, so they're in the last lines of the (long) output
272
+ skip_notices: list[str] = []
268
273
  try:
269
274
  afterpython_path.mkdir(parents=True, exist_ok=True)
270
275
  static_path.mkdir(parents=True, exist_ok=True)
@@ -284,15 +289,15 @@ def init(ctx, yes, skip_website: bool):
284
289
 
285
290
  if "prek" in steps:
286
291
  init_prek()
287
- if "ruff" in steps:
288
- init_ruff()
289
- if "ty" in steps:
290
- init_ty()
292
+ if "ruff" in steps and (notice := init_ruff()):
293
+ skip_notices.append(notice)
294
+ if "ty" in steps and (notice := init_ty()):
295
+ skip_notices.append(notice)
291
296
  # whatever was selected: keep ruff/ty hooks only for the tools that were set up
292
297
  sync_hooks()
293
298
 
294
- if "cliff" in steps:
295
- init_cliff()
299
+ if "cliff" in steps and (notice := init_cliff()):
300
+ skip_notices.append(notice)
296
301
  if "release" in steps:
297
302
  create_workflow("release")
298
303
  if "dependabot" in steps:
@@ -303,6 +308,10 @@ def init(ctx, yes, skip_website: bool):
303
308
  shutil.rmtree(afterpython_path, ignore_errors=True)
304
309
  raise
305
310
 
311
+ for notice in skip_notices:
312
+ click.echo()
313
+ click.echo(notice)
314
+
306
315
 
307
316
  @init.command("ruff")
308
317
  def init_ruff_subcommand():
@@ -313,7 +322,8 @@ def init_ruff_subcommand():
313
322
  """
314
323
  from afterpython.tools.prek import sync_hooks
315
324
 
316
- init_ruff()
325
+ if notice := init_ruff():
326
+ click.echo(notice)
317
327
  sync_hooks()
318
328
 
319
329
 
@@ -326,7 +336,8 @@ def init_ty_subcommand():
326
336
  """
327
337
  from afterpython.tools.prek import sync_hooks
328
338
 
329
- init_ty()
339
+ if notice := init_ty():
340
+ click.echo(notice)
330
341
  sync_hooks()
331
342
 
332
343
 
@@ -337,7 +348,8 @@ def init_cliff_subcommand():
337
348
  Use this to re-run the git-cliff setup, e.g. after removing a conflicting
338
349
  git-cliff config that made `ap init` skip it.
339
350
  """
340
- init_cliff()
351
+ if notice := init_cliff():
352
+ click.echo(notice)
341
353
 
342
354
 
343
355
  @init.command("website")
@@ -46,7 +46,6 @@ repos:
46
46
  language: system
47
47
  types_or: [python, pyi, jupyter]
48
48
  pass_filenames: false
49
- always_run: true
50
49
  require_serial: true
51
50
  stages:
52
51
  - pre-commit
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: afterpython
3
- Version: 0.4.3
3
+ Version: 0.4.5
4
4
  Summary: CLI tool to streamline Python package maintenance and generate a dedicated project website
5
5
  Keywords: package-maintenance,project-website,static-site-generator,developer-tools,documentation,cli-tool,ci/cd,mystmd,semantic-release,python-packaging
6
6
  Author: Stephen Yau
@@ -26,7 +26,7 @@ afterpython/cli/commands/clean.py,sha256=3KETi9-LdRdfyxwoMr59bXNaFw2NajfZIWIyu31
26
26
  afterpython/cli/commands/commit_msg.py,sha256=2PYTqsxMeYaGwQSb2MER3a73gmUoSAietuApJW0XKw4,4513
27
27
  afterpython/cli/commands/dev.py,sha256=ZOxTM_ztRM3qvoWRFBmHDKPbNiFGhdUIP1dfBFQcy1o,10937
28
28
  afterpython/cli/commands/format.py,sha256=VFwCG9KDTF6j4Y_Ewp4_RpS8uNBQNOAj9HU_G97my5A,710
29
- afterpython/cli/commands/init.py,sha256=1tECOi_okfuZLgbXnVHek2-7qwLDXbLLEUrnX8EPrU4,14504
29
+ afterpython/cli/commands/init.py,sha256=DJXvXmw3yJJpDKhUpoTqoJB5_yng70QDEhnWnoHTIjY,15284
30
30
  afterpython/cli/commands/init_branch_rules.py,sha256=fzAm8D5qbW3u4bEMpqPuRgO-0akuCGG7pu09JlKhYn4,243
31
31
  afterpython/cli/commands/install.py,sha256=B8JuQmtU_4EZpHct2J5j30BGLkGmvwKvU26upbmabvQ,750
32
32
  afterpython/cli/commands/lint.py,sha256=4m_eXX7PC4CKPj3YhkNf79XwAe1qTYluEdKPJf0aCkQ,794
@@ -53,7 +53,7 @@ afterpython/templates/pdoc/custom.css,sha256=eAkXzF8jYInX88kHec2MoArxunTWnxSsCzy
53
53
  afterpython/templates/pdoc/frame.html.jinja2,sha256=byBlXAQBCcTDgj8vCiDjFjjo46DG6uaLzzRf2x9pMHI,989
54
54
  afterpython/templates/pdoc/syntax-highlighting.css,sha256=RqxTpVlTYuevLeGAUQbOJzK5UiVsQBhZfNSExvgmHag,10552
55
55
  afterpython/templates/pdoc/theme.css,sha256=Qf8GHLKJryY8EBJBxreAGjSoUTG73PDkYTwlGFMO7eI,904
56
- afterpython/templates/pre-commit-config-template.yaml,sha256=MXk79KxRFDaJynuCPtqgVbqJllaKIKI5Fdmwe08uiDU,2016
56
+ afterpython/templates/pre-commit-config-template.yaml,sha256=1dW_CEWyfgL_VeTWE8FIVa1HbhfdfMkxsBAiCRg5wcs,1995
57
57
  afterpython/templates/release-workflow-template.yml,sha256=9vd9C3-pWOHhA5WWgSG4PuH4bCBZs7EWmCc1kDIIVJM,4150
58
58
  afterpython/templates/ruff-template.toml,sha256=IU33i84L7IhcLFYZ7Cfdg8EVlpq6YVAQJ3vLQGLXOxk,1316
59
59
  afterpython/templates/ty-template.toml,sha256=8Z5jTnedzrNBgPaWYHY0RSVdXfg_SeNt1HO1OLnSA7E,666
@@ -66,7 +66,7 @@ afterpython/tools/prek.py,sha256=NEEGf8alTt9MIelAJ8yxWD-V4mnM_pJ7oHgVQG8pbzo,354
66
66
  afterpython/tools/pyproject.py,sha256=Slhxo-Z9M7Gn9ZGL2BKmbPONpDgAJ1g33TdiulxwEyQ,3700
67
67
  afterpython/utils.py,sha256=rbCOmRCHif2qzefw9rS-jFA05dz57hZKBr2mxVRaGR0,12406
68
68
  afterpython/version.py,sha256=hihRV1S-gc1m46OaXD32ikkEkqzs-Gtq7AcAqOQV-wY,1603
69
- afterpython-0.4.3.dist-info/WHEEL,sha256=MWx7psoF7KNST9G72pGtiBYuaXRXQXBk9pw5R6FzYko,80
70
- afterpython-0.4.3.dist-info/entry_points.txt,sha256=roa0PDgBueM1JPbRG0G2OSxzaN394OUL_oS9iEwVLBc,80
71
- afterpython-0.4.3.dist-info/METADATA,sha256=gRSh5SaDPSEsfA0ReraCiJnaPm8NBc_zCwvUzrRrrYU,6416
72
- afterpython-0.4.3.dist-info/RECORD,,
69
+ afterpython-0.4.5.dist-info/WHEEL,sha256=MWx7psoF7KNST9G72pGtiBYuaXRXQXBk9pw5R6FzYko,80
70
+ afterpython-0.4.5.dist-info/entry_points.txt,sha256=roa0PDgBueM1JPbRG0G2OSxzaN394OUL_oS9iEwVLBc,80
71
+ afterpython-0.4.5.dist-info/METADATA,sha256=zgrCptp485ygJE2xjaGdIvcJXU1NgTkAm1_UfkdCXHs,6416
72
+ afterpython-0.4.5.dist-info/RECORD,,