Skip to content

Commit c9a1f53

Browse files
committed
feat: copy docs for generated project from hypermodern python cookiecutter and clean up template docs config
1 parent f3f07b3 commit c9a1f53

File tree

7 files changed

+99
-81
lines changed

7 files changed

+99
-81
lines changed

docs/conf.py

Lines changed: 38 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -5,60 +5,40 @@
55
from datetime import date
66

77

8-
# --- Project information -----------------------------------------------------
9-
10-
# General info about the TEMPLATE documentation itself
118
project = "cookiecutter-robust-python Template Documentation"
12-
# Copyright year and author name
13-
copyright = f"{date.today().year}, Kyle Oliver" # Dynamically get current year
9+
copyright = f"{date.today().year}, Kyle Oliver"
1410

1511
# Author name
1612
author = "Kyle Oliver"
1713

18-
# The version info for the TEMPLATE. Using Calendar Versioning: YYYY.MM.DD
19-
# **UPDATE MANUALLY OR VIA SIMPLE SCRIPT WITH EACH TEMPLATE RELEASE**
20-
# This version tracks the template"s development state, not generated projects.
21-
release = "2025.04.28" # Example: YYYY.MM.DD - **UPDATE MANUALLY**
22-
# The short X.Y version for the template (YYYY.MM)
23-
version = "2025.04" # Example: YYYY.MM - **UPDATE MANUALLY**
14+
release = "2025.04.28"
15+
version = "2025.04"
2416

2517
extensions = [
26-
"sphinx.ext.intersphinx", # Link to documentation of other projects
27-
"sphinx.ext.napoleon", # Support for Google and NumPy style docstrings (useful for understanding code mentioned)
28-
"myst_parser", # Support for parsing Markdown files (.md)
29-
"sphinx_autodoc_typehints", # Better rendering of type hints (useful for understanding code mentioned/evaluated)
30-
"sphinx_copybutton", # Adds a "copy" button to code blocks (Excellent QoL)
31-
"sphinx_tabs.tabs", # Adds tab support (Useful for showing OS-specific commands/configs, code variants)
18+
"sphinx.ext.intersphinx",
19+
"sphinx.ext.napoleon",
20+
"myst_parser",
21+
"sphinx_autodoc_typehints",
22+
"sphinx_copybutton",
23+
"sphinx_tabs.tabs",
3224
]
33-
templates_path = ["_templates"] # Create this directory if needed
25+
templates_path = ["_templates"]
3426

35-
# List of patterns relative to source directory, that match files/directories to ignore.
3627
exclude_patterns = [
37-
"_build", # Output directory
38-
"Thumbs.db", # MacOS files
39-
".DS_Store", # MacOS files
40-
".venv", # Standard virtual environment directory
41-
".nox", # Nox environment directory (for template docs build)
42-
# EXCLUDE THE GENERATED PROJECT TEMPLATE DIRECTORY ITSELF!!
43-
# Sphinx runs from "docs/" directory, so path is relative to there "../{{ cookiecutter.project_slug }}"
44-
# The {{ cookiecutter.project_slug }} variable is not available here at TEMPLATE doc build time.
45-
# You need to manually exclude the directory name based on your typical generated slug structure or use a simpler pattern
46-
# Assuming the generated slug will likely be lowercase/hyphenated based on cookiecutter.json logic
47-
# e.g., exclude patterns like "my-robust-python-project", "another-project-name"
48-
# Alternatively, exclude based on path structure if generated output goes to a known sibling dir
49-
# A simple solution for template docs is to manually add generated projects to this list if they cause build issues.
50-
# For robust template docs, you"d build from the template root and exclude the *rendered* output dir of the generated project.
51-
# Let"s just exclude common development/build environment dirs and rely on the build process to only target the "docs/" dir.
52-
"rust", # Exclude example Rust source dir at template root
53-
"tests", # Exclude template"s own tests if any (e.g., tests/ directory at template root)
54-
"cookiecutter.json", # Exclude the cookiecutter input file itself from being treated as a doc source
55-
"README.md", # Exclude the template"s README file from being treated as a doc source
56-
"noxfile.py", # Exclude the template"s noxfile
57-
".pre-commit-config.yaml", # Exclude template"s pre-commit config
58-
"pyproject.toml", # Exclude the template"s pyproject.toml
28+
"_build",
29+
"Thumbs.db",
30+
".DS_Store",
31+
".venv",
32+
".nox",
33+
"rust",
34+
"tests",
35+
"cookiecutter.json",
36+
"README.md",
37+
"noxfile.py",
38+
".pre-commit-config.yaml",
39+
"pyproject.toml",
5940
]
6041

61-
# MyST-Parser settings (allows using Markdown + Sphinx features)
6242
myst_enable_extensions = [
6343
"amsmath",
6444
"colon_fence",
@@ -75,64 +55,41 @@
7555
"attrs_block",
7656
]
7757

78-
# Intersphinx mapping: Link to documentation of standard libraries or tools mentioned
79-
# Tuple: (base URL, inventory file path/None for standard)
80-
# Ensure URLs end with / and are correct. Use "latest" or "stable" versions often.
8158
intersphinx_mapping = {
8259
"python": ("https://docs.python.org/3", None),
8360
"pip": ("https://pip.pypa.io/en/stable/", None),
8461
}
8562

