Open vhirtham opened 4 years ago
conf.py
needs the following lines:
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.autosummary'
]
autosummary_generate = True
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.
:template:
key to select the template you want to usesomeFile.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 %}
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
"""
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.
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
GitHub Actions (CI)
Informations
run:
of ajob:
forgets all previously set environmental variables.yml
filesBadge
https://github.com/<OWNER>/<REPOSITORY>/workflows/<WORKFLOW_NAME>/badge.svg
<WORKFLOW_NAME>
must be replaced by%20
Installation
.github/workflows
directory to the projects root directory.yml
for each individual workflow.yml
. Example:jobs: test: name: CI Build runs-on: ${{ matrix.os }} strategy: matrix: os: [windows-latest] steps:
Travis CI
Informations
sudo apt-get install
etc.Badge
README.md
Installation
.travis.yml
in the project root directory.travis.yml
as needed. Example:install:
sudo apt-get update
We do this conditionally because it saves us some downloading if the
version is the same.
if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" ]]; then wget https://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh -O miniconda.sh; else wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh; fi
bash miniconda.sh -b -p $HOME/miniconda
source "$HOME/miniconda/etc/profile.d/conda.sh"
hash -r
conda config --set always_yes yes --set changeps1 no
conda update -q conda
conda info -a
conda create -q -n test-environment python=$TRAVIS_PYTHON_VERSION pytest pytest-cov codecov
conda activate test-environment
script:
after_success:
Appveyor CI
Informations
Badge
README.md
Installation
.appveyor.yml
in the project root directory.appveyor.yml
as needed. Example:install:
build: false
test_script:
Coverage / Codecov
Informations
pytest-cov
documentationBadge
README.md
Installation
.travis.yml
:script:
after_success:
coverage: precision: 2 round: down range: "70...100"
ignore:
Typo CI
Information
Installation
.typo-ci.yml
and configure it (see documentation)Pep8Speaks
Information
pycodestyle
orflake8
as linter@pep8speaks suggest diff
to get a gist with suggested fixes@pep8speaks pep8ify
to get an automatically generated pull request against the current branch that fixes most of thePEP8
errorsInstallation
.pep8speaks.yml
and configure itpycodestyle
orflake8
insetup.cfg
to configure them