Skip to content

Commit 588cac3

Browse files
authored
Merge pull request #15
Small CI Changes
2 parents ca9a085 + 5c9cfb1 commit 588cac3

File tree

16 files changed

+200
-102
lines changed

16 files changed

+200
-102
lines changed

docs/conf.py

Lines changed: 38 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -5,60 +5,39 @@
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" # noqa
1410

15-
# Author name
1611
author = "Kyle Oliver"
1712

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**
13+
release = "2025.04.28"
14+
version = "2025.04"
2415

2516
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)
17+
"sphinx.ext.intersphinx",
18+
"sphinx.ext.napoleon",
19+
"myst_parser",
20+
"sphinx_autodoc_typehints",
21+
"sphinx_copybutton",
22+
"sphinx_tabs.tabs",
3223
]
33-
templates_path = ["_templates"] # Create this directory if needed
24+
templates_path = ["_templates"]
3425

35-
# List of patterns relative to source directory, that match files/directories to ignore.
3626
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
27+
"_build",
28+
"Thumbs.db",
29+
".DS_Store",
30+
".venv",
31+
".nox",
32+
"rust",
33+
"tests",
34+
"cookiecutter.json",
35+
"README.md",
36+
"noxfile.py",
37+
".pre-commit-config.yaml",
38+
"pyproject.toml",
5939
]
6040

61-
# MyST-Parser settings (allows using Markdown + Sphinx features)
6241
myst_enable_extensions = [
6342
"amsmath",
6443
"colon_fence",
@@ -75,64 +54,41 @@
7554
"attrs_block",
7655
]
7756

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.
8157
intersphinx_mapping = {
8258
"python": ("https://docs.python.org/3", None),
8359
"pip": ("https://pip.pypa.io/en/stable/", None),
8460
}
8561

86-
# -- Options for HTML output -------------------------------------------------
87-
88-
# The theme to use for HTML output
8962
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)
63+
html_static_path = ["_static"]
9564
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
65+
"sidebar_hide_name": True,
10166
"footer_icons": [
10267
{
10368
"name": "GitHub",
10469
"url": "https://github.com/56kyle/cookiecutter-robust-python",
105-
# **UPDATE THIS URL IF TEMPLATE REPO CHANGES**
10670
"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>",
10771
"aria-label": "GitHub",
10872
},
10973
],
110-
# Configure links back to the source repo itself
11174
"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
75+
"source_branch": "main",
76+
"source_directory": "docs/",
11577
}
11678

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
79+
napoleon_google_docstrings = True
80+
napoleon_numpy_docstrings = False
81+
napoleon_include_init_with_doc = False
82+
napoleon_include_private_with_doc = False
83+
napoleon_include_special_with_doc = True
84+
napoleon_use_admonition_for_examples = True
85+
napoleon_use_admonition_for_notes = True
86+
napoleon_use_admonition_for_references = True
87+
napoleon_use_keyword = True
88+
napoleon_use_param = True
89+
napoleon_use_rtype = True
90+
napoleon_attr_annotations = True
13291

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/
13692
set_type_checking_flag = True
13793
always_document_param_types = False
13894
typehints_fully_qualified = False

noxfile.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,23 +34,23 @@
3434
DEFAULT_DEMO_NAME: str = "robust-python-demo"
3535
DEMO_ROOT_FOLDER: Path = PROJECT_DEMOS_FOLDER / DEFAULT_DEMO_NAME
3636

