Skip to content

Commit f556c2a

Browse files
author
colyerdeng
committed
Initial commit
0 parents  commit f556c2a

File tree

23 files changed

+1443
-0
lines changed

23 files changed

+1443
-0
lines changed

.github/workflows/build.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: release-build
2+
on:
3+
push:
4+
tags:
5+
- '*.*.*'
6+
workflow_dispatch:
7+
8+
jobs:
9+
release-build:
10+
runs-on: windows-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: actions/setup-python@v5
14+
with:
15+
python-version: "3.12"
16+
- uses: abatilo/actions-poetry@v2
17+
with:
18+
poetry-version: "latest"
19+
20+
- name: install-poetry-plugins
21+
run: |
22+
poetry self add poetry-pyinstaller-plugin
23+
poetry self add poetry-plugin-taskipy
24+
25+
- name: build
26+
run: poetry build
27+
28+
- name: Release
29+
uses: softprops/action-gh-release@v2
30+
with:
31+
files: |
32+
dist/**/*.exe
33+
dist/*.tar.gz
34+
dist/*.whl
35+
generate_release_notes: true
36+
env:
37+
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}

.github/workflows/bumpversion.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Bump version
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
workflow_dispatch:
8+
9+
jobs:
10+
bump-version:
11+
if: "!startsWith(github.event.head_commit.message, 'bump:')"
12+
runs-on: ubuntu-latest
13+
name: "Bump version and create changelog with commitizen"
14+
steps:
15+
- name: Check out
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
token: '${{ secrets.PERSONAL_ACCESS_TOKEN }}'
20+
- name: Create bump and changelog
21+
uses: commitizen-tools/commitizen-action@master
22+
with:
23+
github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
24+
branch: master

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

cookiecutter.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"templates": {
3+
"template-python": {
4+
"path": "./template-python",
5+
"title": "python",
6+
"description": "A cookiecutter template for python project"
7+
}
8+
}
9+
}

poetry.lock

Lines changed: 1093 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
[tool.poetry]
2+
name = "repo-template"
3+
version = "0.1.0"
4+
description = "shawn deng repo temple project"
5+
authors = ["colyerdeng <[email protected]>"]
6+
license = "MIT"
7+
readme = "README.md"
8+
9+
[tool.poetry.dependencies]
10+
python = "^3.12"
11+
cookiecutter = "^2.6.0"
12+
click = "^8.1.8"
13+
githubkit = "^0.12.2"
14+
15+
[tool.poetry.group.dev.dependencies]
16+
ruff = "^0.8.4"
17+
pre-commit = "^4.0.1"
18+
commitizen = "^4.1.0"
19+
20+
[tool.poetry.scripts]
21+
repo-template = "repo_template.cli:cli"
22+
23+
[tool.ruff]
24+
line-length = 120
25+
include = ["pyproject.toml", "{{template-python}}/{{cookiecutter.project_slug}}/*.py"]
26+
27+
[tool.ruff.lint]
28+
select = [
29+
"E", # pycodestyle errors
30+
"W", # pycodestyle warnings
31+
"F", # pyflakes
32+
"I", # isort
33+
"B", # flake8-bugbear
34+
"C4", # flake8-comprehensions
35+
"D" # pydocstyle
36+
]
37+
38+
ignore = [
39+
"W191", # indentation contains tabs
40+
"D401" # imperative mood
41+
]
42+
43+
[tool.ruff.lint.isort]
44+
force-single-line = true
45+
lines-after-imports = 2
46+
47+
[tool.ruff.lint.pydocstyle]
48+
convention = "google"
49+
50+
[tool.commitizen]
51+
name = "cz_conventional_commits"
52+
tag_format = "$version"
53+
version_scheme = "semver2"
54+
version_provider = "poetry"
55+
update_changelog_on_bump = true
56+
major_version_zero = true
57+
58+
[build-system]
59+
requires = ["poetry-core"]
60+
build-backend = "poetry.core.masonry.api"

repo_template/__init__.py

Whitespace-only changes.

repo_template/cli.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import os
2+
3+
import click
4+
from cookiecutter.main import cookiecutter
5+
6+
7+
@click.group()
8+
def cli():
9+
"""CLI tool for project creation"""
10+
...
11+
12+
13+
@cli.command()
14+
@click.option('--template', '-t', default='https://github.com/your-template-repo.git',
15+
help='Cookiecutter template URL or path')
16+
@click.option('--output-dir', '-o', default='.', help='Where to output the generated project dir')
17+
@click.option('--local', '-l', is_flag=True, help='Use local template in ./template-python')
18+
def create(template, output_dir, local):
19+
"""Create a new project from a Cookiecutter template"""
20+
if local:
21+
template = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))
22+
23+
cookiecutter(
24+
template=template,
25+
output_dir=output_dir,
26+
no_input=False
27+
)
28+
29+
30+
if __name__ == '__main__':
31+
cli()

repo_template/utils.py

Whitespace-only changes.

template-python/cookiecutter.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"repo_name": "My-Package",
3+
"full_name": "Shawn Deng",
4+
"email": "[email protected]",
5+
"project_slug": "{{ cookiecutter.repo_name.strip().lower().replace(' ', '_') }}",
6+
"description": "A short description of the project.",
7+
"include_cli": {
8+
"__prompt__": "Include CLI interface? (y/n)",
9+
"__choices__": [
10+
"y",
11+
"n"
12+
]
13+
},
14+
"create_github_repo": {
15+
"__prompt__": "Create GitHub repo? Requires ~/.github/config.json with GitHub token (y/n)",
16+
"__choices__": [
17+
"y",
18+
"n"
19+
]
20+
}
21+
}

0 commit comments

Comments
 (0)