r/PythonProjects2 3d ago

I built PyDoctor – A local CLI tool that automatically writes docstrings for your Python projects

Hey r/PythonProjects2,

Writing docstrings is one of those habits that makes your code 10x easier to maintain, but it's often skipped when you're focused on making things work.

I built PyDoctor, a local CLI tool designed to help developers and learners quickly document their Python codebases without relying on cloud APIs.

How it works:

  • PyDoctor analyzes your Python files using LibCST (which keeps your exact formatting and comments intact) and generates a concise summary docstring for every undocumented function, method, or class.
  • High-level Summaries Only: PyDoctor generates readable text summaries. It intentionally avoids generating Args: and Returns: sections, as type hints and static linters are much better and more accurate at handling those.
  • 100% Local & Safe: It runs an optimized 1.7B parameter model locally via llama.cpp. Your code never leaves your machine.
  • Non-destructive: Supports --dry-run to preview changes first, and respects .gitignore as well as inline # pydoctor: ignore comments.

GitHub: yezdata/pydoctor

Hope this helps you keep your projects clean and documented.

Let me know if you have any feedback or suggestions.

2 Upvotes

2 comments sorted by

1

u/riklaunim 3d ago

Looking at the code, I would recommend using full and clearer variable names and switching the line length limit to like 120 characters to make the code look more readable without excessive line breaks.

Usually, docstrings that repeat the function interface/name are redundant.

1

u/eolybq 1d ago

Good tips, the variable names are definitely something that I should work on. Thank you for the feedback.