Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion repo_scaffold/templates/template-python/cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"github_username": "ShawnDen-coder",
"project_slug": "{{ cookiecutter.repo_name.strip().lower().replace('-', '_') }}",
"description": "A short description of the project.",
"min_python_version": ["3.8", "3.9", "3.10", "3.11"],
"min_python_version": ["3.9", "3.10", "3.11"],
"max_python_version": ["3.12"],
"use_docker": ["yes", "no"],
"include_cli": ["yes", "no"],
Expand Down
13 changes: 13 additions & 0 deletions repo_scaffold/templates/template-python/hooks/post_gen_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ def remove_github_actions():
shutil.rmtree(github_dir)


def remove_docs():
"""Remove documentation related files if GitHub Actions is not used."""
if "{{cookiecutter.use_github_actions}}" == "no":
# 删除 mkdocs.yml
if os.path.exists("mkdocs.yml"):
os.remove("mkdocs.yml")
# 删除 docs 目录
docs_dir = "docs"
if os.path.exists(docs_dir):
shutil.rmtree(docs_dir)


def init_project_depends():
"""Initialize project dependencies using uv."""
project_dir = os.path.abspath("{{cookiecutter.project_slug}}")
Expand All @@ -33,5 +45,6 @@ def init_project_depends():

if "{{cookiecutter.use_github_actions}}" == "no":
remove_github_actions()
remove_docs()

init_project_depends()
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
with:
export-env: true
env:
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
OP_SERVICE_ACCOUNT_TOKEN: {% raw %}${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}{% endraw %}
PERSONAL_ACCESS_TOKEN: op://shawndengdev/github_access_token/credential
PYPI_TOKEN: op://shawndengdev/pypi_token/credential

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def baseline(session: nox.Session) -> None:
session.run("uv", "run", "ruff", "format", ".")


{% if cookiecutter.use_mkdocs == "yes" %}
{% if cookiecutter.use_github_actions == "yes" %}
@nox.session(reuse_venv=True)
def docs(session: nox.Session) -> None:
"""Build the documentation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ license = "MIT"
readme = "README.md"
requires-python = ">={{cookiecutter.min_python_version}},<{{cookiecutter.max_python_version}}.99"
dependencies = [
{% if cookiecutter.include_cli == 'y' %}
{% if cookiecutter.include_cli == 'yes' %}
"click>=8.1.8",
{% endif %}
]
Expand All @@ -21,8 +21,9 @@ dev = [
"pytest>=8.3.4",
"pytest-mock>=3.14.0",
"pytest-cov>=6.0.0",
"commitizen>=4.1.0",
"commitizen>=3.12.0", # 使用支持 Python 3.8 的版本
]
{% if cookiecutter.use_github_actions == 'yes' %}
docs = [
"mkdocs>=1.5.3",
"mkdocs-material>=9.5.3",
Expand All @@ -31,8 +32,9 @@ docs = [
"mkdocs-gen-files>=0.5.0",
"mkdocs-literate-nav>=0.6.1",
]
{% endif %}

{% if cookiecutter.include_cli == 'y' %}
{% if cookiecutter.include_cli == 'yes' %}
[project.scripts]
{{cookiecutter.project_slug}} = "{{cookiecutter.project_slug}}.cli:cli"
{% endif %}
Expand Down
4 changes: 1 addition & 3 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading