Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: build documentation with make #178

Merged
merged 7 commits into from
May 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
"docs/adr/*/*",
"docs/conf.py",
"labels.toml",
"Makefile",
"pyproject.toml",
"pyrightconfig.json",
"pytest.ini",
Expand Down
14 changes: 6 additions & 8 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,20 @@ root = true

[*]
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[Makefile]
indent_style = tab
[*.ipynb]
indent_size = 1

[*.{py,toml}]
indent_size = 4

[*.{json,yaml,yml}]
indent_size = 2

[*.{rst,inc}]
indent_size = 2

# when adding words through vscode, this is the resulting output format
[.cspell.json]
indent_size = 4

[setup.cfg]
indent_size = 4
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: "/"
assignees:
- redeboer
labels:
- 🖱️ DX
schedule:
interval: monthly
2 changes: 1 addition & 1 deletion .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
needs: push
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
with:
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/ci-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,22 @@ jobs:
name: Build documentation and run notebooks
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: "3.8"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -c .constraints/py3.8.txt .[doc]
pip install -c .constraints/py3.8.txt .[doc] tox
sudo apt-get -y install graphviz pandoc
- name: Build documentation and run notebooks
working-directory: docs
env:
EXECUTE_NB: YES
GITHUB_REPO: ${{ github.event.pull_request.head.repo.full_name }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: make html
run: tox -e docnb
# cspell:ignore docnb
- name: Print error logs with color
if: ${{ failure() }}
# cspell:ignore printf
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
name: Style checks
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
- os: ubuntu-20.04 # coverage job
python-version: "3.7"
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/linkcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,23 @@ jobs:
name: Check external links
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: "3.8"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -c .constraints/py3.8.txt -e .[doc]
pip install -c .constraints/py3.8.txt -e .[doc] tox
sudo apt-get -y install graphviz pandoc
- name: Check external links
working-directory: docs
env:
REPO: ${{ github.event.pull_request.head.repo.full_name }}
GITHUB_REPO: ${{ github.event.pull_request.head.repo.full_name }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
BRANCH=main
if [[ "$GITHUB_HEAD_REF" != "" ]]; then
BRANCH=$GITHUB_HEAD_REF
fi
READTHEDOCS_VERSION=$BRANCH make ignore-warnings=1 linkcheck
READTHEDOCS_VERSION=$BRANCH tox -e linkcheck
6 changes: 3 additions & 3 deletions .github/workflows/requirements-cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
- "3.9"
- "3.10"
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: ComPWA/update-pip-constraints@main
with:
python-version: ${{ matrix.python-version }}
Expand All @@ -50,7 +50,7 @@ jobs:
if: needs.is-even-week.outputs.is-even-week != 0
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: ComPWA/update-pre-commit@main

push:
Expand All @@ -60,7 +60,7 @@ jobs:
- pip-constraints
- pre-commit
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
token: ${{ secrets.PAT }}
# GITHUB_TOKEN will not rerun checks after pushing to a PR branch
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/requirements-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
if: github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Determine dependency changes
Expand Down Expand Up @@ -42,7 +42,7 @@ jobs:
- "3.9"
- "3.10"
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: ComPWA/update-pip-constraints@main
with:
python-version: ${{ matrix.python-version }}
Expand All @@ -55,7 +55,7 @@ jobs:
needs.diff.outputs.diff != ''
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: ComPWA/update-pre-commit@main

push:
Expand All @@ -69,7 +69,7 @@ jobs:
- pip-constraints
- pre-commit
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
token: ${{ secrets.PAT }}
# GITHUB_TOKEN will not rerun checks after pushing to a PR branch
Expand Down
6 changes: 4 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/ComPWA/repo-maintenance
rev: 0.0.124
rev: 0.0.127
hooks:
- id: check-dev-files
args:
Expand Down Expand Up @@ -84,7 +84,9 @@ repos:
- id: editorconfig-checker
exclude: >
(?x)^(
.*\.py
.*\.md|
.*\.py|
LICENSE
)$

- repo: https://github.com/pycqa/isort
Expand Down
25 changes: 0 additions & 25 deletions docs/Makefile

This file was deleted.

4 changes: 2 additions & 2 deletions docs/_templates/module.rst_t
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

.. code-block:: python

import {{ basename }}
import {{ basename }}

{% endif -%}
.. automodule:: {{ qualname }}
{%- for option in automodule_options %}
:{{ option }}:
:{{ option }}:
{%- endfor %}
6 changes: 3 additions & 3 deletions docs/_templates/package.rst_t
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
{%- macro automodule(modname, options) -%}
.. automodule:: {{ modname }}
{%- for option in options %}
:{{ option }}:
:{{ option }}:
{%- endfor %}
{%- endmacro %}

{%- macro toctree(docnames) -%}
.. toctree::
{% for docname in docnames %}
{{ docname }}
{{ docname }}
{%- endfor %}
{%- endmacro %}

{{ pkgname.split(".")[-1] | e | heading }}

.. code-block:: python

import {{ pkgname }}
import {{ pkgname }}

{%- if modulefirst and not is_namespace %}
{{ automodule(pkgname, automodule_options) }}
Expand Down
4 changes: 2 additions & 2 deletions docs/_templates/toc.rst_t
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{ header | heading }}

.. toctree::
:maxdepth: {{ maxdepth }}
:maxdepth: {{ maxdepth }}
{% for docname in docnames %}
{{ docname }}
{{ docname }}
{%- endfor %}
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ def get_version(package_name: str) -> str:
nb_execution_mode = "off"
if "EXECUTE_NB" in os.environ:
print("\033[93;1mWill run Jupyter notebooks!\033[0m")
nb_execution_mode = "force"
nb_execution_mode = "cache"

# Settings for myst-parser
myst_enable_extensions = [
Expand Down
28 changes: 14 additions & 14 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@ source = src

[pytest]
addopts =
--color=yes
--doctest-continue-on-failure
--doctest-modules
--durations=3
--ignore=docs/abbreviate_signature.py
--ignore=docs/conf.py
--color=yes
--doctest-continue-on-failure
--doctest-modules
--durations=3
--ignore=docs/abbreviate_signature.py
--ignore=docs/conf.py
filterwarnings =
error
ignore:Passing a schema to Validator.iter_errors is deprecated.*:DeprecationWarning
ignore:unclosed .*:ResourceWarning
error
ignore:Passing a schema to Validator.iter_errors is deprecated.*:DeprecationWarning
ignore:unclosed .*:ResourceWarning
norecursedirs =
_build
_build
markers =
slow: marks tests as slow (deselect with '-m "not slow"')
slow: marks tests as slow (deselect with '-m "not slow"')
testpaths =
docs
src
tests
docs
src
tests
Loading