86-
# -- Options for HTML output -------------------------------------------------
87-
88-
# The theme to use for HTML output
8963
html_theme = "furo"
90-
91-
# Add any paths that contain custom static files (like logo, css).
92-
html_static_path = ["_static"] # Create this directory (docs/_static) if you add files like logo.png
93-
94-
# HTML theme options (example for Furo)
64+
html_static_path = ["_static"]
9565
html_theme_options = {
96-
# Create docs/_static/logo-light.png and logo-dark.png
97-
"sidebar_hide_name": True, # Hide project name next to logo if logo contains it
98-
# "light_logo": "logo-light.png",
99-
# "dark_logo": "logo-dark.png",
100-
# Footer icons
66+
"sidebar_hide_name": True,
10167
"footer_icons": [
10268
{
10369
"name": "GitHub",
10470
"url": "https://github.com/56kyle/cookiecutter-robust-python",
105-
# **UPDATE THIS URL IF TEMPLATE REPO CHANGES**
10671
"html": "<svg stroke='currentColor' fill='currentColor' stroke-width='0' viewBox='0 0 16 16'><path fill-rule='evenodd' d='M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.22.82.69 1.19 1.81.85 2.23.65.07-.51.28-.85.54-1.04-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38C13.71 14.53 16 11.53 16 8c0-4.42-3.58-8-8-8z'></path></svg>",
10772
"aria-label": "GitHub",
10873
},
10974
],
110-
# Configure links back to the source repo itself
11175
"source_repository": "https://github.com/56kyle/cookiecutter-robust-python/",
112-
# **UPDATE THIS URL IF TEMPLATE REPO CHANGES**
113-
"source_branch": "main", # Or your default branch
114-
"source_directory": "docs/", # Tells Furo that the doc source is in this subdir relative to repo root
76+
"source_branch": "main",
77+
"source_directory": "docs/",
11578
}
11679

117-
# -- Options for Napoleon -----------------------------------------------------
118-
# Ensure Napoleon processes Google style docstrings correctly
119-
napoleon_google_docstrings = True # Enable Google style (Parameters, Returns, etc.)
120-
napoleon_numpy_docstrings = False # Disable NumPy style if not used
121-
napoleon_include_init_with_doc = False # Set to true if __init__ only calls super() but has docstrings
122-
napoleon_include_private_with_doc = False # Include private members with docstrings if needed
123-
napoleon_include_special_with_doc = True # Include special members (__str__, etc.)
124-
napoleon_use_admonition_for_examples = True # Render Examples sections as admonitions (Recommended)
125-
napoleon_use_admonition_for_notes = True # Render Notes sections as admonitions (Recommended)
126-
napoleon_use_admonition_for_references = True # Render References sections as admonitions (Recommended)
127-
# Control parameter list format: use keyword is often nicer
128-
napoleon_use_keyword = True # Use :keyword: role (aligns with Google style recommendation)
129-
napoleon_use_param = True # Use :param: role
130-
napoleon_use_rtype = True # Use :rtype: role (Recommended when using type hints)
131-
napoleon_attr_annotations = True # Document attributes with type annotations
80+
napoleon_google_docstrings = True
81+
napoleon_numpy_docstrings = False
82+
napoleon_include_init_with_doc = False
83+
napoleon_include_private_with_doc = False
84+
napoleon_include_special_with_doc = True
85+
napoleon_use_admonition_for_examples = True
86+
napoleon_use_admonition_for_notes = True
87+
napoleon_use_admonition_for_references = True
88+
napoleon_use_keyword = True
89+
napoleon_use_param = True
90+
napoleon_use_rtype = True
91+
napoleon_attr_annotations = True
13292

133-
# -- Options for sphinx-autodoc-typehints -------------------------------------
134-
# This extension handles displaying type hints correctly and adds type annotation to Parameters/Returns sections
135-
# https://sphinx-autodoc-typehints.readthedocs.io/en/stable/
13693
set_type_checking_flag = True
13794
always_document_param_types = False
13895
typehints_fully_qualified = False
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```{include} ../CODE_OF_CONDUCT.md
2+
3+
```
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
"""Sphinx configuration."""
2+
3+
project = "{{cookiecutter.friendly_name}}"
4+
author = "{{cookiecutter.author}}"
5+
copyright = "{{cookiecutter.copyright_year}}, {{cookiecutter.author}}" # noqa: A001
6+
extensions = [
7+
"sphinx.ext.autodoc",
8+
"sphinx.ext.napoleon",
9+
"sphinx_click",
10+
"myst_parser",
11+
]
12+
autodoc_typehints = "description"
13+
html_theme = "furo"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
```{include} ../CONTRIBUTING.md
2+
---
3+
end-before: <!-- github-only -->
4+
---
5+
```
6+
7+
[code of conduct]: codeofconduct
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
```{include} ../README.md
2+
---
3+
end-before: <!-- github-only -->
4+
---
5+
```
6+
7+
[license]: license
8+
[contributor guide]: contributing
9+
[command-line reference]: usage
10+
11+
```{toctree}
12+
---
13+
hidden:
14+
maxdepth: 1
15+
---
16+
17+
usage
18+
reference
19+
contributing
20+
Code of Conduct <codeofconduct>
21+
License <license>
22+
Changelog <https://github.com/{{cookiecutter.github_user}}/{{cookiecutter.project_name}}/releases>
23+
```
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Reference
2+
3+
## {{ cookiecutter.package_name }}
4+
5+
```{eval-rst}
6+
.. automodule:: {{cookiecutter.package_name}}
7+
:members:
8+
```
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Usage
2+
3+
```{eval-rst}
4+
.. click:: {{cookiecutter.package_name}}.__main__:main
5+
:prog: {{cookiecutter.project_name}}
6+
:nested: full
7+
```

0 commit comments

Comments
 (0)