Skip to content

Commit 3904af1

Browse files
feat: update template config
1 parent 7a483f5 commit 3904af1

File tree

8 files changed

+103
-35
lines changed

8 files changed

+103
-35
lines changed

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tool.poetry]
2-
name = "repo-template"
2+
name = "repo-scaffold"
33
version = "0.1.0"
44
description = "shawn deng repo temple project"
55
authors = ["colyerdeng <[email protected]>"]
@@ -18,11 +18,11 @@ pre-commit = "^4.0.1"
1818
commitizen = "^4.1.0"
1919

2020
[tool.poetry.scripts]
21-
repo-template = "repo_template.cli:cli"
21+
repo-scaffold = "repo_scaffold.cli:cli"
2222

2323
[tool.ruff]
2424
line-length = 120
25-
include = ["pyproject.toml", "{{template-python}}/{{cookiecutter.project_slug}}/*.py"]
25+
include = ["pyproject.toml", "repo_scaffold/*.py"]
2626

2727
[tool.ruff.lint]
2828
select = [

repo_scaffold/__init__.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
"""Repository scaffolding package for project initialization and setup.
2+
3+
This package provides tools and utilities for scaffolding new Python projects
4+
with standardized structure and best practices. It serves as the main entry point
5+
for the repo_scaffold package functionality.
6+
7+
Typical usage example:
8+
9+
import repo_scaffold
10+
11+
scaffold = repo_scaffold.create_project()
12+
scaffold.setup_structure()
13+
14+
Attributes:
15+
__author__: Package author information.
16+
"""
17+
18+
__author__ = "Shawn Deng"

repo_scaffold/cli.py

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
"""Command Line Interface module for project scaffolding.
2+
3+
This module provides the CLI commands for creating new projects using cookiecutter
4+
templates. It serves as the main entry point for the repo_scaffold tool and handles
5+
all command-line interactions.
6+
7+
Typical usage example:
8+
9+
from repo_scaffold.cli import cli
10+
11+
if __name__ == '__main__':
12+
cli()
13+
14+
Attributes:
15+
cli: The main Click command group that serves as the entry point.
16+
"""
17+
18+
import os
19+
20+
import click
21+
from cookiecutter.main import cookiecutter
22+
23+
24+
@click.group()
25+
def cli():
26+
"""CLI tool for project creation.
27+
28+
This function serves as the main command group for the CLI application.
29+
It groups all subcommands and provides the base entry point for the tool.
30+
"""
31+
...
32+
33+
34+
@cli.command()
35+
@click.option(
36+
"--template",
37+
"-t",
38+
default="https://github.com/ShawnDen-coder/repo-template.git",
39+
help="Cookiecutter template URL or path",
40+
)
41+
@click.option("--output-dir", "-o", default=".", help="Where to output the generated project dir")
42+
@click.option("--local", "-l", is_flag=True, help="Use local template in ./template-python")
43+
def create(template, output_dir, local):
44+
"""Create a new project from a Cookiecutter template.
45+
46+
Args:
47+
template (str): URL or path to the cookiecutter template.
48+
output_dir (str): Directory where the generated project will be created.
49+
local (bool): Flag to use local template instead of remote.
50+
51+
Returns:
52+
None
53+
54+
Example:
55+
$ repo_scaffold create --template https://github.com/user/template.git
56+
$ repo_scaffold create --local --output-dir ./projects
57+
"""
58+
if local:
59+
template = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))
60+
61+
cookiecutter(template=template, output_dir=output_dir, no_input=False)
62+
63+
64+
if __name__ == "__main__":
65+
cli()

repo_scaffold/utils.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
"""Utility functions module for common operations.
2+
3+
This module contains reusable utility functions that can be used across the application.
4+
It provides helper methods, convenience functions, and shared functionality to promote
5+
code reuse and maintainability.
6+
7+
Typical usage example:
8+
9+
from repo_scaffold.utils import validate_input, format_output
10+
11+
cleaned_data = validate_input(raw_data)
12+
result = format_output(cleaned_data)
13+
14+
Note:
15+
All utility functions should be stateless and follow single responsibility principle.
16+
New utility functions should be well documented with type hints and docstrings.
17+
"""

repo_template/__init__.py

Whitespace-only changes.

repo_template/cli.py

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

repo_template/utils.py

Whitespace-only changes.

template-python/hooks/post_gen_project.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import os
22
import subprocess
3-
from githubkit import GitHub
43

54

65
def remove_cli():

0 commit comments

Comments
 (0)