Skip to content

Commit ff2cc56

Browse files
authored
Set up documentation building from docstrings (apify#33)
* Set up documentation building from docstrings * Update docs texts, rename formatting script * Add CI action for checking if docs can be built and are up to date * Rename Docs building Github workflow
1 parent 3a60d22 commit ff2cc56

34 files changed

+2625
-160
lines changed

.flake8

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ ignore=
1717
D409
1818
D413
1919
per-file-ignores =
20+
docs/*: D
2021
tests/*: D

.github/workflows/check_docs.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Check documentation status
2+
3+
on: push
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-20.04
8+
9+
steps:
10+
- uses: actions/checkout@v2
11+
12+
- name: Set up Python
13+
uses: actions/setup-python@v2
14+
with:
15+
python-version: 3.7
16+
17+
- name: Install dependencies
18+
run: |
19+
python -m pip install --upgrade pip
20+
pip install -e .[dev]
21+
22+
- name: Check docs building
23+
run: ./docs/res/check.sh

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,11 @@ We use `autopep8` and `isort` to automatically format the code to a common forma
4141
### Linting and Testing
4242

4343
We use `flake8` for linting, `mypy` for type checking and `pytest` for unit testing. To run these tools, just run `./lint_and_test.sh`.
44+
45+
### Documentation
46+
47+
We use the [Google docstring format](https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html) for documenting the code.
48+
We document every user-facing class or method, and enforce that using the flake8-docstrings library.
49+
50+
The documentation is then rendered from the docstrings in the code using Sphinx and some heavy post-processing and saved as `docs/docs.md`.
51+
To generate the documentation, just run `./build_docs.sh`.

build_docs.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env bash
2+
3+
# Sphinx is super chatty, let's discard the output if we're running it via this shortcut
4+
./docs/res/build.sh > /dev/null

0 commit comments

Comments
 (0)