-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
docs: Sphinx + ReadTheDocs #2710
Open
LecrisUT
wants to merge
5
commits into
catchorg:devel
Choose a base branch
from
LecrisUT:docs/sphinx
base: devel
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+140
−3
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
version: 2 | ||
|
||
python: | ||
install: | ||
- path: docs | ||
extra_requirements: | ||
- docs | ||
build: | ||
os: ubuntu-22.04 | ||
apt_packages: | ||
- doxygen | ||
- graphviz | ||
tools: | ||
python: "3.11" | ||
sphinx: | ||
configuration: docs/conf.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
### Python template | ||
build/ | ||
eggs/ | ||
.eggs/ | ||
*.egg-info/ | ||
*.egg | ||
|
||
# Sphinx documentation | ||
_build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import os | ||
import subprocess | ||
|
||
from sphinx.application import Sphinx | ||
from pathlib import Path | ||
|
||
project = 'Catch2' | ||
copyright = '2023, Martin Hořeňovský' | ||
author = 'Martin Hořeňovský' | ||
|
||
extensions = [ | ||
"myst_parser", | ||
"sphinx_design", | ||
"sphinx_togglebutton", | ||
"breathe", | ||
] | ||
|
||
templates_path = [] | ||
exclude_patterns = [ | ||
'build', | ||
'_build', | ||
'Thumbs.db', | ||
'.DS_Store', | ||
"Readme.md", | ||
] | ||
source_suffix = [".md"] | ||
|
||
html_theme = 'furo' | ||
# html_static_path = ['_static'] | ||
|
||
myst_enable_extensions = [ | ||
"tasklist", | ||
"colon_fence", | ||
] | ||
|
||
breathe_projects = { | ||
"Catch2": "build/doxygen/xml", | ||
} | ||
breathe_default_project = "Catch2" | ||
|
||
|
||
def generate_doxygen_xml(app: Sphinx): | ||
""" | ||
Run the doxygen commands | ||
""" | ||
os.chdir(Path(app.confdir).parent) | ||
subprocess.run(["doxygen"]) | ||
|
||
|
||
def setup(app: Sphinx): | ||
# Add hook for building doxygen xml when needed | ||
app.connect("builder-inited", generate_doxygen_xml) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Developer's API | ||
|
||
This is a placeholder for all generated APIs. | ||
|
||
These should be organized using [doxygen groups](https://www.doxygen.nl/manual/grouping.html). | ||
|
||
## All APIs | ||
|
||
:::{doxygenindex} | ||
::: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Catch2 | ||
|
||
A modern, C++-native, test framework for unit-tests, TDD and BDD - using C++14, C++17 and later. | ||
|
||
:::{include} ../README.md | ||
--- | ||
start-after: <!-- SPHINX-START --> | ||
end-before: <!-- SPHINX-END --> | ||
--- | ||
::: | ||
|
||
## Contents | ||
|
||
:::{toctree} | ||
--- | ||
maxdepth: 2 | ||
titlesonly: true | ||
glob: true | ||
--- | ||
developer_api/index | ||
/* | ||
::: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
[build-system] | ||
requires = ["setuptools"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[project] | ||
name = "Catch2-dev" | ||
version = "0.0.0" | ||
description = "Development environment for Catch2" | ||
|
||
|
||
[project.optional-dependencies] | ||
docs = [ | ||
"sphinx >= 6.0", | ||
"furo", | ||
"sphinx-design", | ||
"sphinx-togglebutton", | ||
"myst-parser", | ||
"breathe", | ||
] | ||
dev = [ | ||
"pre-commit", | ||
] | ||
|
||
[tool.setuptools] | ||
packages = [] |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be awesome if we could add
doxygen
andgraphviz
to the readthedocs build environment:https://docs.readthedocs.io/en/stable/config-file/v2.html#build-apt-packages
Then we could include a command within the
conf.py
to build the source documentation as well. This can be included in its own section of the docs, perhaps named "API Reference".Note: Technically the readthedocs agents already include doxygen, but I think being explicit can't hurt!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I've added the doxygen. It is a mess now because it is all in one place instead of using groups or manually curating the api
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would appreciate a bit of help. Can you find a way to move the
doxygen
folder back to/docs/doxygen
and not have it loop recursively when runningsphinx-autobuild
? I have tried adding it toexclude_patterns
, but that did not do the trick.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can have a look, I have limited availability for a while, but can update you if I figure anything out