docathon: how to write (good) documentation

20
Docathon How to write (good) documentation

Upload: nelle-varoquaux

Post on 20-Mar-2017

153 views

Category:

Presentations & Public Speaking


3 download

TRANSCRIPT

Page 1: Docathon: How to write (good) documentation

DocathonHow to write (good) documentation

Page 2: Docathon: How to write (good) documentation

Thanks to our sponsors!

Page 3: Docathon: How to write (good) documentation

Why documentation?

“Documentation is important because it's one of the first connections

between the human world and the machine world. It helps us effectively

translate our concepts and ideas into the languages that we use to control

machines. “

Page 4: Docathon: How to write (good) documentation

Why documentation?● For you you will be using your code in 6 months.

● For users you want people to use your code

○ Shows your project exists.

○ Shows how to install it.

○ Shows how to use it.

● For contributors you want people to help out

○ You only have contributors once you have users.

○ Documentation provides a platform for your first contributions.

Page 5: Docathon: How to write (good) documentation

Different types of documentation● Literal documentation

○ Installation instructions

○ User documentation

○ Contributor documentation

● API documentation

○ What does a function do?

○ How do I use it? What are the arguments I need to provide? What are the default values?

● Examples and galleries

○ How can I put all the pieces together to form a script or a program?

● Tutorials/Guides

○ Use the tools in a package to cover topics in a particular field.

● FAQ/stackoverflow

Page 6: Docathon: How to write (good) documentation

Different formats of documentation● HTML documentation

○ Website usually with literal, API and gallery/examples documentation

○ Stack overflow

● PDF documentation

○ Equivalent of website, but downloadable.

○ Usually doesn’t include the API

● Interactive documentation

○ Python

■ >>> help(my_function)

○ R

■ > help(limma)

■ > ?limma

Page 7: Docathon: How to write (good) documentation

What type of documentation do people use?

Page 8: Docathon: How to write (good) documentation

What format of documentation do people use?

Page 9: Docathon: How to write (good) documentation

Which type of documentation is most often neglected?

Page 11: Docathon: How to write (good) documentation

Key elements to think about when writing documentation

Rule n°1: Documentation is like code : it needs to be maintained

● Favor quality over quantity

● All examples in the documentation should run automatically.

Page 12: Docathon: How to write (good) documentation

Key elements to think about when writing documentation

Rule n°2: “If it is not documented, it does not exist”

● Write documentation as you write code.

● Documentation driven development.

Page 13: Docathon: How to write (good) documentation

Key elements to think about when writing documentation

Rule n°3: Documentation is about communication

● Who is your audience?

● How to organize your ideas?

● Visual communication…

Page 14: Docathon: How to write (good) documentation

Documentation in practiceTools, guidelines and next steps for improving documentation

Page 15: Docathon: How to write (good) documentation

Tools for documentation● Literal documentation

○ Python

■ Sphinx

■ Doctest

○ R

■ Knitr & LaTeX (pdf)

■ Knitr & R-markdown (html & pdf)

● API documentation

○ Python

■ Docstrings (numpydoc)

■ Doctest

○ R

■ Help files

■ roxygen

● Examples and galleries

○ Python

■ Sphinx-gallery

○ R

■ N/A

Page 16: Docathon: How to write (good) documentation

Project manager : Where to start?1. A README file with a brief description of the project & installation instructions

2. (A licence)

3. A short example/tutorial

4. API documentation

5. Link to code, issue tracker and mailing list if applicable

6. Literal documentation

7. Contributor documentation

Page 17: Docathon: How to write (good) documentation

New contributor : Where to start?1. Familiarize yourself with the project

○ Read the tutorial

○ Read the user documentation

○ Read the contributor documentation

○ Is anything unclear? Are there typos or english mistakes?

2. Improve docstrings

○ Of functions

○ Of Examples

3. Find tickets labeled “Documentation”

Page 18: Docathon: How to write (good) documentation

How to get users to contribute documentation?1. Think about your contribution workflow?

○ Can users install your package easily? Is the package publicly available?

○ Can users contribute easily?

2. Make sure users can get started

○ Write a brief tutorial

○ Write a couple of examples

3. Where are the pain points of your documentation?

○ Create documentation specific tickets and label them clearly as documentation-related.

4. Write a short “how to contribute” guide.

5. Don’t be too nitpicky about documentation patches!

○ Is the patch an improvement? Yes? Just push the green button.

Page 19: Docathon: How to write (good) documentation

Let’s get started!

Page 20: Docathon: How to write (good) documentation

The end…