Skip to content

Commit 12fb179

Browse files
committed
Improve warnings
1 parent 8740f09 commit 12fb179

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

docs/gen_ref_pages.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@
2020
# Skip "venv" and other similarly named directories
2121
if path.name.startswith("venv") or path.name.startswith(".venv") or path.name.startswith(".") or "site-packages" in path.parts:
2222
continue
23+
2324
# Skip and print "cause"
2425
cause = None
26+
# Skip if read issue
2527
try:
2628
txt = path.read_text()
2729
except UnicodeDecodeError:
@@ -34,10 +36,16 @@
3436
if not line or line.startswith("#"):
3537
continue
3638
if not line.startswith(('"', "'")):
37-
print()
3839
cause = f"Warning: Skipping (due to missing docstring) {path.relative_to(root)}"
3940
break
41+
# namespace packages not unsupported.
42+
# Fix? https://github.com/mkdocstrings/mkdocstrings/discussions/563
43+
if path.name != "__init__.py":
44+
parent_has_init = (path.parent / "__init__.py").exists()
45+
if not parent_has_init:
46+
cause = f"Warning: Skipping namespace package file: {path.relative_to(root)}"
4047
if cause:
48+
print(cause)
4149
continue
4250

4351
parts = tuple(path.relative_to(src).with_suffix("").parts)

0 commit comments

Comments
 (0)