-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Backport documentation generation to v0.10.x (#35)
See #25 for details. - ci/labeler: Add missing noxfile.py - Use MkDocs to build the documentation - Move copyright and license as code comments - docs: Add missing file format to examples - docs: Add some useful cross-references. - docs: Indent examples - Use forward type annotations - docs: Indent "Returns:" properly - docs: Improve formatting of some symbols - docs: Make some minor improvements - docs: Add site version via mike - ci: Remove unnecessary checkout of submodules - ci: Build and publish documentation - Run normal linting on noxfile.py - Run mypy on noxfile.py and be more restrictive - ci: Add contents permission to publish-docs
- Loading branch information
Showing
36 changed files
with
732 additions
and
368 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
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 |
---|---|---|
|
@@ -127,3 +127,7 @@ dmypy.json | |
|
||
# Pyre type checker | ||
.pyre/ | ||
|
||
# Automatically generated documentation | ||
docs/reference/ | ||
site/ |
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,44 @@ | ||
/* Recommended style from: | ||
* https://mkdocstrings.github.io/python/customization/#recommended-style-material | ||
* With some additions from: | ||
* https://github.com/mkdocstrings/mkdocstrings/blob/master/docs/css/mkdocstrings.css | ||
*/ | ||
|
||
/* Indentation. */ | ||
div.doc-contents:not(.first) { | ||
padding-left: 25px; | ||
border-left: .05rem solid var(--md-typeset-table-color); | ||
} | ||
|
||
/* Indentation. */ | ||
div.doc-contents:not(.first) { | ||
padding-left: 25px; | ||
border-left: 4px solid rgba(230, 230, 230); | ||
margin-bottom: 80px; | ||
} | ||
|
||
/* Avoid breaking parameters name, etc. in table cells. */ | ||
td code { | ||
word-break: normal !important; | ||
} | ||
|
||
/* Mark external links as such. */ | ||
a.autorefs-external::after { | ||
/* https://primer.style/octicons/arrow-up-right-24 */ | ||
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="rgb(0, 0, 0)" d="M18.25 15.5a.75.75 0 00.75-.75v-9a.75.75 0 00-.75-.75h-9a.75.75 0 000 1.5h7.19L6.22 16.72a.75.75 0 101.06 1.06L17.5 7.56v7.19c0 .414.336.75.75.75z"></path></svg>'); | ||
content: ' '; | ||
|
||
display: inline-block; | ||
position: relative; | ||
top: 0.1em; | ||
margin-left: 0.2em; | ||
margin-right: 0.1em; | ||
|
||
height: 1em; | ||
width: 1em; | ||
border-radius: 100%; | ||
background-color: var(--md-typeset-a-color); | ||
} | ||
a.autorefs-external:hover::after { | ||
background-color: var(--md-accent-fg-color); | ||
} |
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,28 @@ | ||
/* Based on: | ||
* https://github.com/mkdocstrings/mkdocstrings/blob/master/docs/css/style.css | ||
*/ | ||
|
||
/* Increase logo size */ | ||
.md-header__button.md-logo { | ||
padding-bottom: 0.2rem; | ||
padding-right: 0; | ||
} | ||
.md-header__button.md-logo img { | ||
height: 1.5rem; | ||
} | ||
|
||
/* Mark external links as such (also in nav) */ | ||
a.external:hover::after, a.md-nav__link[href^="https:"]:hover::after { | ||
/* https://primer.style/octicons/link-external-16 */ | ||
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="rgb(233, 235, 252)" d="M10.604 1h4.146a.25.25 0 01.25.25v4.146a.25.25 0 01-.427.177L13.03 4.03 9.28 7.78a.75.75 0 01-1.06-1.06l3.75-3.75-1.543-1.543A.25.25 0 0110.604 1zM3.75 2A1.75 1.75 0 002 3.75v8.5c0 .966.784 1.75 1.75 1.75h8.5A1.75 1.75 0 0014 12.25v-3.5a.75.75 0 00-1.5 0v3.5a.25.25 0 01-.25.25h-8.5a.25.25 0 01-.25-.25v-8.5a.25.25 0 01.25-.25h3.5a.75.75 0 000-1.5h-3.5z"></path></svg>'); | ||
height: 0.8em; | ||
width: 0.8em; | ||
margin-left: 0.2em; | ||
content: ' '; | ||
display: inline-block; | ||
} | ||
|
||
/* More space at the bottom of the page */ | ||
.md-main__inner { | ||
margin-bottom: 1.5rem; | ||
} |
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,5 @@ | ||
# Home | ||
|
||
Welcome to Frequenz's channels implementation for Python. | ||
|
||
This website is still under heavy construction. Most information can be found in the [Reference](reference/frequenz/channels) section. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,40 @@ | ||
# License: MIT | ||
# Copyright © 2022 Frequenz Energy-as-a-Service GmbH | ||
|
||
"""Generate the code reference pages. | ||
Based on the recipe at: | ||
https://mkdocstrings.github.io/recipes/#automatic-code-reference-pages | ||
""" | ||
|
||
from pathlib import Path | ||
|
||
import mkdocs_gen_files | ||
|
||
SRC_PATH = "src" | ||
DST_PATH = "reference" | ||
|
||
# type ignore because mkdocs_gen_files uses a very weird module-level | ||
# __getattr__() which messes up the type system | ||
nav = mkdocs_gen_files.Nav() # type: ignore | ||
|
||
for path in sorted(Path(SRC_PATH).rglob("*.py")): | ||
module_path = path.relative_to(SRC_PATH).with_suffix("") | ||
|
||
doc_path = path.relative_to(SRC_PATH).with_suffix(".md") | ||
full_doc_path = Path(DST_PATH, doc_path) | ||
parts = tuple(module_path.parts) | ||
if parts[-1] == "__init__": | ||
doc_path = doc_path.with_name("index.md") | ||
full_doc_path = full_doc_path.with_name("index.md") | ||
parts = parts[:-1] | ||
|
||
nav[parts] = doc_path.as_posix() | ||
|
||
with mkdocs_gen_files.open(full_doc_path, "w") as fd: | ||
fd.write(f"::: {'.'.join(parts)}\n") | ||
|
||
mkdocs_gen_files.set_edit_path(full_doc_path, Path("..") / path) | ||
|
||
with mkdocs_gen_files.open(Path(DST_PATH) / "SUMMARY.md", "w") as nav_file: | ||
nav_file.writelines(nav.build_literate_nav()) |
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,8 @@ | ||
{% extends "base.html" %} | ||
|
||
{% block outdated %} | ||
You're not viewing the latest (stable) version. | ||
<a href="{{ '../' ~ base_url }}"> | ||
<strong>Click here to go to latest (stable) version</strong> | ||
</a> | ||
{% endblock %} |
Oops, something went wrong.