Skip to content

Commit 5168d77

Browse files
committed
Update the project
1 parent ac2ee75 commit 5168d77

File tree

372 files changed

+53
-12365
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

372 files changed

+53
-12365
lines changed

.github/workflows/deploy_pages.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ jobs:
2626
with:
2727
python-version: 3.12
2828
- run: pip install -r requirements.txt
29+
- run: ./scripts/gen_markdown_chapters.py
30+
- run: copy docs/README.md docs/index.md
2931
- run: mkdocs build --site-dir ./_site
3032
- name: Upload artifact
3133
uses: actions/upload-pages-artifact@v3.0.1

.scripts/gen_markdown_chapters.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#!/usr/bin/env python3
2-
"""Generate aggregated Markdown files for each .examples subfolder.
2+
"""Generate aggregated Markdown files for each examples subfolder.
33
44
Usage:
55
python .scripts/gen_markdown_chapters.py \
6-
--.examples-dir .examples \
6+
--examples-dir examples \
77
--output-dir docs
88
9-
For every immediate subfolder in ``.examples`` a single ``.md`` file is created
9+
For every immediate subfolder in ``examples`` a single ``.md`` file is created
1010
in the output directory. The file name matches the subfolder name and contains
1111
all example files from that folder. Folder and file names are converted to
1212
title format: CamelCase words are split with spaces and acronyms remain in
@@ -55,7 +55,7 @@ def to_title(name: str) -> str:
5555
return " ".join(words)
5656

5757
def generate_aggregate(folder: Path, output_dir: Path) -> None:
58-
"""Create a single Markdown file aggregating all .examples in *folder*."""
58+
"""Create a single Markdown file aggregating all examples in *folder*."""
5959
examples = []
6060
for py_file in sorted(folder.glob("*.py")):
6161
if py_file.name == "__init__.py":
@@ -84,16 +84,16 @@ def generate_aggregate(folder: Path, output_dir: Path) -> None:
8484
def main() -> None:
8585

8686
parser = argparse.ArgumentParser(
87-
description="Generate aggregated Markdown files from the .examples"
87+
description="Generate aggregated Markdown files from the examples"
8888
)
8989
parser.add_argument(
90-
"--.examples-dir",
91-
default="../.examples",
90+
"--examples-dir",
91+
default="../examples",
9292
help="Directory containing example .py files",
9393
)
9494
parser.add_argument(
9595
"--output-dir",
96-
default="../docs/.examples",
96+
default="../docs",
9797
help="Directory where Markdown files will be written",
9898
)
9999
args = parser.parse_args()

.scripts/gen_markdown_pages.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
44
Usage:
55
python .scripts/gen_markdown_pages.py \
6-
--.examples-dir .examples \
6+
--examples-dir examples \
77
--template templates/example_file.mustache \
88
--output-dir docs
99
10-
The directory structure under ``.examples`` is mirrored under the output
10+
The directory structure under ``examples`` is mirrored under the output
1111
directory. Each ``.py`` file becomes a ``.md`` file with the same name and
1212
relative path. Files named ``__init__.py`` are ignored and skipped.
1313
"""
@@ -50,11 +50,11 @@ def process_file(py_path: Path, template: str, base_dir: Path, output_dir: Path)
5050

5151
def main() -> None:
5252
parser = argparse.ArgumentParser(
53-
description="Generate Markdown files mirroring the .examples directory"
53+
description="Generate Markdown files mirroring the examples directory"
5454
)
5555
parser.add_argument(
56-
"--.examples-dir",
57-
default="../.examples",
56+
"--examples-dir",
57+
default="../examples",
5858
help="Directory containing example .py files",
5959
)
6060
parser.add_argument(

.scripts/gen_single_markdown.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
44
Usage::
55
python .scripts/gen_single_markdown.py \
6-
--.examples-dir .examples \
6+
--examples-dir examples \
77
--template templates/examples_page.mustache \
8-
--output .examples.md
8+
--output examples.md
99
1010
Each file's content is inserted verbatim as a code block in the output. Files
1111
named ``__init__.py`` are ignored.
@@ -48,16 +48,16 @@ def render_markdown(template_path: Path, output_path: Path, examples: list) -> N
4848
with template_path.open("r", encoding="utf-8") as f:
4949
template = f.read()
5050
renderer = pystache.Renderer()
51-
markdown = renderer.render(template, {".examples": examples})
51+
markdown = renderer.render(template, {"examples": examples})
5252
with output_path.open("w", encoding="utf-8") as f:
5353
f.write(markdown)
5454

5555

5656
def main() -> None:
57-
parser = argparse.ArgumentParser(description="Generate .examples markdown")
57+
parser = argparse.ArgumentParser(description="Generate examples markdown")
5858
parser.add_argument(
59-
"--.examples-dir",
60-
default="../.examples",
59+
"--examples-dir",
60+
default="../examples",
6161
help="Directory containing example .py files",
6262
)
6363
parser.add_argument(
@@ -67,7 +67,7 @@ def main() -> None:
6767
)
6868
parser.add_argument(
6969
"--output",
70-
default="../docs/.examples.md",
70+
default="../docs/examples.md",
7171
help="Output markdown file",
7272
)
7373
args = parser.parse_args()

docs/01_hello_world.md

Lines changed: 0 additions & 140 deletions
This file was deleted.

0 commit comments

Comments
 (0)