Sto programmando una nuova libreria Python, che richiede una buona documentazione. Quali sono i buoni modi per documentare una tale libreria? Preferirei un metodo che genera una documentazione completa in html.Come documentare un progetto Python?
6
A
risposta
10
L'utilizzo di docstrings ovunque è il primo passo. Quindi è possibile utilizzare uno qualsiasi degli strumenti di generazione di documentazione Python per generare documentazione di qualità. È ciò che python.org fa, usando Sphinx.
Ma usando docstring ha anche il vantaggio aggiuntivo di essere utile per i programmatori proprio nel interprete così:
>>> help(dir)
Help on built-in function dir in module __builtin__:
dir(...)
dir([object]) -> list of strings
If called without an argument, return the names in the current scope.
Else, return an alphabetized list of names comprising (some of) the attributes
of the given object, and of attributes reachable from it.
If the object supplies a method named __dir__, it will be used; otherwise
the default dir() logic is used and returns:
for a module object: the module's attributes.
for a class object: its attributes, and recursively the attributes
of its bases.
for any other object: its attributes, its class's attributes, and
recursively the attributes of its class's base classes.
Tutto questo deriva dal docstring della funzione built-dir()
, e diventa piuttosto-stampato bene tramite la funzione integrata help()
.
Problemi correlati
- 1. Come documentare un makefile?
- 2. Come documentare un database
- 3. Come documentare un metodo con i parametri?
- 4. Come organizzare un progetto Python?
- 5. Come posso documentare AMD progetto + Backbone con JSDoc3
- 6. Come documentare un tipo di anatra?
- 7. Come documentare gli attributi di classe in Python?
- 8. Come documentare un array di [tipo]?
- 9. Come documentare un dizionario in JSDoc?
- 10. Come documentare il codice Python: Epydoc, doxygen, Sfinge, ...?
- 11. Come documentare i parametri della funzione Python con sphinx-apidoc
- 12. Come documentare l'argomento che richiede più tipi
- 13. Come documentare la funzione fortran per f2py?
- 14. Come documentare la programmazione procedurale?
- 15. Come documentare un'applicazione di rotaia?
- 16. Come documentare una C# dll
- 17. Come documentare un'eccezione usando Sfinge
- 18. Come documentare il codice Ruby?
- 19. Come documentare un parametro "oggetto" di un metodo
- 20. Come documentare un metodo che sovrascrive un altro metodo?
- 21. Come documentare il reso in JavaScript
- 22. Utilizzo della sfinge per auto-documentare una classe python, modulo
- 23. Quali sono i modi buoni e cattivi per documentare un progetto software?
- 24. Documentare un concetto C++ usando doxygen?
- 25. Sfinge: modo corretto per documentare un enum?
- 26. Documentare un costruttore privato con JSDoc
- 27. Documentare F # Codice
- 28. Come documentare un generatore di funzioni con jsdoc?
- 29. Come documentare un parametro che si aspetta una costante
- 30. Come posso documentare un doppio array di stringhe in JSDoc?
La documentazione HTML autogenerata è la cosa peggiore che sia mai accaduta nella documentazione, conducendo invariabilmente a tali aborti come [questo] (http://www.alsa-project.org/alsa-doc/alsa-lib/). –
Documentazione HTML autogenerata male> nessuna documentazione –
Penso che sia possibile generare una documentazione HTML utile. E non voglio qualcosa come la documentazione ALSA, piuttosto che qualcosa come la documentazione [Sphinx] (http://sphinx.pocoo.org/contents.html). – svenwltr