Skip to content

Commit 97e78ca

Browse files
fix jinja2 error
1 parent de331f4 commit 97e78ca

File tree

6 files changed

+22
-9
lines changed

6 files changed

+22
-9
lines changed

repo_scaffold/templates/template-python/cookiecutter.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"github_username": "ShawnDen-coder",
66
"project_slug": "{{ cookiecutter.repo_name.strip().lower().replace('-', '_') }}",
77
"description": "A short description of the project.",
8-
"min_python_version": ["3.8", "3.9", "3.10", "3.11"],
8+
"min_python_version": ["3.9", "3.10", "3.11"],
99
"max_python_version": ["3.12"],
1010
"use_docker": ["yes", "no"],
1111
"include_cli": ["yes", "no"],

repo_scaffold/templates/template-python/hooks/post_gen_project.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,18 @@ def remove_github_actions():
1818
shutil.rmtree(github_dir)
1919

2020

21+
def remove_docs():
22+
"""Remove documentation related files if GitHub Actions is not used."""
23+
if "{{cookiecutter.use_github_actions}}" == "no":
24+
# 删除 mkdocs.yml
25+
if os.path.exists("mkdocs.yml"):
26+
os.remove("mkdocs.yml")
27+
# 删除 docs 目录
28+
docs_dir = "docs"
29+
if os.path.exists(docs_dir):
30+
shutil.rmtree(docs_dir)
31+
32+
2133
def init_project_depends():
2234
"""Initialize project dependencies using uv."""
2335
project_dir = os.path.abspath("{{cookiecutter.project_slug}}")
@@ -33,5 +45,6 @@ def init_project_depends():
3345

3446
if "{{cookiecutter.use_github_actions}}" == "no":
3547
remove_github_actions()
48+
remove_docs()
3649

3750
init_project_depends()

repo_scaffold/templates/template-python/{{cookiecutter.project_slug}}/.github/workflows/release_build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
with:
3030
export-env: true
3131
env:
32-
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
32+
OP_SERVICE_ACCOUNT_TOKEN: {% raw %}${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}{% endraw %}
3333
PERSONAL_ACCESS_TOKEN: op://shawndengdev/github_access_token/credential
3434
PYPI_TOKEN: op://shawndengdev/pypi_token/credential
3535

repo_scaffold/templates/template-python/{{cookiecutter.project_slug}}/noxfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ def baseline(session: nox.Session) -> None:
203203
session.run("uv", "run", "ruff", "format", ".")
204204

205205

206-
{% if cookiecutter.use_mkdocs == "yes" %}
206+
{% if cookiecutter.use_github_actions == "yes" %}
207207
@nox.session(reuse_venv=True)
208208
def docs(session: nox.Session) -> None:
209209
"""Build the documentation.

repo_scaffold/templates/template-python/{{cookiecutter.project_slug}}/pyproject.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ license = "MIT"
99
readme = "README.md"
1010
requires-python = ">={{cookiecutter.min_python_version}},<{{cookiecutter.max_python_version}}.99"
1111
dependencies = [
12-
{% if cookiecutter.include_cli == 'y' %}
12+
{% if cookiecutter.include_cli == 'yes' %}
1313
"click>=8.1.8",
1414
{% endif %}
1515
]
@@ -21,8 +21,9 @@ dev = [
2121
"pytest>=8.3.4",
2222
"pytest-mock>=3.14.0",
2323
"pytest-cov>=6.0.0",
24-
"commitizen>=4.1.0",
24+
"commitizen>=3.12.0", # 使用支持 Python 3.8 的版本
2525
]
26+
{% if cookiecutter.use_github_actions == 'yes' %}
2627
docs = [
2728
"mkdocs>=1.5.3",
2829
"mkdocs-material>=9.5.3",
@@ -31,8 +32,9 @@ docs = [
3132
"mkdocs-gen-files>=0.5.0",
3233
"mkdocs-literate-nav>=0.6.1",
3334
]
35+
{% endif %}
3436

35-
{% if cookiecutter.include_cli == 'y' %}
37+
{% if cookiecutter.include_cli == 'yes' %}
3638
[project.scripts]
3739
{{cookiecutter.project_slug}} = "{{cookiecutter.project_slug}}.cli:cli"
3840
{% endif %}

uv.lock

Lines changed: 1 addition & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)