maketool 0.8.14__tar.gz → 0.8.16__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maketool
3
- Version: 0.8.14
3
+ Version: 0.8.16
4
4
  Summary: Python Automation tool for building PySide6 UI and PyInstaller EXE.
5
5
  Author-email: Alan Lilly <panofish@gmail.com>
6
6
  Requires-Python: >=3.7
@@ -7,17 +7,16 @@ Usage:
7
7
 
8
8
  Reports:
9
9
  1) UNUSED files: filename/path tokens not found in scanned text sources
10
- - Printed as plain relative paths, grouped by extension (no headers, no blank lines)
10
+ - Printed grouped by extension (same extensions together)
11
11
  2) MISSING imports: imports used by entry (and local-resolved siblings) but not installed
12
- - Printed as plain module names (no headers). Prints nothing if none missing.
13
12
  """
14
13
 
15
14
  from __future__ import annotations
16
15
 
17
16
  import ast
18
17
  import sys
19
- from dataclasses import dataclass
20
18
  from pathlib import Path
19
+ from dataclasses import dataclass
21
20
  from typing import Dict, Iterable, List, Optional, Set
22
21
 
23
22
  try:
@@ -97,10 +96,10 @@ def build_candidates(root: Path, files: list[Path]) -> list[Candidate]:
97
96
  stem = p.stem.lower()
98
97
 
99
98
  tokens = {
100
- base, # rat.ico
101
- stem, # common
102
- rel_norm, # icons/rat.ico
103
- rel_norm.replace("/", "\\"), # icons\rat.ico
99
+ base, # rat.ico
100
+ stem, # common
101
+ rel_norm, # icons/rat.ico
102
+ rel_norm.replace("/", "\\"), # icons\rat.ico
104
103
  }
105
104
  out.append(Candidate(p, rel, tuple(t for t in tokens if t)))
106
105
  return out
@@ -113,13 +112,16 @@ def is_text_source(p: Path) -> bool:
113
112
  return ext in DEFAULT_SCAN_EXTS
114
113
 
115
114
 
116
- def print_unused_grouped_by_ext(unused_rels: list[str]) -> None:
117
- # Sort by: extension (lower), then full relative path (lower)
118
- def key(rel: str):
119
- return (Path(rel).suffix.lower(), rel.lower())
120
-
121
- for rel in sorted(unused_rels, key=key):
122
- print(rel)
115
+ def print_group(title: str, rows: list[tuple[str, list[str]]]) -> None:
116
+ print(title)
117
+ print("-" * len(title))
118
+ for rel, refs in rows:
119
+ if refs:
120
+ preview = ", ".join(refs[:3]) + (" ..." if len(refs) > 3 else "")
121
+ print(f"{rel} <-- {preview}")
122
+ else:
123
+ print(rel)
124
+ print()
123
125
 
124
126
 
125
127
  # ----------------------------
@@ -264,8 +266,11 @@ def compute_missing_used_imports(
264
266
 
265
267
 
266
268
  def run_missing_imports_report(entry: Path, project_root: Path) -> None:
267
- # Print nothing if we cannot compute or if there are none missing
269
+ print("MISSING (used but not installed):")
270
+ print("------------------------------")
271
+
268
272
  if packages_distributions is None:
273
+ print("(skipped: Python 3.8+ required for importlib.metadata.packages_distributions())\n")
269
274
  return
270
275
 
271
276
  std = stdlib_names()
@@ -281,8 +286,12 @@ def run_missing_imports_report(entry: Path, project_root: Path) -> None:
281
286
  project_root=project_root,
282
287
  )
283
288
 
289
+ if not missing:
290
+ return
291
+
284
292
  for m in sorted(missing):
285
293
  print(m)
294
+ print()
286
295
 
287
296
 
288
297
  # ----------------------------
@@ -323,12 +332,22 @@ def main() -> int:
323
332
  if any(tok in hay for tok in c.tokens):
324
333
  references[c.rel].append(src_rel)
325
334
 
326
- unused_rels = [c.rel for c in candidates if not references[c.rel]]
327
- print_unused_grouped_by_ext(unused_rels)
335
+ unused_rows: list[tuple[str, List[str]]] = []
336
+ for c in candidates:
337
+ if not references[c.rel]:
338
+ unused_rows.append((c.rel, references[c.rel]))
339
+
340
+ # Group-by-extension presentation: sort by extension, then by name
341
+ unused_rows.sort(key=lambda item: (Path(item[0]).suffix.lower(), item[0].lower()))
342
+
343
+ print_group("UNUSED files (no filename/path tokens found)", unused_rows)
328
344
 
329
- # Second report: missing imports (only if entry is .py)
330
345
  if entry.suffix.lower() == ".py":
331
346
  run_missing_imports_report(entry=entry, project_root=root)
347
+ else:
348
+ print("MISSING (used but not installed):")
349
+ print("------------------------------")
350
+ print("(skipped: entry is not a .py file)\n")
332
351
 
333
352
  return 0
334
353
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maketool
3
- Version: 0.8.14
3
+ Version: 0.8.16
4
4
  Summary: Python Automation tool for building PySide6 UI and PyInstaller EXE.
5
5
  Author-email: Alan Lilly <panofish@gmail.com>
6
6
  Requires-Python: >=3.7
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "maketool"
3
- version = "0.8.14"
3
+ version = "0.8.16"
4
4
  description = "Python Automation tool for building PySide6 UI and PyInstaller EXE."
5
5
  authors = [{ name = "Alan Lilly", email = "panofish@gmail.com" }]
6
6
  readme = "README.md"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes