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
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ jobs:
rm -rf src/serious_scaffold
rm -rf .github
rm -rf .gitlab-ci.yml
copier copy -x '!src/serious_scaffold' -d ci=both -r HEAD -f . .
copier copy -x '!src/serious_scaffold' -d repo_host_type=gitlab.com -r HEAD -f . .
rm .copier-answers.yml
copier copy -r HEAD -f . .
- run: git diff
- run: git status --porcelain
- run: |
Expand Down
6 changes: 5 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
"automodule",
"cobertura",
"codecov",
"elif",
"endmacro",
"epub",
"furo",
"huxuan",
Expand Down Expand Up @@ -79,6 +81,9 @@
"author_name",
"organization_name",
"author_email",
"repo_host_type",
"repo_host",
"ci",
"repo_namespace",
"repo_name",
"package_name",
Expand All @@ -87,7 +92,6 @@
"min_py",
"max_py",
"default_py",
"ci",
"choices",
"stages",
"default",
Expand Down
12 changes: 9 additions & 3 deletions README.md.jinja
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
[% from pathjoin("includes", "variable.jinja") import ci_badge with context -%]
[% from pathjoin("includes", "variable.jinja") import license_badge with context -%]
[% from pathjoin("includes", "variable.jinja") import repo_url with context -%]
# {{ project_name }}

{{ project_description }}

