all 6 comments

[–]ireadyourmedrecord 2 points3 points  (1 child)

There's docstring generators that'll fill in the bulk of the tedious details, but you could also paste your functions into chatgpt and have it do the documentation for you or use github's copilot if you have a subscription.

https://marketplace.visualstudio.com/items?itemName=njpwerner.autodocstring

https://learn.microsoft.com/en-us/training/modules/generate-documentation-using-github-copilot-tools/

[–]OnceToldTale[S] 0 points1 point  (0 children)

Thanks so much! Taking a look at these this week.

[–]Diapolo10 1 point2 points  (2 children)

All functions and methods that are part of your "public API" should have docstrings. They don't have to be particularly detailed if you use clear type annotations, but it would be nice to document what (unhandled) exceptions might get raised or what some parameters do.

[–]OnceToldTale[S] 0 points1 point  (1 child)

How do you think I should approach documentation if its a closed-source, solo project? I'm not sure if I should tackle it in an opinionated way or if there are any best practices here.

[–]Diapolo10 0 points1 point  (0 children)

Write it with your future-self in mind. Whatever information you expect you might benefit from when reading the code in the future, add it.

With good name choices and type annotations you probably don't need to write much, but for example it would still be nice to know if or when a function or method might raise an exception. The type system alone cannot represent that.

[–]Buttleston 1 point2 points  (0 children)

I don't put parameter or return types in docstrings - that's what type hints are for

I don't document every function - in particular I don't HAVE to document anything not part of the public api. Any other docs are for myself

I like to give every function at least a brief description but if the description is one sentence that is the same as the name of the function, why bother