Skip to content

API Reference

docstr-health is organized into a small set of focused packages. This section is generated automatically from the source with mkdocstrings.

Package layout

docstr_health/
├── main.py          # CLI entry point
├── config.toml      # Default configuration
├── cli/             # Argument parsing and Rich rendering
├── checkers/        # Docstring / project analysis
├── core/            # Config, enums, exceptions, logging
├── models/          # AST-backed data models
└── sources/         # Local, Git and PyPI source providers

Modules

Section Covers
CLI Parser, runner, Rich output, progress bar
Checkers Docstring grading and project orchestration
Core Configuration, enums, exceptions, logging
Models PythonModule, PythonFunction, reports
Sources Local, Git, and PyPI providers

Entry point

main

main

main()

Entery point.

Source code in docstr_health/main.py
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
def main():
    """Entery point."""
    parser = get_parser()
    args = parser.parse_args()

    if args.project_path:
        args.project_path = args.project_path.resolve()
    if args.cache_dir:
        args.cache_dir = args.cache_dir.resolve()

    config.ensure_directories()
    settings = AppSettings.from_args(args)
    config.parameters["ci"] = settings.ci
    renderer = RichOutput(quiet=settings.ci)

    if settings.cache_dir:
        config.set_cache_dir(settings.cache_dir)

    logger.debug(config.get_cache_dir())

    source = get_repository_source(settings, args)

    project_checker = ProjectChecker(source=source, settings=settings)

    run_check(project_checker)

    statuses = project_checker.get_statuses_stat()
    project_report = project_checker.get_project_report()

    ci_checker = CiFailureChecker(project_report=project_report)
    ci_checker.assertion()

    general_stat_data = project_checker.get_quantity_of_func_type()
    if args.doc_modules:
        general_stat_data["modules"] = project_checker.get_count_modules()
    general_stat_data["total"] = sum(general_stat_data.values())

    tables_to_display = []

    tables_to_display.append(
        renderer.get_table(
            title="General statistics",
            headers=["Metric", "Value", "Rate"],
            data=general_stat_data,
            sorting_reference=config.get_sorted_general_stat(),
            last_line_separator=True,
        )
    )
    tables_to_display.append(
        renderer.get_table(
            title="Number of modules each status",
            headers=["Module status", "Quantity", "Rate"],
            data=statuses,
            sorting_reference=config.get_sorted_statuses(),
        )
    )

    skipped = {p.name: e for p, e in project_checker.skipped_modules}
    if skipped:
        tables_to_display.append(
            renderer.get_table(
                title="Skipped modules",
                headers=["Module", "Error", "Rate"],
                data=skipped,
            )
        )

    renderer.display_summary(tables_to_display)

    renderer.display_project_report(project_report=project_report)

    if settings.no_cache:
        source.cleanup()

    return 0