Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ instance/

# Sphinx documentation
docs/_build/
docs/source/tutorials/

# PyBuilder
.pybuilder/
Expand Down
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ template-python


```
# https://medium.com/@pratikdomadiya123/build-project-documentation-quickly-with-the-sphinx-python-2a9732b66594
sphinx-apidoc -o docs/ src/app/
cd docs/
make clean
make html
cd ../
open docs/_build/html/index.html
Expand Down
6 changes: 6 additions & 0 deletions docs/source/api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# API

Description of the API

```{toctree}
:maxdepth: 1
111 changes: 106 additions & 5 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

import os
import shutil

# At the top.
import sphinx_bootstrap_theme

def copy_tutorials(app):
src = os.path.abspath("../tutorials")
Expand All @@ -20,14 +21,16 @@ def copy_tutorials(app):

def setup(app):
app.connect("builder-inited", copy_tutorials)
# app.add_stylesheet("my-styles.css")
app.add_css_file("custom.css")


# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = "python-template"
copyright = "2025, Max Lindqvist"
author = "Max Lindqvist"
copyright = "2025, Max"
author = "Max"

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
Expand All @@ -36,14 +39,112 @@ def setup(app):
"nbsphinx",
"sphinx.ext.mathjax",
"sphinx.ext.autodoc",
"myst_parser", # enable Markdown support
]

templates_path = ["_templates"]
exclude_patterns = []

# Recognize both .rst and .md
source_suffix = {
".rst": "restructuredtext",
".md": "markdown",
}

# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = "sphinx_rtd_theme"
# html_theme = "furo"
# conf.py
# ...

# Activate the theme.
html_theme = 'bootstrap'
html_theme_path = sphinx_bootstrap_theme.get_html_theme_path()

# (Optional) Logo. Should be small enough to fit the navbar (ideally 24x24).
# Path should be relative to the ``_static`` files directory.
# html_logo = "my_logo.png"

# Theme options are theme-specific and customize the look and feel of a
# theme further.
html_theme_options = {
# Navigation bar title. (Default: ``project`` value)
'navbar_title': "python-template",

# Tab name for entire site. (Default: "Site")

'navbar_site_name': "Site",

# A list of tuples containing pages or urls to link to.
# Valid tuples should be in the following forms:
# (name, page) # a link to a page
# (name, "/aa/bb", 1) # a link to an arbitrary relative url
# (name, "http://example.com", True) # arbitrary absolute url
# Note the "1" or "True" value above as the third argument to indicate
# an arbitrary url.
'navbar_links': [
("Quickstart", "quickstart"),
("Tutorials", "tutorial"),
("API", "api"),
# ("Link", "http://example.com", True),
],

# Render the next and previous page links in navbar. (Default: true)
'navbar_sidebarrel': False,

# Render the current pages TOC in the navbar. (Default: true)
'navbar_pagenav': False,

# Tab name for the current pages TOC. (Default: "Page")
'navbar_pagenav_name': "Page",

# Global TOC depth for "site" navbar tab. (Default: 1)
# Switching to -1 shows all levels.
'globaltoc_depth': 2,

# Include hidden TOCs in Site navbar?
#
# Note: If this is "false", you cannot have mixed ``:hidden:`` and
# non-hidden ``toctree`` directives in the same page, or else the build
# will break.
#
# Values: "true" (default) or "false"
'globaltoc_includehidden': "true",

# HTML navbar class (Default: "navbar") to attach to <div> element.
# For black navbar, do "navbar navbar-inverse"
'navbar_class': "navbar inverse",

# Fix navigation bar to top of page?
# Values: "true" (default) or "false"
'navbar_fixed_top': "true",

# Location of link to source.
# Options are "nav" (default), "footer" or anything else to exclude.
'source_link_position': "footer",

# Bootswatch (http://bootswatch.com/) theme.
#
# Options are nothing (default) or the name of a valid theme
# such as "cosmo" or "sandstone".
#
# The set of valid themes depend on the version of Bootstrap
# that's used (the next config option).
#
# Currently, the supported themes are:
# - Bootstrap 2: https://bootswatch.com/2
# - Bootstrap 3: https://bootswatch.com/3
'bootswatch_theme': "flatly",

# Choose Bootstrap version.
# Values: "3" (default) or "2" (in quotes)
'bootstrap_version': "3",
}

html_static_path = ["_static"]
templates_path = ['_templates']


html_sidebars = {
'**': []
}
11 changes: 11 additions & 0 deletions docs/source/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Welcome

Write the documentation of your python package here

```{toctree}
:maxdepth: 2
:caption: Contents

quickstart.md
tutorials.md
api.md
19 changes: 0 additions & 19 deletions docs/source/index.rst

This file was deleted.

38 changes: 38 additions & 0 deletions docs/source/quickstart.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Quickstart

Clone the repo

```
git clone ...
```

Create and activate python environment

```
python -m venv env
source env/bin/activate
pip install --upgrade pip
```

Install the code and requirements with pip

```
pip install -e .
```

Run the code with

```
template-python
```

# Build docs

```
make html
cd ../
open docs/_build/html/index.html
```

```{toctree}
:maxdepth: 1
9 changes: 9 additions & 0 deletions docs/source/tutorials.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Tutorials

Here are a few tutorials to help you get started.

```{toctree}
:maxdepth: 1
:glob:

tutorials/*
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ optional-dependencies.docs = [
"pyproject-fmt",
"sphinx",
"sphinx-rtd-theme",
"sphinx_bootstrap_theme",
]
optional-dependencies.test = [ "coverage", "pytest" ]
urls."Source" = "https://github.com/max-models/template-python"
Expand Down
51 changes: 0 additions & 51 deletions tutorials/tutorial_01.ipynb

This file was deleted.