[![CI Status](https://github.com/{{ repo_namespace }}/{{ repo_name }}/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/{{ repo_namespace }}/{{ repo_name }}/actions/workflows/ci.yml)
{{ ci_badge() }}
[![codecov](https://codecov.io/gh/{{ repo_namespace }}/{{ repo_name }}/branch/main/graph/badge.svg?token=4JPKXI122N)](https://codecov.io/gh/{{ repo_namespace }}/{{ repo_name }})
[![Documentation Status](https://readthedocs.org/projects/{{ repo_name }}/badge/)](https://{{ repo_name }}.readthedocs.io/)
[![GitHub](https://img.shields.io/github/license/{{ repo_namespace }}/{{ repo_name }})](https://github.com/{{ repo_namespace }}/{{ repo_name }}/blob/main/LICENSE)
{{ license_badge() }}
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/{{ package_name }})](https://pypi.org/project/{{ package_name }}/)
[![PyPI](https://img.shields.io/pypi/v/{{ package_name }})](https://pypi.org/project/{{ package_name }}/)

Expand All @@ -16,12 +19,15 @@
[![Pydantic v2](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/pydantic/pydantic/5697b1e4c4a9790ece607654e6c02a160620c7e1/docs/badge/v2.json)](https://pydantic.dev)
[![Serious Scaffold Python](https://img.shields.io/badge/serious%20scaffold-python-blue)](https://github.com/serious-scaffold/serious-scaffold-python)

[![{{ project_name }}](docs/_static/images/logo.svg)](https://github.com/{{ repo_namespace }}/{{ repo_name }})
[![{{ project_name }}](docs/_static/images/logo.svg)](https://{{ repo_url() }})

Setting up a project often involves more than just establishing a basic project structure. It involves tasks like integrating GitHub Actions or GitLab CI/CD, configuring lint, test and documentation, as well as implementing settings, logging and other frequently used modules. [Serious Scaffold Python](https://github.com/serious-scaffold/serious-scaffold-python) streamlines this process. Powered by [`copier`](https://copier.readthedocs.io/), bootstrapping a new Python project can be done with a single command. By answering a few questions, the project will be fully configured and ready for development. Furthermore, the project can be updated alongside the advancement of the template.

[% if repo_host_type == 'github.com' -%]
If you find this helpful, please consider [sponsorship](https://github.com/sponsors/{{ author_name }}).

[% endif -%]

## :hammer_and_wrench: Features

- Project setup and template update with [`copier`](https://copier.readthedocs.io/).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ jobs:
rm -rf src/serious_scaffold
rm -rf .github
rm -rf .gitlab-ci.yml
copier copy -x '!src/serious_scaffold' -d ci=both -r HEAD -f . .
copier copy -x '!src/serious_scaffold' -d repo_host_type=gitlab.com -r HEAD -f . .
rm .copier-answers.yml
copier copy -r HEAD -f . .
- run: git diff
- run: git status --porcelain
- run: |
Expand Down
21 changes: 13 additions & 8 deletions copier.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,19 @@ author_email:
[%- endif %]
help: 'Specify the email address of the author:'
type: str
repo_host_type:
choices:
GitHub: github.com
GitLab: gitlab.com
GitLab (self-managed): gitlab-self-managed
default: github.com
help: 'Choose the host for the repository:'
type: str
repo_host:
default: '{{ repo_host_type }}'
help: 'Specify the host of the self-managed GitLab:'
type: str
when: '{{ repo_host_type == "gitlab-self-managed" }}'
repo_namespace:
default: '{{ organization_name|lower|replace(" ", "-") }}'
help: 'Indicate the GitHub Repository Owner or GitLab Namespace. This is typically the account name of the author or the organization:'
Expand Down Expand Up @@ -100,11 +113,3 @@ default_py:
default: '{{ max_py }}'
help: 'Choose the default Python version for development, documentation generation, and package build:'
type: str
ci:
choices:
Both (for test only): both
GitHub Actions: github
GitLab CI: gitlab
default: github
help: 'Choose the Continuous Integration service to use:'
type: str
28 changes: 28 additions & 0 deletions includes/variable.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[% macro repo_url() -%]
{{ repo_host }}/{{ repo_namespace }}/{{ repo_name }}
[%- endmacro %]

[% macro repo_base_url() -%]
[% if repo_host_type == 'github.com' -%]
{{ repo_url() }}
[%- elif repo_host_type == 'gitlab.com' or repo_host_type == 'gitlab-self-managed' -%]
{{ repo_url() }}/-
[%- endif %]
[%- endmacro %]

[% macro ci_badge() -%]
[% if repo_host_type == 'github.com' -%]
[![CI Status](https://{{ repo_url() }}/actions/workflows/ci.yml/badge.svg?branch=main)](https://{{ repo_url() }}/actions/workflows/ci.yml)
[%- elif repo_host_type == 'gitlab.com' or repo_host_type == 'gitlab-self-managed' -%]
[![pipeline status](https://{{ repo_url() }}/badges/main/pipeline.svg)](https://{{ repo_base_url() }}/commits/main)
[%- endif %]
[%- endmacro %]

[% macro license_badge() -%]
[% if repo_host_type == 'github.com' -%]
[![GitHub](https://img.shields.io/github/license/{{ repo_namespace }}/{{ repo_name }})]
[%- elif repo_host_type == 'gitlab.com' or repo_host_type == 'gitlab-self-managed' -%]
[![GitLab](https://img.shields.io/gitlab/license/{{ repo_namespace }}/{{ repo_name }}?gitlab_url=https%3A%2F%2F{{ repo_host }})]
[%- endif -%]
(https://{{ repo_base_url() }}/blob/main/LICENSE)
[%- endmacro %]
6 changes: 4 additions & 2 deletions pyproject.toml.jinja
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[% from pathjoin("includes", "variable.jinja") import repo_base_url with context -%]
[% from pathjoin("includes", "variable.jinja") import repo_url with context -%]
[% from pathjoin("includes", "version_compare.jinja") import version_between -%]
[build-system]
build-backend = "setuptools.build_meta"
Expand Down Expand Up @@ -45,8 +47,8 @@ requires-python = ">={{ min_py }}"
{{ package_name }}-cli = "{{ module_name }}.cli:app"

[project.urls]
homepage = "https://github.com/{{ repo_namespace }}/{{ repo_name }}/"
issue = "https://github.com/{{ repo_namespace }}/{{ repo_name }}/issues"
homepage = "https://{{ repo_url() }}/"
issue = "https://{{ repo_base_url() }}/issues"

[tool.coverage.report]
fail_under = {{ coverage_threshold }}
Expand Down