Skip to content

Commit

Permalink
Merge pull request #1 from DHI/mkdocs
Browse files Browse the repository at this point in the history
Use mkdocs for documentation
  • Loading branch information
ecomodeller authored Oct 17, 2023
2 parents 102fde7 + f42271e commit 86219c5
Show file tree
Hide file tree
Showing 10 changed files with 62 additions and 131 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,12 @@ jobs:
run: |
pip install .[dev]
- name: Sphinx Build
- name: Build documentstion
run: |
cd docs
make html
mkdocs build
- name: Publish to GitHub Pages
uses: peaceiris/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/_build/html
publish_dir: site
20 changes: 0 additions & 20 deletions docs/Makefile

This file was deleted.

56 changes: 0 additions & 56 deletions docs/conf.py

This file was deleted.

5 changes: 5 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Welcome to my_library

See more in [Getting started](getting_started.md)

A complete reference is available [here](reference.md)
15 changes: 0 additions & 15 deletions docs/index.rst

This file was deleted.

35 changes: 0 additions & 35 deletions docs/make.bat

This file was deleted.

3 changes: 3 additions & 0 deletions docs/reference.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Reference

::: my_library.simulation
12 changes: 12 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
site_name: my_library

theme: "material"

plugins:
- mkdocstrings:
handlers:
python:
options:
show_source: false # change this if you prefer to be able to show the source code inside the docs
heading_level: 2
docstring_style: "numpy" # default is google
38 changes: 38 additions & 0 deletions my_library/simulation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
"""The simulation module"""
import numpy as np


class Simulator:
def __init__(self, name: str, low: float = 0.0, high: float = 1.0) -> None:
"""Create a new simulator
Parameters
----------
name: str
name of simulation
low: float, optional
lower bound
high: float, optional
upper bound
Examples
--------
>>> sim = Simulator(name="Scenario1", low=2.0, high=10.0)
"""
self._name = name
self._low = low
self._high = high

def simulate(self, n_samples: int = 1) -> np.ndarray:
"""Sample random numbers
Parameters
----------
n_samples: int
number of samples
Returns
-------
np.ndarray
"""
return np.random.uniform(low=self._low, high=self._high, size=n_samples)
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ classifiers = [
]

[project.optional-dependencies]
dev = ["pytest","flake8","black","sphinx", "myst-parser","sphinx-book-theme"]
dev = ["pytest","flake8","black","mkdocs","mkdocstrings[python]", "mkdocs-material"]
test= ["pytest"]

[project.urls]
Expand Down

0 comments on commit 86219c5

Please sign in to comment.