Skip to content

Commit

Permalink
wip: add rough autogenerated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kushaangupta committed Sep 14, 2024
1 parent 7626b50 commit b387ee7
Show file tree
Hide file tree
Showing 7 changed files with 113 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Analysis of neuroelectrophysiology data in Python.

Overview
========
neuro_py is a Python package for analysis of neuroelectrophysiology data. It is built on top of the [nelpy](https://github.com/nelpy/nelpy) package, which provides core data objects. neuro_py provides a set of functions for analysis of freely moving electrophysisology, including behavior tracking utilities, neural ensemble detection, peri-event analyses, robust batch analysis tools, and more.
neuro_py is a Python package for analysis of neuroelectrophysiology data. It is built on top of the [nelpy](https://github.com/nelpy/nelpy) package, which provides core data objects. neuro_py provides a set of functions for analysis of freely moving electrophysiology, including behavior tracking utilities, neural ensemble detection, peri-event analyses, robust batch analysis tools, and more.

Tutorials are [here](https://github.com/ryanharvey1/neuro_py/tree/master/tutorials) and more will be added.

Expand Down
9 changes: 0 additions & 9 deletions docs/README.md

This file was deleted.

1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# neuro-py
4 changes: 4 additions & 0 deletions docs/stylesheets/extra.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[data-md-color-scheme="light"] {
--md-primary-fg-color: #90030C;
--md-accent-fg-color: #B31B1B;
}
65 changes: 65 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
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"
palette:
- media: "(prefers-color-scheme)"
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:
- scripts/gen_ref_pages.py
- literate-nav:
nav_file: SUMMARY.md
- section-index
- mkdocstrings

nav:
- Home: index.md
- API Reference: reference/
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ dependencies = [
"track-linearization>=2.3.1",
"pyFFTW>=0.13.1",
"statsmodels>=0.14.1"
"mkdocs>=1.6.1",
"mkdocs-material>=9.5.34",
"mkdocstrings>=0.26.1",
"mkdocs-gen-files>=0.5.0",
"mkdocs-literate-nav>=0.6.1",
"mkdocs-section-index>=0.3.9",
]

[project.urls]
Expand Down
36 changes: 36 additions & 0 deletions scripts/gen_ref_pages.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
"""Generate the code reference pages."""

from pathlib import Path

import mkdocs_gen_files


nav = mkdocs_gen_files.Nav()

root = Path(__file__).parent.parent
src = root

for path in sorted(src.rglob("*.py")):
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] = doc_path.as_posix()

with mkdocs_gen_files.open(full_doc_path, "w") as fd:
identifier = ".".join(parts)
print("::: " + 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())

0 comments on commit b387ee7

Please sign in to comment.