37-
GENERATE_DEMO_PROJECT_SCRIPT: Path = SCRIPTS_FOLDER / "generate-demo-project.py"
38-
GENERATE_DEMO_PROJECT_OPTIONS: tuple[str, ...] = (
37+
GENERATE_DEMO_SCRIPT: Path = SCRIPTS_FOLDER / "generate-demo.py"
38+
GENERATE_DEMO_OPTIONS: tuple[str, ...] = (
3939
*("--repo-folder", REPO_ROOT),
4040
*("--demos-cache-folder", PROJECT_DEMOS_FOLDER),
4141
*("--demo-name", DEFAULT_DEMO_NAME),
4242
)
4343

4444

4545
LINT_FROM_DEMO_SCRIPT: Path = SCRIPTS_FOLDER / "lint-from-demo.py"
46-
LINT_FROM_DEMO_OPTIONS: tuple[str, ...] = GENERATE_DEMO_PROJECT_OPTIONS
46+
LINT_FROM_DEMO_OPTIONS: tuple[str, ...] = GENERATE_DEMO_OPTIONS
4747

4848

49-
@nox.session(name="generate-demo-project", python=DEFAULT_TEMPLATE_PYTHON_VERSION)
50-
def generate_demo_project(session: Session) -> None:
49+
@nox.session(name="generate-demo", python=DEFAULT_TEMPLATE_PYTHON_VERSION)
50+
def generate_demo(session: Session) -> None:
5151
"""Generates a project demo using the cookiecutter-robust-python template."""
5252
session.install("cookiecutter", "platformdirs", "loguru", "typer")
53-
session.run("python", GENERATE_DEMO_PROJECT_SCRIPT, *GENERATE_DEMO_PROJECT_OPTIONS, *session.posargs)
53+
session.run("python", GENERATE_DEMO_SCRIPT, *GENERATE_DEMO_OPTIONS, *session.posargs)
5454

5555

5656
@nox.session(name="clear-cache", python=None)
@@ -123,7 +123,6 @@ def test(session: Session) -> None:
123123
session.run("pytest", "tests")
124124

125125

126-
127126
@nox.session(venv_backend="none")
128127
def release_template(session: Session):
129128
"""Run the release process for the TEMPLATE using Commitizen.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import typer
88

99
from util import FolderOption
10-
from util import generate_demo_project
10+
from util import generate_demo
1111

1212

1313
cli: typer.Typer = typer.Typer()
@@ -22,7 +22,7 @@ def main(
2222
) -> None:
2323
"""Updates the poetry.lock file."""
2424
try:
25-
generate_demo_project(
25+
generate_demo(
2626
repo_folder=repo_folder,
2727
demos_cache_folder=demos_cache_folder,
2828
demo_name=demo_name,

scripts/util.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def in_new_demo(
5656
**kwargs: Any
5757
) -> Generator[Path, None, None]:
5858
"""Returns a context manager for working within a new demo."""
59-
demo_path: Path = generate_demo_project(
59+
demo_path: Path = generate_demo(
6060
repo_folder=repo_folder,
6161
demos_cache_folder=demos_cache_folder,
6262
demo_name=demo_name,
@@ -67,7 +67,7 @@ def in_new_demo(
6767
yield demo_path
6868

6969

70-
def generate_demo_project(
70+
def generate_demo(
7171
repo_folder: Path,
7272
demos_cache_folder: Path,
7373
demo_name: str,

{{cookiecutter.project_name}}/.github/workflows/test-python.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
uses: actions/upload-artifact@v4
5555
with:
5656
name: {{"test-results-${{ matrix.os }}-py${{ matrix.python-version }}"}}
57-
path: test-results/*.xml
57+
path: tests/results/*.xml
5858
retention-days: 5
5959

6060
- name: Upload coverage report

{{cookiecutter.project_name}}/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ build/ # Build artifacts from setuptools/build backends
3737
htmlcov/ # Coverage HTML reports (default output dir)
3838
.coverage* # Coverage data files (default name pattern)
3939
coverage.*
40-
test-results/ # Directory for JUnit/Coverage XML reports (as configured in noxfile)
40+
tests/results/ # Directory for JUnit/Coverage XML reports (as configured in noxfile)
4141

4242
# Editor/IDE specific files
4343
.vscode/ # VS Code settings (if not shared via devcontainer)

{{cookiecutter.project_name}}/.pre-commit-config.yaml

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,49 @@
33
default_stages: [pre-commit]
44

55
repos:
6-
- repo: https://github.com/pre-commit/pre-commit-hooks
7-
rev: v5.0.0
6+
- repo: local
87
hooks:
98
- id: check-added-large-files
10-
args: ["--maxkb=2000"]
11-
- id: check-yaml
9+
name: Check for added large files
10+
entry: check-added-large-files
11+
language: system
1212
- id: check-toml
13+
name: Check Toml
14+
entry: check-toml
15+
language: system
16+
types: [toml]
17+
- id: check-yaml
18+
name: Check Yaml
19+
entry: check-yaml
20+
language: system
21+
types: [yaml]
22+
- id: darglint
23+
name: darglint
24+
entry: darglint
25+
language: system
26+
types: [python]
27+
stages: [manual]
1328
- id: end-of-file-fixer
29+
name: Fix End of Files
30+
entry: end-of-file-fixer
31+
language: system
32+
types: [text]
33+
stages: [pre-commit, pre-push, manual]
1434
- id: trailing-whitespace
35+
name: Trim Trailing Whitespace
36+
entry: trailing-whitespace-fixer
37+
language: system
38+
types: [text]
39+
stages: [pre-commit, pre-push, manual]
1540

1641
- repo: https://github.com/astral-sh/ruff-pre-commit
1742
rev: v0.11.11
1843
hooks:
1944
- id: ruff-format
2045
args: [--config=.ruff.toml]
2146

22-
- id: ruff
23-
args: [--fix, --exit-non-zero-on-fix, --config=.ruff.toml]
47+
- id: ruff-check
48+
args: [--fix, --diff, --exit-non-zero-on-fix, --config=.ruff.toml]
2449

2550
- repo: https://github.com/doublify/pre-commit-rust
2651
rev: master
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Code of Conduct
2+
3+
```{include} ../CODE_OF_CONDUCT.md
4+
5+
```
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
"""Sphinx configuration."""
2+
3+
project = "{{cookiecutter.friendly_name}}"
4+
author = "{{cookiecutter.author}}"
5+
copyright = "{{cookiecutter.copyright_year}}, {{cookiecutter.author}}" # noqa
6+
7+
release = "{{cookiecutter.version}}"
8+
version = ".".join(release.split(".")[:2])
9+
10+
extensions = [
11+
"sphinx.ext.intersphinx",
12+
"sphinx.ext.napoleon",
13+
"sphinxcontrib.typer",
14+
"myst_parser",
15+
"sphinx_autodoc_typehints",
16+
"sphinx_copybutton",
17+
"sphinx_tabs.tabs",
18+
]
19+
templates_path = ["_templates"]
20+
21+
exclude_patterns = [
22+
"_build",
23+
"Thumbs.db",
24+
".DS_Store",
25+
".venv",
26+
".nox",
27+
"rust",
28+
"tests",
29+
"cookiecutter.json",
30+
"README.md",
31+
"noxfile.py",
32+
".pre-commit-config.yaml",
33+
"pyproject.toml",
34+
]
35+
36+
myst_enable_extensions = [
37+
"amsmath",
38+
"colon_fence",
39+
"deflist",
40+
"dollarmath",
41+
"html_admonition",
42+
"html_image",
43+
"replacements",
44+
"smartquotes",
45+
"strikethrough",
46+
"substitution",
47+
"tasklist",
48+
"attrs_inline",
49+
"attrs_block",
50+
]
51+
52+
intersphinx_mapping = {
53+
"python": ("https://docs.python.org/3", None),
54+
"pip": ("https://pip.pypa.io/en/stable/", None),
55+
}
56+
57+
html_theme = "furo"
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Contributing
2+
3+
```{include} ../CONTRIBUTING.md
4+
---
5+
end-before: <!-- github-only -->
6+
---
7+
```
8+
9+
[code of conduct]: codeofconduct

0 commit comments

Comments
 (0)