Skip to content

Commit bbc094a

Browse files
authored
Merge pull request #44 from lincc-frameworks/awo-fix-pre-commit
2 parents 5c42501 + 5f519b1 commit bbc094a

File tree

14 files changed

+36
-218
lines changed

14 files changed

+36
-218
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
- name: Build docs
5353
run: |
5454
cd ../test/${{ matrix.foldername }}
55-
sphinx-build -b html docs/source docs/build/html
55+
sphinx-build -T -E -b html -d docs/build/doctrees ./docs docs/build/html
5656
- name: Tests
5757
run: |
5858
cd ../test/${{ matrix.foldername }}

python-project-template/.pre-commit-config.yaml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,19 @@ repos:
4343
rev: 5.12.0
4444
hooks:
4545
- id: isort
46-
name: isort (python)
46+
name: isort (python files in src/ and tests/)
4747
description: Sort and organize imports in .py files.
48+
types: [python]
49+
files: ^(src|tests)/
4850

4951
- repo: local
5052
hooks:
5153
- id: pylint
52-
name: pylint
54+
name: pylint (python files in src/ and tests/)
5355
entry: pylint
5456
language: system
5557
types: [python]
58+
files: ^(src|tests)/
5659
args:
5760
[
5861
"-rn", # Only display messages
@@ -66,10 +69,15 @@ repos:
6669
entry: sphinx-build
6770
language: system
6871
always_run: true
72+
exclude_types: [file, symlink]
6973
args:
7074
[
75+
"-T", # Show full trace back on exception
76+
"-E", # Don't use saved env. always read all files.
7177
"-b", # Flag to select which builder to use
7278
"html", # Use the HTML builder
73-
"docs/source", # Source directory of documents
79+
"-d", # Flag for cached environment and doctrees
80+
"docs/build/doctrees", # directory
81+
"./docs", # Source directory of documents
7482
"docs/build/html", # Output directory for rendered documents.
7583
]

python-project-template/.readthedocs.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,6 @@ sphinx:
1717
# Optionally declare the Python requirements required to build your docs
1818
python:
1919
install:
20-
- requirements: docs/requirements.txt
20+
- requirements: docs/requirements.txt
21+
- method: pip
22+
path: .

python-project-template/docs/Makefile

Lines changed: 0 additions & 22 deletions
This file was deleted.

python-project-template/docs/source/conf.py.jinja renamed to python-project-template/docs/conf.py.jinja

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@
44
# https://www.sphinx-doc.org/en/master/usage/configuration.html
55

66

7-
import sys
87
import os
8+
import sys
9+
10+
import autoapi
911

12+
# Define path to the code to be documented **relative to where conf.py (this file) is kept**
1013
sys.path.insert(0, os.path.abspath('../src/'))
1114

1215
# -- Project information -----------------------------------------------------
@@ -21,31 +24,29 @@ release = 'v0.1'
2124
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
2225

2326
extensions = [
24-
'sphinx.ext.autodoc',
25-
'sphinx.ext.autosummary',
2627
'sphinx.ext.mathjax',
2728
'sphinx.ext.napoleon',
2829
'sphinx.ext.viewcode']
2930

30-
templates_path = ['_templates']
31+
extensions.append('autoapi.extension')
32+
33+
templates_path = []
3134
exclude_patterns = []
3235

33-
master_doc = 'index'
34-
autodoc_member_order = "bysource"
35-
autosummary_generate = True # Turn on sphinx.ext.autosummary
36-
autoclass_content = "both" # Add __init__ doc (ie. params) to class summaries
36+
master_doc = 'index' # This assumes that sphinx-build is called from the root directory
3737
html_show_sourcelink = False # Remove 'view source code' from top of page (for html, not python)
38-
autodoc_inherit_docstrings = True # If no docstring, inherit from base class
3938
add_module_names = False # Remove namespaces from class/method signatures
4039

40+
autoapi_type = 'python'
41+
autoapi_dirs = ['../src']
42+
autoapi_add_toc_tree_entry = False
43+
autoapi_member_order = 'bysource'
4144

4245
# -- Options for HTML output -------------------------------------------------
4346
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
4447

4548
html_theme = 'alabaster'
46-
html_static_path = ['_static']
47-
48-
html_sidebars = { '**': ['globaltoc.html', 'relations.html', 'searchbox.html'], }
49+
html_sidebars = { '**': ['globaltoc.html', 'relations.html', 'searchbox.html'], }
4950

5051

5152
# Readthedocs theme

python-project-template/docs/source/index.rst.jinja renamed to python-project-template/docs/index.rst.jinja

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
contain the root `toctree` directive.
55

66
Welcome to {{module_name}}'s documentation!
7-
===================================
7+
========================================================================================
88

99
.. toctree::
1010
:hidden:
1111

1212
Home page <self>
13-
API reference <_autosummary/{{module_name}}>
13+
API Reference <autoapi/index>

python-project-template/docs/make.bat

Lines changed: 0 additions & 35 deletions
This file was deleted.
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
sphinx==5.3.0
2-
sphinx_rtd_theme==1.1.1
1+
sphinx==6.1.3
2+
sphinx_rtd_theme==1.2.0
3+
sphinx-autoapi==2.0.1

python-project-template/docs/source/_static/.gitignore

Whitespace-only changes.

python-project-template/docs/source/_templates/custom-class-template.rst

Lines changed: 0 additions & 34 deletions
This file was deleted.

0 commit comments

Comments
 (0)