-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from ryanharvey1/add-docs
Add autogenerated docs
- Loading branch information
Showing
12 changed files
with
513 additions
and
107 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,26 @@ | ||
name: Deploy docs | ||
on: [push, pull_request] | ||
jobs: | ||
build: | ||
name: Deploy docs | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Download source | ||
uses: actions/checkout@v3 | ||
- name: Install Crystal | ||
uses: oprypin/install-crystal@v1 | ||
- name: Install Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.x' | ||
- name: Install Python libs | ||
run: pip install . | ||
- name: Install Crystal libs | ||
run: | | ||
shards init | ||
shards install | ||
- name: Build site | ||
run: mkdocs build | ||
- name: Deploy to gh-pages | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | ||
run: mkdocs gh-deploy --force |
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 was deleted.
Oops, something went wrong.
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 @@ | ||
"""Generate the code reference pages.""" | ||
from pathlib import Path | ||
|
||
import mkdocs_gen_files | ||
|
||
|
||
nav = mkdocs_gen_files.Nav() | ||
mod_symbol = '' | ||
|
||
root = Path(__file__).parent.parent | ||
src = root | ||
|
||
for path in sorted(src.rglob("*.py")): | ||
if path.relative_to(src).parts[0] != "neuro_py": | ||
continue | ||
module_path = path.relative_to(src).with_suffix("") | ||
doc_path = path.relative_to(src).with_suffix(".md") | ||
full_doc_path = Path("reference", doc_path) | ||
|
||
parts = tuple(module_path.parts) | ||
|
||
if parts[-1] == "__init__": | ||
parts = parts[:-1] | ||
doc_path = doc_path.with_name("index.md") | ||
full_doc_path = full_doc_path.with_name("index.md") | ||
elif parts[-1] == "__main__": | ||
continue | ||
|
||
nav_parts = [f"{mod_symbol} {part}" for part in parts] | ||
print(nav_parts) | ||
nav[tuple(nav_parts)[-2:]] = doc_path.as_posix() | ||
|
||
with mkdocs_gen_files.open(full_doc_path, "w") as fd: | ||
identifier = ".".join(parts) | ||
print(f"---\ntitle: {identifier}\n---\n\n::: {identifier}", file=fd) | ||
|
||
mkdocs_gen_files.set_edit_path(full_doc_path, path.relative_to(root)) | ||
|
||
with mkdocs_gen_files.open("reference/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 @@ | ||
# neuro-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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
:root { | ||
--md-code-font: "Roboto Mono"; | ||
--md-default-fg-color: #111; | ||
--md-default-fg-color--light: #000000d0; | ||
--md-default-fg-color--lighter: #00000052; | ||
--md-default-fg-color--lightest: #00000012; | ||
--md-accent-fg-color: #38195A; | ||
--md-accent-fg-color--hover: #E4AF68; | ||
--md-accent-fg-color--transparent: #38195a1a; | ||
|
||
--md-default-bg-color: #fff; | ||
--md-default-bg-color--light: #ffffffb3; | ||
--md-default-bg-color--lighter: #ffffff4d; | ||
--md-default-bg-color--lightest: #ffffff1f; | ||
--md-accent-bg-color: #fff; | ||
--md-accent-bg-color--light: #ffffffb3; | ||
} | ||
|
||
[data-md-color-scheme="slate"] { | ||
--md-hue: 210; | ||
} | ||
|
||
/* Indentation for API Reference. */ | ||
.md-content div.doc-contents:not(.first) { | ||
padding-left: 25px; | ||
border-left: .05rem solid var(--md-typeset-table-color); | ||
} | ||
|
||
/* Gradient banner */ | ||
.md-header { | ||
background: linear-gradient(145deg, rgba(229,119,39,1) 3%, rgba(144,3,12,1) 31%, rgba(133,59,96,1) 51%, rgba(31,67,103,1) 79%, rgba(31,99,120,1) 94%, rgba(32,135,139,1) 100%); | ||
} | ||
|
||
.md-tabs { | ||
background: none; | ||
} |
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,73 @@ | ||
site_name: "neuro_py" | ||
repo_name: ryanharvey1/neuro_py | ||
repo_url: https://github.com/ryanharvey1/neuro_py | ||
edit_uri: edit/main/docs/ | ||
|
||
extra_css: | ||
- stylesheets/extra.css | ||
|
||
theme: | ||
name: "material" | ||
font: | ||
text: Roboto | ||
code: Roboto Mono | ||
palette: | ||
- media: "(prefers-color-scheme: dark)" | ||
toggle: | ||
icon: material/brightness-auto | ||
name: Switch to light mode | ||
- media: "(prefers-color-scheme: light)" | ||
scheme: light | ||
primary: custom | ||
accent: custom | ||
toggle: | ||
icon: material/weather-sunny | ||
name: Switch to dark mode | ||
- media: "(prefers-color-scheme: dark)" | ||
scheme: slate | ||
primary: indigo | ||
accent: blue | ||
toggle: | ||
icon: material/weather-night | ||
name: Switch to system preference | ||
features: | ||
- announce.dismiss | ||
- content.action.edit | ||
- content.action.view | ||
- content.code.annotate | ||
- content.code.copy | ||
- content.tooltips | ||
- content.tabs.link | ||
- navigation.footer | ||
- navigation.indexes | ||
- navigation.instant.prefetch | ||
- navigation.instant.preview | ||
- navigation.instant.progress | ||
- navigation.path | ||
- navigation.sections | ||
- navigation.tabs | ||
- navigation.tabs.sticky | ||
- navigation.top | ||
- navigation.tracking | ||
- search.highlight | ||
- search.suggest | ||
- toc.follow | ||
|
||
plugins: | ||
- search | ||
- gen-files: | ||
scripts: | ||
- docs/gen_ref_pages.py | ||
- literate-nav: | ||
nav_file: SUMMARY.md | ||
- section-index | ||
- mkdocstrings: | ||
handlers: | ||
python: | ||
options: | ||
docstring_style: numpy | ||
|
||
|
||
nav: | ||
- Home: index.md | ||
- API Reference: reference/ |
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
Oops, something went wrong.