vhirtham / pythonTest

GNU General Public License v3.0
1 stars 1 forks source link

Documentation #1

Open vhirtham opened 4 years ago

vhirtham commented 4 years ago

GitHub Actions (CI)

Informations

Badge

Installation

jobs: test: name: CI Build runs-on: ${{ matrix.os }} strategy: matrix: os: [windows-latest] steps:

Travis CI

Informations

Badge

Installation

install:

script:

after_success:

Appveyor CI

Informations

Badge

Installation

install:

build: false

test_script:

Coverage / Codecov

Informations

Badge

Installation

script:

after_success:

coverage: precision: 2 round: down range: "70...100"

status:
    project:
        default:
            enabled: yes
            target: 85%
            threshold: 5%

    patch:
        default:
            enabled: yes
            target: 85%

ignore:

Typo CI

Information

Installation

Pep8Speaks

Information

Installation

vhirtham commented 4 years ago

Documentation with Sphinx

Autosummary

General

Remember this quote from Stackoverflow:

In each package, the init.py file can have .. automodule:: package.module components for each part of the package.

Then you can .. automodule:: package and it mostly does what you want.

Templates

someFile.rst:

API Documentation
=================

.. currentmodule:: MyPackages

.. autosummary::
   :template: autosummary/modules.rst
   :toctree: _autosummary

   MyFuncs

_templates/autosummary/modules.rst:

{{ fullname | escape | underline }}

.. rubric:: Description

.. automodule:: {{ fullname }}

.. currentmodule:: {{ fullname }}

{% if classes %}
.. rubric:: Classes

.. autosummary::
    :toctree: .
    {% for class in classes %}
    {{ class }}
    {% endfor %}

{% endif %}

{% if functions %}
.. rubric:: Functions

.. autosummary::
    :toctree: .
    {% for function in functions %}
    {{ function }}
    {% endfor %}

{% endif %}

Pitfalls

Doc-Strings

Doc-Strings need a clear line between description and parameters to be translated correctly. This

"""
Description
:param a: bla bla
"""

will produce Description:param a: bla bla as a description. The parameter a won't be documented at all. So add a blank line between the description and the parameter documentation:

"""
Description

:param a: bla bla
"""

Clean up

make clean html does not delete automatically generated .rst files by autosummary. So some indirect changes (for example on the template) might not be considered during the next build. Delete them manually to be sure.

Keep in mind:

Git warning when adding Makefile in docs directory:

warning: LF will be replaced by CRLF in docs/Makefile.
The file will have its original line endings in your working directory

Check Stackoverflow