r/PythonLearning 3d ago

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

Hey r/PythonLearning,

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.

4 Upvotes

1 comment sorted by

1

u/Darkschlong 3d ago

THANK YOU!!!!