Skip to content

Ending documentation

Questions

  • How can the user understand how to run your program and what it does?

Content

  • We will prepare for use of your code
  • Update the README
  • Update a Doc Index
  • Revisit licence
  • But also...
    • some theory of packages
    • some theory of workflows
    • some theory of containers
    • some info about Tutorials/Reference/HowTo guides
Learning objectives of 'Documentation'
  • learners can finalize the documentation of the project

Instructor notes

Prerequisites are:

  • ...

Lesson Plan: FIX

  • Total 30 min
  • Theory 20
  • Discussions 10 min

TOC

  • In-code documentation review
  • Documentation
    • tutorials/howto/reference
    • project doc
    • html site generators
    • deployment on servers
  • Hands-on
    • update README
    • installation procedure
    • update license
    • update citation
    • update index

README example

# Planets
## About

This program ...

## Installation

- This tool has been successfully tested in python-3.11.5

- Clone this repository

    git clone ...

- Install dependencies (``numpy`` and ``matplotlib``)


    pip install --user -r requirements

- run from code directory

    ./planet_main.py

Licensing

  • Protects creative expression
  • Automatically created
  • Derivative works usually inherit copyright of the thing derived
  • Time frame: essentially forever (lifetime + X years)

When can you use? - When there is a license saying you can - Limited other cases (private use, fair use: context dependent) - In practice: people do many things, but then can't share their output if license does not allow it or is not clarified

A little more about licensing

  • Copyleft is the legal technique of granting certain freedoms over copies of copyrighted works with the requirement that the same rights be preserved in derivative works.

  • Custom/closed/proprietary

    • Derivative work typically not possible
    • Unusual in academics
  • Permissive (MIT, BSD, Apache)
  • Derivative work does not have to be shared
  • Weak copyleft share-alike (LGPL, MPL)
  • Derivative work is free software but is limited to the component
  • Strong copyleft share-alike (GPL, AGPL)
  • Derivative work is free software and derivative work extends to the combined project

Read more

Software Citation

  • Think the same as for a scientific paper
  • Software citation

  • Citation bullets

    • Creator
    • Title
    • Publication venue
    • Date
    • Version
    • Type

In-code documentation

  • Comments, function docstrings, ...
  • Advantages
    • Good for programmers
    • Version controlled alongside code
    • Can be used to auto-generate documentation for functions/classes
  • Disadvantage
    • Probably not enough for users

Documentation outside code

  • Documentation comes in different forms - what is documentation?
    • Tutorials: learning-oriented, allows the newcomer to get started
    • How-to guides: goal-oriented, shows how to solve a specific problem
    • Explanation: understanding-oriented, explains a concept
    • Reference: information-oriented, describes the machinery
  • Not to forget
    • Project documentation:
      • requirements: what is the goal of the software, risks, platforms
      • the analysis/design: pseudocode and UML
      • risk analysis

HTML static site generators

There are many tools that can turn RST or Markdown into beautiful HTML pages:

There are many more ...

Deployment on servers

GitHub, GitLab, and Bitbucket make it possible to serve HTML pages:

GitHub pages

  • Easiest. Everything is local to GitHub
  • This lesson material

Read the Docs

  • Somewhat more possibilities, like having several versions of documentation to switch between.

Wikis

(Optional) Last hands on your documentation

Git/GitHub Repo

  • README.md
    • with citation info
  • License
  • Figures
    • figure outputs
  • Src
    • License (here or in the 1st level)
    • Requirements.txt
    • python files
  • Doc
    • index
    • planning documents
(Optional) Update your documentation
  • You can now work in GitHub directly
  • Do git push first from local command-line!
  • Revisit your README and update it with info after all our commits
    • About
    • Installation
  • Users should be able to install the required python packages with: pip install -r requirements.txt (depending on system --user may be added)
  • Citing
  • License
  • Lastly, you may, if time allows, update the doc/index.md file that should describe the content
  • Do a git pull to have the same version of your project repo locally!

Parts to be covered!

  • ☑ Source/version control
    • Git
    • We have a starting point!
    • GitHub as remote backup
    • Branches
  • ☑ Planning
    • ☑ Analysis
    • ☑ Design
  • ☑ Testing
    • Different levels
  • ☑ Collaboration
    • GitHub
    • pull requests
  • ☑ Sharing
    • ☑ open science
    • ☑ citation
    • ☑ licensing
    • ☑ deploying
  • ☑ Documentation
    • ☑ in-code documentation
    • ☑ finish documentation