Skip to content

Commit fa9864d

Browse files
authored
Merge pull request #417 from boromir674/dev
Release v2.6.0
2 parents 2141f4a + 1e1121e commit fa9864d

File tree

44 files changed

+829
-375
lines changed

Some content is hidden

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

44 files changed

+829
-375
lines changed

CHANGELOG.rst

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,43 @@ Changelog
33
=========
44

55

6+
2.6.0 (2025-05-15)
7+
==================
8+
9+
Changes
10+
^^^^^^^
11+
12+
feature
13+
"""""""
14+
- generate better Mkdocs documentation
15+
16+
test
17+
""""
18+
- fix tests
19+
- fix integration tests
20+
- simplify code
21+
22+
documentation
23+
"""""""""""""
24+
- retire section-index plugin in favor of material built-in !
25+
- do rebase on Integration Branch to pass GH Rule for Update branch before merge
26+
- add the 'Topic Branch PR to Dev' Process Guide
27+
28+
refactor
29+
""""""""
30+
- apply black
31+
- pass mypy checks
32+
- apply ruff
33+
- apply black
34+
- apply isort
35+
- simplify extra_context passing into cookiecutter
36+
37+
chore
38+
"""""
39+
- sem ver bump to 2.6.0
40+
- remove comment from gen_api script
41+
42+
643
2.5.10 (2025-05-10)
744
===================
845

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[![Build Status](https://img.shields.io/github/actions/workflow/status/boromir674/cookiecutter-python-package/test.yaml?link=https%3A%2F%2Fgithub.com%2Fboromir674%2Fcookiecutter-python-package%2Factions%2Fworkflows%2Ftest.yaml%3Fquery%3Dbranch%253Amaster)](https://github.com/boromir674/cookiecutter-python-package/actions/workflows/test.yaml?query=branch%3Amaster) [![Coverage](https://img.shields.io/codecov/c/github/boromir674/cookiecutter-python-package/master?logo=codecov)](https://app.codecov.io/gh/boromir674/cookiecutter-python-package) [![Docs](https://img.shields.io/readthedocs/python-package-generator/master?logo=readthedocs&logoColor=lightblue)](https://python-package-generator.readthedocs.io/en/master/) [![Maintainability](https://api.codeclimate.com/v1/badges/1d347d7dfaa134fd944e/maintainability)](https://codeclimate.com/github/boromir674/cookiecutter-python-package/maintainability)
44
[![Release Version](https://img.shields.io/pypi/v/cookiecutter_python)](https://pypi.org/project/cookiecutter-python/) [![Wheel](https://img.shields.io/pypi/wheel/cookiecutter-python?color=green&label=wheel)](https://pypi.org/project/cookiecutter-python) [![Tech Debt](https://img.shields.io/codeclimate/tech-debt/boromir674/cookiecutter-python-package)](https://codeclimate.com/github/boromir674/cookiecutter-python-package/) [![Codacy](https://app.codacy.com/project/badge/Grade/5be4a55ff1d34b98b491dc05e030f2d7)](https://app.codacy.com/gh/boromir674/cookiecutter-python-package/dashboard?utm_source=github.com&utm_medium=referral&utm_content=boromir674/cookiecutter-python-package&utm_campaign=Badge_Grade)
55
[![Supported Versions](https://img.shields.io/pypi/pyversions/cookiecutter-python?color=blue&label=python&logo=python&logoColor=%23ccccff)](https://pypi.org/project/cookiecutter-python)
6-
[![PyPI Stats](https://img.shields.io/pypi/dm/cookiecutter-python?logo=pypi&logoColor=%23849ED9&color=%23849ED9)](https://pypistats.org/packages/cookiecutter-python) [![Commits Since Tag](https://img.shields.io/github/commits-since/boromir674/cookiecutter-python-package/v2.5.10/master?color=blue&logo=github)](https://github.com/boromir674/cookiecutter-python-package/compare/v2.5.10..master) [![Commits Since Release](https://img.shields.io/github/commits-since/boromir674/cookiecutter-python-package/latest?color=blue&logo=semver&sort=semver)](https://github.com/boromir674/cookiecutter-python-package/releases)
6+
[![PyPI Stats](https://img.shields.io/pypi/dm/cookiecutter-python?logo=pypi&logoColor=%23849ED9&color=%23849ED9)](https://pypistats.org/packages/cookiecutter-python) [![Commits Since Tag](https://img.shields.io/github/commits-since/boromir674/cookiecutter-python-package/v2.6.0/master?color=blue&logo=github)](https://github.com/boromir674/cookiecutter-python-package/compare/v2.6.0..master) [![Commits Since Release](https://img.shields.io/github/commits-since/boromir674/cookiecutter-python-package/latest?color=blue&logo=semver&sort=semver)](https://github.com/boromir674/cookiecutter-python-package/releases)
77
[![License](https://img.shields.io/github/license/boromir674/cookiecutter-python-package)](https://github.com/boromir674/cookiecutter-python-package/blob/master/LICENSE) [![OpenSSF](https://bestpractices.coreinfrastructure.org/projects/5988/badge)](https://bestpractices.coreinfrastructure.org/en/projects/5988) [![Ruff](https://img.shields.io/badge/code%20style-ruff-000000.svg)](https://docs.astral.sh/ruff/) [![Black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
88

99

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Board `dev` branch via PR
2+
3+
> Merge `Topic Branch` via **PR** into `Integration Branch`
4+
5+
## `How-to` Open PR to `dev`
6+
7+
Prerequisites:
8+
9+
- Your git HEAD is on the `Topic Branch`
10+
11+
!!! Tip
12+
13+
Adjust the instructions, using Inputs for `Default` and `Integration` Branches
14+
15+
<div class="grid cards" markdown>
16+
17+
- **`INPUT`** Default Branch (ie main)
18+
19+
---
20+
21+
<input type="text" id="input-default-branch-name" placeholder="Default Branch name; ie main" oninput="updateReferencesToDefaultBranch()">
22+
23+
24+
- **`INPUT`** Integration Branch (ie dev)
25+
26+
---
27+
28+
<input type="text" id="input-integration-branch-name" placeholder="Integration Branch name; ie dev" oninput="updateReferencesToIntegrationBranch()">
29+
30+
</div>
31+
32+
<div class="annotate" markdown>
33+
34+
<ol start="1">
35+
<li>Define Default and Integration Branches (1)
36+
37+
<pre><code class="language-sh">
38+
<span id="set-default-branch-name">export MAIN_BR=...</span>
39+
<span id="set-integration-branch-name">export DEV_BR=...</span>
40+
</code></pre>
41+
</li>
42+
43+
<li><b>Open PR</b> to Integration Branch
44+
45+
```sh
46+
git checkout ${DEV_BR} && git pull && git checkout -
47+
git rebase ${DEV_BR} && git push -f && gh pr create --base ${DEV_BR}
48+
```
49+
50+
</li>
51+
<li>Enable <b>Auto Merge</b>
52+
53+
```sh
54+
gh pr merge --merge --auto
55+
```
56+
</li>
57+
</ol>
58+
59+
<script> function updateReferencesToDefaultBranch() { var inputDefaultBranchName = document.getElementById('input-default-branch-name').value; document.getElementById('set-default-branch-name').innerText = 'export MAIN_BR=' + inputDefaultBranchName; } </script>
60+
61+
<script> function updateReferencesToIntegrationBranch() { var inputIntegrationBranchName = document.getElementById('input-integration-branch-name').value; document.getElementById('set-integration-branch-name').innerText = 'export DEV_BR=' + inputIntegrationBranchName; } </script>
62+
63+
</div>
64+
65+
**Congratulations** :smile: !
66+
67+
Now the **PR** shall auto-merge once all Required Checks Pass !
68+
69+
## Next Steps
70+
71+
Watch the **PR Validation** `Workflow` "live":
72+
```sh
73+
gh run watch
74+
```

mkdocs.yml

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,20 @@ theme:
1818
default: material/tag
1919

2020
features:
21+
# render a breadcrumb navigation above the title of each page, which might make orientation easier for users visiting your documentation on devices with smaller screens.
2122
- navigation.path
22-
- navigation.top
23+
- navigation.top # back-to-top button shown when user, after scrolling down, starts to scroll up again.
2324
- navigation.footer
2425
# enables switching multiple tabs with the same name
2526
- content.tabs.link
2627
# renders copy button on code blocks
2728
- content.code.copy
2829

30+
- navigation.instant
31+
# URL in the address bar is automatically updated with the active anchor as highlighted in the table of contents (right sidebar)
32+
- navigation.tracking
33+
- navigation.indexes
34+
2935
plugins:
3036
# Enable jinja inside your markdown files
3137
# - allows {% include %} statements
@@ -58,7 +64,7 @@ plugins:
5864
# programmatically generate Nav Item: ie 'reference/' entry in Navigation
5965
- literate-nav:
6066
nav_file: SUMMARY.md
61-
- section-index
67+
# - section-index
6268

6369
# Enable displaying at the bottom of pages the last date of modification!
6470
# uv add --optional docs 'mkdocs-git-revision-date-localized-plugin'
@@ -169,19 +175,23 @@ nav:
169175

170176
# GitOps / Processes
171177
- "Reference Processes":
178+
172179
# Process subpage 1
180+
- V2:
181+
- "Topic Branch into dev": "topics/development/topic_branch_to_dev.md"
182+
# Process subpage 2
173183
- "Release Changes":
174184
- "topics/development/gitops/index.md"
175185

176-
- V2:
186+
- V1:
177187
- "Single Branch - Tutorial": "topics/development/gitops/tutorial_release_my_branch_v2.md"
178188
- "Single Branch - Guide": "topics/development/gitops/gitops-v2.md"
179189
- "Single Branch - Cheatsheet": "topics/development/gitops/gitops-v2-cheatsheet.md"
180190
- "Multi Branch - Cheatsheet": "topics/development/gitops/gitops-multi-topics-cheatsheet.md"
181191

182-
# Process subpage 2
183-
- "Docs-only Release": "topics/development/docs_only_release_process.md"
184192
# Process subpage 3
193+
- "Docs-only Release": "topics/development/docs_only_release_process.md"
194+
# Process subpage 4
185195
- "Make an RC (Candidate) Release ": "topics/development/release_candidate.md"
186196

187197
# Tags - Page #

pyproject.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ build-backend = "poetry.core.masonry.api"
1414
name = "cookiecutter_python"
1515
### ... ###
1616

17-
version = "2.5.10"
17+
version = "2.6.0"
1818
description = "1-click Generator of Python Project, from Template with streamlined \"DevOps\" using a powerful CI/CD Pipeline."
1919
readme = "README.md"
2020
license = "AGPL-3.0-only"
@@ -74,7 +74,7 @@ maintainers = [
7474
license = {text = "AGPL-3.0-only"}
7575

7676
name = "cookiecutter_python"
77-
version = "2.5.10"
77+
version = "2.6.0"
7878
description = "1-click Generator of Python Project, from Template with streamlined \"DevOps\" using a powerful CI/CD Pipeline."
7979
readme = "README.md"
8080
# keywords = []
@@ -126,7 +126,6 @@ docs = [
126126
"mkdocs-macros-plugin>=1.3.7, <2.0.0",
127127
"mkdocs-material>=9.6.12, <10.0.0",
128128
"mkdocs-mermaid2-plugin>=1.2.1, <2.0.0",
129-
"mkdocs-section-index==0.3.9",
130129
# mkdocstrings 0.26.1 is the last to support python3.8!
131130
"mkdocstrings==0.26.1",
132131
"mkdocstrings-python==1.11.1",

scripts/gen_api_refs_pages.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
for path in sorted(
2323
x for x in src.rglob("*.py") if '{{ cookiecutter.project_slug }}' not in x.parts
2424
):
25-
print(f"Processing {path}")
25+
# print(f"Processing {path}")
2626
## 1. extract Relative path from Python File and remove suffix (.py)
2727
# EG src/biskotaki/cli.py --> biskotaki/cli
2828
_module_path = path.relative_to(src).with_suffix("")
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
__version__ = '2.5.10'
1+
__version__ = '2.6.0'
22

33
from . import _logging # noqa

src/cookiecutter_python/backend/helpers.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,28 @@
11
import json
22
import logging
33
import typing as t
4+
from pathlib import Path
45

6+
from jinja2 import Environment, FileSystemLoader
7+
8+
from cookiecutter_python.handle.interactive_cli_pipeline import (
9+
InteractiveDialogsPipeline,
10+
)
511

6-
GivenInterpreters = t.Mapping[str, t.Sequence[str]]
712

813
logger = logging.getLogger(__name__)
914

15+
my_dir = Path(__file__).parent.absolute()
1016

11-
def parse_context(config_file: str):
12-
"""Render Context on demand, using cookiecutter.json and optional config file."""
13-
from pathlib import Path
1417

15-
my_dir = Path(__file__).parent.absolute()
18+
GivenInterpreters = t.Mapping[str, t.Sequence[str]]
1619

17-
# use whatever way cookiecutter uses to render the cookiecutter.json
18-
# cookie uses Jinja2
1920

20-
from jinja2 import Environment, FileSystemLoader
21+
def parse_context(config_file: str):
22+
"""Render Context on demand, using cookiecutter.json and optional config file."""
2123

22-
# render file
24+
# use whatever way cookiecutter uses to render the cookiecutter.json
25+
# cookiecutter uses Jinja2 to render files
2326
env = Environment(
2427
loader=FileSystemLoader(str(my_dir / '..')),
2528
extensions=['jinja2_time.TimeExtension'], # shipped with cookiecutter 1.7
@@ -66,10 +69,6 @@ def parse_context(config_file: str):
6669
**{k: v[0] for k, v in choices.items() if k not in user_default_context},
6770
)
6871

69-
from cookiecutter_python.handle.interactive_cli_pipeline import (
70-
InteractiveDialogsPipeline,
71-
)
72-
7372
pipe = InteractiveDialogsPipeline()
7473

7574
# assert choices['rtd_python_version'] == [], f"DEBUG: {choices['rtd_python_version']}"

src/cookiecutter_python/backend/load_config.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010
logger = logging.getLogger(__name__)
1111

1212

13+
SupportedInterpreters = t.TypedDict(
14+
"SupportedInterpreters", {"supported-interpreters": t.Sequence[str]}
15+
)
16+
17+
1318
def load_yaml(config_file) -> t.MutableMapping:
1419
# TODO use a proxy to load yaml
1520
with io.open(config_file, encoding='utf-8') as file_handle:
@@ -25,7 +30,7 @@ def load_yaml(config_file) -> t.MutableMapping:
2530

2631
def get_interpreters_from_yaml(
2732
config_file: str,
28-
) -> t.Optional[t.Mapping[str, t.Sequence[str]]]:
33+
) -> t.Optional[SupportedInterpreters]:
2934
"""Parse the 'interpreters' variable out of the user's config yaml file.
3035
3136
Args:
@@ -60,7 +65,7 @@ def _validate_and_get_context(data: t.MutableMapping) -> t.MutableMapping:
6065

6166
def _extract_interpreters(
6267
context: t.MutableMapping,
63-
) -> t.Optional[t.Mapping[str, t.Sequence[str]]]:
68+
) -> t.Optional[SupportedInterpreters]:
6469
"""Extract the interpreters from the 'default_context'."""
6570
interpreters = context.get('interpreters')
6671

@@ -72,14 +77,14 @@ def _extract_interpreters(
7277
return _parse_interpreters_from_string(interpreters)
7378

7479
if isinstance(interpreters, dict):
75-
return interpreters
80+
return t.cast(SupportedInterpreters, interpreters)
7681

7782
raise UserYamlDesignError('Interpreters value is not a string or a dictionary')
7883

7984

8085
def _parse_interpreters_from_string(
8186
interpreters: str,
82-
) -> t.Optional[t.Mapping[str, t.Sequence[str]]]:
87+
) -> t.Optional[SupportedInterpreters]:
8388
"""Parse interpreters from a JSON string."""
8489
logger.warning(
8590
"User's YAML is now expected to contain a dictionary for the 'interpreters' key"

src/cookiecutter_python/backend/main.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,7 @@ def generate(
3939
'artifacts', and Continuous Documentation of the Python Project.
4040
"""
4141
print('Start Python Generator !')
42-
# Initialize Generation Request:
43-
# - store the CI Test Matrix Python Interpreters versions list
44-
# - prompt for user input in interactive or atempt to read from yaml otherwise
45-
# - prepare Cookiecutter extra context:
46-
# - add interpreters versions list
42+
# Future HTTP requests to pypi.org and readthedocs.org web servers
4743
request = pre_main(
4844
Request(
4945
config_file=config_file,
@@ -54,9 +50,9 @@ def generate(
5450
offline=offline,
5551
)
5652
)
57-
print('Extra context: ', request.extra_context)
5853
## GENERATION from Template; delegate to Cookiecutter callable ##
5954
project_dir = generator(
55+
# COOKIECUTTER TEMPLATE (cookiecutter.json)
6056
os.path.abspath(os.path.join(my_dir, '..')), # template dir path
6157
checkout=checkout,
6258
# no_input=no_input,

0 commit comments

Comments
 (0)