-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
169 additions
and
61 deletions.
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,32 @@ | ||
name: deploy | ||
|
||
on: | ||
push: | ||
branches: ["a"] | ||
pull_request: | ||
branches: ["a"] | ||
|
||
permissions: | ||
pages: write | ||
id-token: write | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/configure-pages@v4 | ||
|
||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.13 | ||
|
||
- name: Generate | ||
run: bt documentation | ||
|
||
- uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: .web | ||
|
||
- uses: actions/deploy-pages@v4 |
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
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,47 @@ | ||
import inspect | ||
import os | ||
import re | ||
import sphinx | ||
import sys | ||
import textwrap | ||
from sphinx import application | ||
from sphinx.ext.autodoc import Documenter, FunctionDocumenter, ModuleDocumenter | ||
from typing import TypeAliasType as TypeAlias | ||
|
||
project = "bt" | ||
extensions = ["sphinx.ext.autodoc"] | ||
html_theme = "furo" | ||
html_static_path = ["."] | ||
html_css_files = ["style.css"] | ||
autodoc_default_options = { | ||
"members": True, | ||
"special-members": True | ||
} | ||
|
||
codeBlock = re.compile(r"```(\w+)\s*?\n([\s\S]*?)(```|$)") | ||
inlineCode = re.compile(r"(`[^`]*?`)(\w*)") | ||
|
||
class BtDocumenter(ModuleDocumenter): | ||
def sort_members(this, members: list[tuple[Documenter, bool]], order: str) -> list[tuple[Documenter, bool]]: | ||
super().sort_members(members, order) | ||
members.sort(key = lambda m: {"data": 0, "class": 2, "function": 4}[m[0].objtype] + m[0].name[m[0].name.rindex(":") + 1].isupper()) | ||
return members | ||
|
||
def skip(app, scope, name, ob, skip, options): | ||
if name in options.get("exclude-members", []): return True | ||
if scope == "module" and not callable(ob) and "__doc__" in dir(ob): return False | ||
|
||
if scope == "class": | ||
try: return (skip or (name[0] == "_" and not callable(ob)) or not ob.__doc__ | ||
or not os.path.samefile(inspect.getsourcefile(ob), sys.modules["bt"].__file__)) | ||
except: return True | ||
|
||
def docstring(app, type, name, ob, options, lines): | ||
doc = "\n".join(lines) | ||
doc = codeBlock.sub(lambda m: f".. code-block:: {m[1]}\n\n" + textwrap.indent(m[2], " "), doc) | ||
lines[:] = inlineCode.sub(lambda m: m[1] + "\\" + m[2] if m[2] else m[0], doc).split("\n") | ||
|
||
def setup(app: application.Sphinx): | ||
app.add_autodocumenter(BtDocumenter, True) | ||
app.connect("autodoc-skip-member", skip) | ||
app.connect("autodoc-process-docstring", docstring) |
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,12 @@ | ||
This page lists the symbols that `bt` exports. | ||
If the build script is run by the executable, they are made accessible to the build script automatically. | ||
Mutable variables can be accessed through the module `bt`. | ||
|
||
If a name is not listed here, then it should be assumed to be internal. | ||
|
||
.. autodata:: bt::bt | ||
:no-value: | ||
|
||
.. automodule:: bt | ||
:members: | ||
:exclude-members: bt |
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,29 @@ | ||
html { | ||
--width: 80em; | ||
} | ||
|
||
.bottom-of-page, | ||
.sidebar-search-container { | ||
display: none | ||
} | ||
|
||
.sidebar-drawer { | ||
width: calc(50% - (var(--width) / 2)); | ||
} | ||
|
||
.content { | ||
width: calc(var(--width) - 6em); | ||
} | ||
|
||
.sig-prename { | ||
display: none; | ||
} | ||
|
||
cite { | ||
font-family: monospace; | ||
font-style: unset; | ||
} | ||
|
||
body:not([data-theme=light]) { | ||
--color-highlight-on-target: #2c2e33 | ||
} |