From 474f441fc79a3df72176b27ad7b53c0c03ef9e8b Mon Sep 17 00:00:00 2001 From: ojeda-e Date: Mon, 4 May 2026 15:43:23 -0600 Subject: [PATCH 1/5] Fix: set repo_name from project_name --- docs/scripts/generate_cookiecutter_cli.py | 12 ++++++++---- docs/source/conf.py | 2 +- docs/source/getting_started.rst | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/docs/scripts/generate_cookiecutter_cli.py b/docs/scripts/generate_cookiecutter_cli.py index b0a3666a..56681b76 100755 --- a/docs/scripts/generate_cookiecutter_cli.py +++ b/docs/scripts/generate_cookiecutter_cli.py @@ -13,6 +13,11 @@ GENERATED_PATH = COOKIECUTTER_PATH / "docs" / "source" / "generated" +def repo_name_from_project_name(project_name: str) -> str: + """Same reference name as in ``repo_name`` default in ``cookiecutter.json``.""" + return project_name.lower().replace(" ", "_").replace("-", "_") + + def flatten_dict(dct, key=tuple()): """Turn a nested dict into a flat dict, with keys as tuples.""" for k, v in dct.items(): @@ -78,7 +83,8 @@ def label_files(self, output) -> str: class ExampleRepositoryDocumentation: def __init__(self): - self.repo_name = "example-repository" + self.project_name = "My Project Name" + self.repo_name = repo_name_from_project_name(self.project_name) self.package_name = "package_name" self.example_repo_path = GENERATED_PATH / self.repo_name self.cookiecutter_cli_log = GENERATED_PATH / "cookiecutter_cli.log" @@ -86,7 +92,7 @@ def __init__(self): def generate_cli_output(self) -> str: inputs = [ - "My Project Name", # project_name + self.project_name, # project_name self.repo_name, # repo_name self.package_name, # package_name "A package to do MD analysis", # description @@ -97,8 +103,6 @@ def generate_cli_output(self) -> str: "", # dependency_source "", # include_ReadTheDocs "MyAnalysisClass", # template_analysis_class - "" - "" ] with tempfile.TemporaryDirectory() as tmpdir: diff --git a/docs/source/conf.py b/docs/source/conf.py index 75a081f6..4396f30f 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -80,7 +80,7 @@ # directories to ignore when looking for source files. # This pattern also affects html_static_path and html_extra_path . exclude_patterns = ["_build", "Thumbs.db", - ".DS_Store", "generated/example-repository/*"] + ".DS_Store", "generated/my_project_name/*"] # The name of the Pygments (syntax highlighting) style to use. pygments_style = "sphinx" diff --git a/docs/source/getting_started.rst b/docs/source/getting_started.rst index e4a9fdd8..d60a23bf 100644 --- a/docs/source/getting_started.rst +++ b/docs/source/getting_started.rst @@ -36,7 +36,7 @@ The :ref:`options-label` section below provides more details on these options, default values (if applicable), what they mean, and what they affect. Running the cookiecutter will the above responses will generate the following -output skeleton, (as well as initialise a git repository `example-repository`, +output skeleton, (as well as initialise a git repository `my_project_name`, make an initial commit, and add a "0.0.0" tag to set the initial version): .. literalinclude:: generated/cookie_tree.txt From a4e2d8339ee86da5ca7e0ebb99172b44e2b5d25f Mon Sep 17 00:00:00 2001 From: ojeda-e Date: Mon, 4 May 2026 16:39:39 -0600 Subject: [PATCH 2/5] Add tests - project name matches --- tests/test_generate_cookiecutter_cli.py | 27 +++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 tests/test_generate_cookiecutter_cli.py diff --git a/tests/test_generate_cookiecutter_cli.py b/tests/test_generate_cookiecutter_cli.py new file mode 100644 index 00000000..4a9527bf --- /dev/null +++ b/tests/test_generate_cookiecutter_cli.py @@ -0,0 +1,27 @@ +"""Tests for docs/scripts/generate_cookiecutter_cli helpers.""" + +import pathlib +import sys + +import pytest + +_DOCS_SCRIPTS = pathlib.Path(__file__).resolve().parents[1] / "docs" / "scripts" +sys.path.insert(0, str(_DOCS_SCRIPTS)) + +from generate_cookiecutter_cli import repo_name_from_project_name # noqa: E402 + + +@pytest.mark.parametrize( + ("project_name", "expected_repo_name"), + [ + ("A Project Name", "a_project_name"), + ("same_name_as_project", "same_name_as_project"), + ("Test-Project Name", "test_project_name"), + ], +) +def test_repo_name_from_project_name_matches_cookiecutter_default( + project_name: str, + expected_repo_name: str, +) -> None: + """Mirrors ``repo_name`` in cookiecutter.json (slug from ``project_name``).""" + assert repo_name_from_project_name(project_name) == expected_repo_name \ No newline at end of file From 2f03eb93ad7eb3f78c50b7bf2667d6c21356c932 Mon Sep 17 00:00:00 2001 From: ojeda-e Date: Mon, 4 May 2026 16:44:39 -0600 Subject: [PATCH 3/5] Chore: Update AUTHORS and CHANGELOG --- AUTHORS.md | 5 ++++- CHANGELOG.md | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/AUTHORS.md b/AUTHORS.md index ef49a714..fb25ea15 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -27,4 +27,7 @@ The rules for this file: - Oliver Beckstein \<@orbeckst\> **2024** -- Lawson Woods \<@ljwoods2\> \ No newline at end of file +- Lawson Woods \<@ljwoods2\> + +**2024** +- Estefania Barreto-Ojeda \<@ojeda-e\> \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 1dbc7307..81abfce7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ The rules for this file: - RMeli - orbeckst - ljwoods2 +- ojeda-e ### Added @@ -42,6 +43,7 @@ The rules for this file: ### Fixed +- Build docs by fixing `repo_name` cookicutter cli (Issue #157, PR #158) - Updated mambaforge version in `readthedocs.yaml` (Issue #132, PR #133) - Switched deprecated pkg_resources to use importlib (PR #122, Issue #121) - Fixed pypi_check with lowercase (PR #118, Issue #112) From db48d0705e87459c59e897e37dd9c2e1a590f1fe Mon Sep 17 00:00:00 2001 From: ojeda-e Date: Mon, 4 May 2026 16:56:46 -0600 Subject: [PATCH 4/5] Set same name as in ExampleRepositoryDocumentation --- docs/source/conf.py | 2 +- docs/source/getting_started.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 4396f30f..52bf5f66 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -80,7 +80,7 @@ # directories to ignore when looking for source files. # This pattern also affects html_static_path and html_extra_path . exclude_patterns = ["_build", "Thumbs.db", - ".DS_Store", "generated/my_project_name/*"] + ".DS_Store", "generated/project_name/*"] # The name of the Pygments (syntax highlighting) style to use. pygments_style = "sphinx" diff --git a/docs/source/getting_started.rst b/docs/source/getting_started.rst index d60a23bf..1e8ae736 100644 --- a/docs/source/getting_started.rst +++ b/docs/source/getting_started.rst @@ -36,7 +36,7 @@ The :ref:`options-label` section below provides more details on these options, default values (if applicable), what they mean, and what they affect. Running the cookiecutter will the above responses will generate the following -output skeleton, (as well as initialise a git repository `my_project_name`, +output skeleton, (as well as initialise a git repository `project_name`, make an initial commit, and add a "0.0.0" tag to set the initial version): .. literalinclude:: generated/cookie_tree.txt From bf3c1d96c7cd286dcd7e7756fe3e611b27812de3 Mon Sep 17 00:00:00 2001 From: Oliver Beckstein Date: Mon, 4 May 2026 16:46:14 -0700 Subject: [PATCH 5/5] Update CHANGELOG.md: typo fix --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 81abfce7..deeb8196 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,7 +43,7 @@ The rules for this file: ### Fixed -- Build docs by fixing `repo_name` cookicutter cli (Issue #157, PR #158) +- Build docs by fixing `repo_name` cookiecutter cli (Issue #157, PR #158) - Updated mambaforge version in `readthedocs.yaml` (Issue #132, PR #133) - Switched deprecated pkg_resources to use importlib (PR #122, Issue #121) - Fixed pypi_check with lowercase (PR #118, Issue #112)