diff --git a/copier.yaml b/copier.yaml index b696ba20..c507272f 100644 --- a/copier.yaml +++ b/copier.yaml @@ -1,6 +1,8 @@ _envops: - block_end_string: '%]' - block_start_string: '[%' + block_end_string: "%]" + block_start_string: "[%" + lstrip_blocks: true + trim_blocks: true _subdirectory: template _message_before_copy: | Thanks for generating a project using our template. @@ -20,7 +22,7 @@ _message_after_update: | you're done. project_name: default: My Project - help: 'Enter the name of the project in CamelCase format:' + help: "Enter the name of the project in CamelCase format:" type: str project_description: default: Project brief description. @@ -32,7 +34,7 @@ development_status: - Alpha - Beta - Production/Stable - help: 'Choose the development status:' + help: "Choose the development status:" type: str copyright_license: default: MIT License @@ -53,19 +55,19 @@ copyright_year: type: str author_name: default: Your Name - help: 'Specify the name of the author:' + help: "Specify the name of the author:" type: str organization_name: default: Your Organization Name - help: 'Provide the name of the organization associated with the project:' + help: "Provide the name of the organization associated with the project:" type: str copyright_holder: - default: '{{ organization_name }}' + default: "{{ organization_name }}" help: Name(s) or organization(s) holding the copyright. type: str author_email: default: '{{ author_name|lower|replace(" ", ".") }}@{{ organization_name|lower|replace(" ", "-") }}.com' - help: 'Specify the email address of the author:' + help: "Specify the email address of the author:" type: str repo_platform: default: github @@ -73,45 +75,45 @@ repo_platform: GitHub: github GitLab: gitlab GitLab (self-managed): gitlab-self-managed - help: 'Choose the platform for the repository:' + help: "Choose the platform for the repository:" type: str repo_host: default: |- - [% if repo_platform == 'github' -%] - github.com - [%- elif repo_platform == 'gitlab' -%] - gitlab.com + [% if repo_platform == 'github' %] + github.com + [%- elif repo_platform == 'gitlab' %] + gitlab.com [%- endif %] - help: 'Specify the host of the self-managed GitLab:' + help: "Specify the host of the self-managed GitLab:" type: str when: '{{ repo_platform == "gitlab-self-managed" }}' page_host: default: |- - [% if repo_platform == 'github' -%] - github.io - [%- elif repo_platform == 'gitlab' -%] - gitlab.io + [% if repo_platform == 'github' %] + github.io + [%- elif repo_platform == 'gitlab' %] + gitlab.io [%- endif %] - help: 'Specify the host of the self-managed GitLab Pages:' + help: "Specify the host of the self-managed GitLab Pages:" type: str when: '{{ repo_platform == "gitlab-self-managed" }}' container_registry_host: default: |- - [% if repo_platform == 'github' -%] - ghcr.io - [%- elif repo_platform == 'gitlab' -%] - registry.gitlab.com + [% if repo_platform == 'github' %] + ghcr.io + [%- elif repo_platform == 'gitlab' %] + registry.gitlab.com [%- endif %] - help: 'Specify the host of the self-managed GitLab Container Registry:' + help: "Specify the host of the self-managed GitLab Container Registry:" type: str when: '{{ repo_platform == "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:' + help: "Indicate the GitHub Repository Owner or GitLab Namespace. This is typically the account name of the author or the organization:" type: str repo_name: default: '{{ project_name|lower|replace(" ", "-") }}' - help: 'Provide a name for the repository:' + help: "Provide a name for the repository:" type: str package_name: default: '{{ repo_name|regex_replace("-python$", "") }}' @@ -123,7 +125,7 @@ module_name: type: str coverage_threshold: default: 100 - help: 'Set the threshold for test coverage, ranging from 0 to 100:' + help: "Set the threshold for test coverage, ranging from 0 to 100:" type: int validator: "[% if not 0 <= coverage_threshold <= 100 %]Test Coverage threshold should be between 0 and 100[% endif %]" platforms: @@ -136,59 +138,59 @@ platforms: multiselect: true type: str min_py: - default: '3.12' + default: "3.12" choices: - - '3.9' - - '3.10' - - '3.11' - - '3.12' - - '3.13' - help: 'Choose the minimal Python version the project should support:' + - "3.9" + - "3.10" + - "3.11" + - "3.12" + - "3.13" + help: "Choose the minimal Python version the project should support:" type: str max_py: - default: '3.12' + default: "3.12" choices: - '3.9': + "3.9": validator: '[% from pathjoin("includes", "version_compare.jinja") import version_higher_than_validator %]{{ version_higher_than_validator("3.9", min_py) }}' - value: '3.9' - '3.10': + value: "3.9" + "3.10": validator: '[% from pathjoin("includes", "version_compare.jinja") import version_higher_than_validator %]{{ version_higher_than_validator("3.10", min_py) }}' - value: '3.10' - '3.11': + value: "3.10" + "3.11": validator: '[% from pathjoin("includes", "version_compare.jinja") import version_higher_than_validator %]{{ version_higher_than_validator("3.11", min_py) }}' - value: '3.11' - '3.12': + value: "3.11" + "3.12": validator: '[% from pathjoin("includes", "version_compare.jinja") import version_higher_than_validator %]{{ version_higher_than_validator("3.12", min_py) }}' - value: '3.12' - '3.13': - value: '3.13' - help: 'Choose the maximal Python version the project should support:' + value: "3.12" + "3.13": + value: "3.13" + help: "Choose the maximal Python version the project should support:" type: str default_py: - default: '{{ max_py }}' + default: "{{ max_py }}" choices: - '3.9': + "3.9": validator: '[% from pathjoin("includes", "version_compare.jinja") import version_between_validator %]{{ version_between_validator("3.9", min_py, max_py) }}' - value: '3.9' - '3.10': + value: "3.9" + "3.10": validator: '[% from pathjoin("includes", "version_compare.jinja") import version_between_validator %]{{ version_between_validator("3.10", min_py, max_py) }}' - value: '3.10' - '3.11': + value: "3.10" + "3.11": validator: '[% from pathjoin("includes", "version_compare.jinja") import version_between_validator %]{{ version_between_validator("3.11", min_py, max_py) }}' - value: '3.11' - '3.12': + value: "3.11" + "3.12": validator: '[% from pathjoin("includes", "version_compare.jinja") import version_between_validator %]{{ version_between_validator("3.12", min_py, max_py) }}' - value: '3.12' - '3.13': + value: "3.12" + "3.13": validator: '[% from pathjoin("includes", "version_compare.jinja") import version_between_validator %]{{ version_between_validator("3.13", min_py, max_py) }}' - value: '3.13' - help: 'Choose the default Python version for development, documentation generation, and package build:' + value: "3.13" + help: "Choose the default Python version for development, documentation generation, and package build:" type: str readme_content: default: |- - [% if project_name == 'Serious Scaffold Python' -%] - [% from pathjoin("includes", "sample.jinja") import readme_content with context %]{{ readme_content() }} - [%- else -%] + [% if project_name == 'Serious Scaffold Python' %] + [% from pathjoin("includes", "sample.jinja") import readme_content with context %]{{ readme_content() }} + [%- else %] ## A multiline README content here [%- endif %] help: "Provide a multiline content to be used in the README and documentation's index page:" diff --git a/includes/sample.jinja b/includes/sample.jinja index cb72c6b8..413f9d38 100644 --- a/includes/sample.jinja +++ b/includes/sample.jinja @@ -1,14 +1,13 @@ -[% macro readme_content() -%] -[% from pathjoin("includes", "variable.jinja") import page_url with context -%] -[% from pathjoin("includes", "variable.jinja") import repo_url with context -%] +[% macro readme_content() %] +[% from pathjoin("includes", "variable.jinja") import page_url with context %] +[% from pathjoin("includes", "variable.jinja") import repo_url with context %] [![{{ project_name }}](https://{{ page_url() }}/_static/images/logo.svg)](https://{{ repo_url() }}) Serious Scaffold Python is crafted for long-term, maintainable Python projects. It includes GitHub Actions and GitLab CI/CD, automated dependency updates via Renovate, and comprehensive linting, testing, and documentation. Key integrations like pdm for environment and dependency management, click for CLI development, and pydantic for configuration enhance project robustness. With copier’s easy project setup and continuous updating, your project stays aligned with best practices for sustainable development. Pre-configured dev containers and cross-platform CI support ensure maintainability from the start. -[% if repo_platform == 'github' -%] +[% if repo_platform == 'github' %] If you find this helpful, please consider [sponsorship](https://github.com/sponsors/{{ author_name }}). - -[% endif -%] +[% endif %] ## 🛠️ Features @@ -76,5 +75,4 @@ pipx install copier==9.4.1 ``` 1. That's it! Feel free to focus on the coding within `src` folder. - -[%- endmacro %] +[% endmacro %] diff --git a/includes/variable.jinja b/includes/variable.jinja index 8b73ca7e..4ba87b5a 100644 --- a/includes/variable.jinja +++ b/includes/variable.jinja @@ -1,75 +1,75 @@ -[% macro coverage_badge() -%] - [% if repo_platform == 'github' -%] +[% macro coverage_badge() %] + [% if repo_platform == 'github' %] [![Coverage](https://img.shields.io/endpoint?url=https://{{ page_url() }}/_static/badges/coverage.json)](https://{{ page_url() }}/reports/coverage) - [%- elif repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' -%] + [%- elif repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' %] [![coverage report](https://{{ repo_url() }}/badges/main/coverage.svg)](https://{{ repo_url() }}/-/commits/main) [%- endif %] -[%- endmacro %] +[% endmacro %] -[% macro license_badge() -%] - [% if repo_platform == 'github' -%] +[% macro license_badge() %] + [% if repo_platform == 'github' %] [![GitHub](https://img.shields.io/github/license/{{ repo_namespace }}/{{ repo_name }})]({{ license_url() }}) - [%- elif repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' -%] + [%- elif repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' %] [![GitLab](https://img.shields.io/gitlab/license/{{ repo_namespace }}/{{ repo_name }}?gitlab_url=https%3A%2F%2F{{ repo_host }})]({{ license_url() }}) - [%- endif -%] -[%- endmacro %] + [%- endif %] +[% endmacro %] -[% macro license_url() -%] - [% if repo_platform == 'github' -%] - https://{{ repo_url() }}/blob/main/LICENSE - [%- elif repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' -%] - https://{{ repo_url() }}/-/blob/main/LICENSE - [%- endif -%] -[%- endmacro %] +[% macro license_url() %] + [% if repo_platform == 'github' %] +https://{{ repo_url() }}/blob/main/LICENSE + [%- elif repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' %] +https://{{ repo_url() }}/-/blob/main/LICENSE + [%- endif %] +[% endmacro %] -[% macro logo_badge() -%] - [![Serious Scaffold Python]({{ logo_badge_url() }})](https://serious-scaffold.github.io/ss-python) +[% macro logo_badge() %] +[![Serious Scaffold Python]({{ logo_badge_url() }})](https://serious-scaffold.github.io/ss-python) [%- endmacro %] -[% macro logo_badge_url() -%] - https://img.shields.io/endpoint?url=https://serious-scaffold.github.io/ss-python/_static/badges/logo.json +[% macro logo_badge_url() %] +https://img.shields.io/endpoint?url=https://serious-scaffold.github.io/ss-python/_static/badges/logo.json [%- endmacro %] -[% macro page_url() -%] - [% if repo_platform == 'github' -%] - {{ repo_namespace }}.github.io/{{ repo_name }} - [%- elif repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' -%] - [%- set repo_namespace_root = repo_namespace.split("/")[0] -%] - {{ repo_namespace_root }}.{{ page_host }}{{ repo_namespace | replace(repo_namespace_root, "", 1) }}/{{ repo_name }} +[% macro page_url() %] + [% if repo_platform == 'github' %] +{{ repo_namespace }}.github.io/{{ repo_name }} + [%- elif repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' %] +[% set repo_namespace_root = repo_namespace.split("/")[0] %] +{{ repo_namespace_root }}.{{ page_host }}{{ repo_namespace | replace(repo_namespace_root, "", 1) }}/{{ repo_name }} [%- endif %] -[%- endmacro %] +[% endmacro %] -[% macro pipeline_badge() -%] - [% if repo_platform == 'github' -%] +[% macro pipeline_badge() %] +[% if repo_platform == 'github' %] [![CI](https://{{ repo_url() }}/actions/workflows/ci.yml/badge.svg)](https://{{ repo_url() }}/actions/workflows/ci.yml) [![CommitLint](https://{{ repo_url() }}/actions/workflows/commitlint.yml/badge.svg)](https://{{ repo_url() }}/actions/workflows/commitlint.yml) [![DevContainer](https://{{ repo_url() }}/actions/workflows/devcontainer.yml/badge.svg)](https://{{ repo_url() }}/actions/workflows/devcontainer.yml) [![Release](https://{{ repo_url() }}/actions/workflows/release.yml/badge.svg)](https://{{ repo_url() }}/actions/workflows/release.yml) [![Renovate](https://{{ repo_url() }}/actions/workflows/renovate.yml/badge.svg)](https://{{ repo_url() }}/actions/workflows/renovate.yml) [![Semantic Release](https://{{ repo_url() }}/actions/workflows/semantic-release.yml/badge.svg)](https://{{ repo_url() }}/actions/workflows/semantic-release.yml) - [%- elif repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' -%] + [%- elif repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' %] [![pipeline status](https://{{ repo_url() }}/badges/main/pipeline.svg)](https://{{ repo_url() }}/-/commits/main) [%- endif %] -[%- endmacro %] +[% endmacro %] -[% macro releases_url() -%] - [% if repo_platform == 'github' -%] - https://{{ repo_url() }}/releases - [%- elif repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' -%] - https://{{ repo_url() }}/-/releases - [%- endif -%] -[%- endmacro %] +[% macro releases_url() %] + [% if repo_platform == 'github' %] +https://{{ repo_url() }}/releases + [%- elif repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' %] +https://{{ repo_url() }}/-/releases + [%- endif %] +[% endmacro %] -[% macro release_badge() -%] - [% if repo_platform == 'github' -%] +[% macro release_badge() %] + [% if repo_platform == 'github' %] [![Release](https://img.shields.io/github/v/release/{{ repo_namespace }}/{{ repo_name }})] - [%- elif repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' -%] + [%- elif repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' %] [![Latest Release](https://{{ repo_url() }}/-/badges/release.svg)] - [%- endif -%] + [%- endif %] ({{ releases_url()}}) [![PyPI](https://img.shields.io/pypi/v/{{ package_name }})](https://pypi.org/project/{{ package_name }}/) [%- endmacro %] -[% macro repo_url() -%] - {{ repo_host }}/{{ repo_namespace }}/{{ repo_name }} +[% macro repo_url() %] +{{ repo_host }}/{{ repo_namespace }}/{{ repo_name }} [%- endmacro %] diff --git a/includes/version_compare.jinja b/includes/version_compare.jinja index 0fc94c36..2842f550 100644 --- a/includes/version_compare.jinja +++ b/includes/version_compare.jinja @@ -1,23 +1,23 @@ -[% macro version_higher_than(version1, version2) -%] - {{ "1" if version1.split(".") | map("int") | list >= version2.split(".") | map("int") | list }} +[% macro version_higher_than(version1, version2) %] +{{ "1" if version1.split(".") | map("int") | list >= version2.split(".") | map("int") | list }} [%- endmacro %] -[% macro version_higher_than_validator(version1, version2) -%] - {{ - "Invalid version. The version '%s' is not higher than '%s'." % (version1, version2) - if not version_higher_than(version1, version2) - }} +[% macro version_higher_than_validator(version1, version2) %] +{{ + "Invalid version. The version '%s' is not higher than '%s'." % (version1, version2) + if not version_higher_than(version1, version2) +}} [%- endmacro %] -[% macro version_between(version, version_min, version_max) -%] - {{ - "1" if version_min.split(".") | map("int") | list <= version.split(".") | map("int") | list <= version_max.split(".") | map("int") | list - }} +[% macro version_between(version, version_min, version_max) %] +{{ + "1" if version_min.split(".") | map("int") | list <= version.split(".") | map("int") | list <= version_max.split(".") | map("int") | list +}} [%- endmacro %] -[% macro version_between_validator(version, version_min, version_max) -%] - {{ - "Invalid version. The version '%s' is not between '%s' and '%s'." % (version, version_min, version_max) - if not version_between(version, version_min, version_max) - }} +[% macro version_between_validator(version, version_min, version_max) %] +{{ + "Invalid version. The version '%s' is not between '%s' and '%s'." % (version, version_min, version_max) + if not version_between(version, version_min, version_max) +}} [%- endmacro %] diff --git a/template/.gitignore.jinja b/template/.gitignore.jinja index 8f0885cc..42e61687 100644 --- a/template/.gitignore.jinja +++ b/template/.gitignore.jinja @@ -1,9 +1,9 @@ # Custom *.swp .DS_Store -[%- if project_name == "Serious Scaffold Python" %] +[% if project_name == "Serious Scaffold Python" %] .copier-answers.yml -[%- endif %] +[% endif %] Pipfile public diff --git a/template/.pre-commit-config.yaml.jinja b/template/.pre-commit-config.yaml.jinja index 217f0cf9..6270311e 100644 --- a/template/.pre-commit-config.yaml.jinja +++ b/template/.pre-commit-config.yaml.jinja @@ -1,4 +1,4 @@ -[% from pathjoin("includes", "version_compare.jinja") import version_between -%] +[% from pathjoin("includes", "version_compare.jinja") import version_between %] default_install_hook_types: - post-checkout - post-merge @@ -71,9 +71,9 @@ repos: name: mypy entry: pdm run python -m mypy language: system -[%- if project_name == 'Serious Scaffold Python' %] +[% if project_name == 'Serious Scaffold Python' %] exclude: ^template/.* -[%- endif %] +[% endif %] types_or: - python - pyi diff --git a/template/.releaserc.json.jinja b/template/.releaserc.json.jinja index b1fa5769..d1a60168 100644 --- a/template/.releaserc.json.jinja +++ b/template/.releaserc.json.jinja @@ -112,18 +112,18 @@ } } ], -[%- if repo_platform == 'github' %] +[% if repo_platform == 'github' %] "@semantic-release/github" -[%- elif repo_platform == 'gitlab' %] +[% elif repo_platform == 'gitlab' %] "@semantic-release/gitlab" -[%- elif repo_platform == 'gitlab-self-managed' %] +[% elif repo_platform == 'gitlab-self-managed' %] [ "@semantic-release/gitlab", { "gitlabUrl": "https://{{ repo_host }}" } ] -[%- endif %] +[% endif %] ], "preset": "conventionalcommits" } diff --git a/template/.renovaterc.json.jinja b/template/.renovaterc.json.jinja index 4567c3d2..9a13bf2d 100644 --- a/template/.renovaterc.json.jinja +++ b/template/.renovaterc.json.jinja @@ -1,4 +1,4 @@ -[% from pathjoin("includes", "version_compare.jinja") import version_higher_than -%] +[% from pathjoin("includes", "version_compare.jinja") import version_higher_than %] { "$schema": "https://docs.renovatebot.com/renovate-schema.json", "constraints": { @@ -28,7 +28,7 @@ "^template/\\.readthedocs\\.yaml\\.jinja$", "^template/\\.renovaterc\\.json\\.jinja$", "^template/docs/.+\\.md(\\.jinja)?$" -[%- endif %] +[% endif %] ], "matchStrings": [ "pip install.* (?.*?)(\\[.*?\\])?==(?.*?)[\"\n]", @@ -44,7 +44,7 @@ "^\\.devcontainer\\/Dockerfile$" [%- if project_name == "Serious Scaffold Python" %], "^template\\/\\.devcontainer/Dockerfile\\.jinja$" -[%- endif %] +[% endif %] ], "matchStrings": [ "# renovate: depName=(?.*?)\nARG .*?_VERSION=\"(?.*)\"\n" @@ -60,7 +60,7 @@ "^\\.github/workflows/.+\\.yml$" [%- if project_name == "Serious Scaffold Python" %], "^template/.*\\.github.*/workflows/.+\\.yml(\\.jinja)?$" -[%- endif %] +[% endif %] ], "matchStrings": [ "uses: pdm-project/setup-pdm[\\s\\S]+?\\sversion: (?.*)\n" @@ -75,7 +75,7 @@ "^\\.renovaterc\\.json$" [%- if project_name == "Serious Scaffold Python" %], "^template/\\.renovaterc\\.json\\.jinja$" -[%- endif %] +[% endif %] ], "matchStrings": [ "\"pdm\": \"(?.*)\"" @@ -105,7 +105,7 @@ [%- if project_name == "Serious Scaffold Python" %], "^template/.*\\.github.*/workflows/.+\\.yml(\\.jinja)?$", "^template/.*\\.gitlab.*/workflows/.+\\.yml(\\.jinja)?$" -[%- endif %] +[% endif %] ], "matchStrings": [ "--package (?.+?)@(?.+?)\\s" @@ -133,15 +133,15 @@ ":maintainLockFilesWeekly", ":semanticCommitTypeAll(build)" ], -[%- if repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' or project_name == 'Serious Scaffold Python' %] +[% if repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' or project_name == 'Serious Scaffold Python' %] "gitlabci": { "fileMatch": [ "^.gitlab/workflows/.*\\.yml$" ] }, -[%- endif %] +[% endif %] "packageRules": [ -[%- if project_name == "Serious Scaffold Python" %] +[% if project_name == "Serious Scaffold Python" %] { "description": "Update GitHub Action in template", "matchDepTypes": [ @@ -203,7 +203,7 @@ ] } }, -[%- endif %] +[% endif %] { "commitMessageTopic": "serious-scaffold-python", "description": "Update template with copier when a new version is released", @@ -238,12 +238,12 @@ "github-tags" ], "matchDepNames": [ -[%- if repo_platform == "github" %] +[% if repo_platform == "github" %] "ghcr.io/renovatebot/renovate", -[%- endif %] -[%- if repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' or project_name == 'Serious Scaffold Python' %] +[% endif %] +[% if repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' or project_name == 'Serious Scaffold Python' %] "renovate/renovate", -[%- endif %] +[% endif %] "renovatebot/pre-commit-hooks" ] }, diff --git a/template/LICENSE.jinja b/template/LICENSE.jinja index a635cc09..95961d43 100644 --- a/template/LICENSE.jinja +++ b/template/LICENSE.jinja @@ -1,2 +1,2 @@ -[%- set license_template = 'includes/licenses/' + copyright_license + '.jinja' -%] -[%- include license_template -%] +[% set license_template = 'includes/licenses/' + copyright_license + '.jinja' %] +[% include license_template %] diff --git a/template/Makefile.jinja b/template/Makefile.jinja index 70d7c56e..47cce0a5 100644 --- a/template/Makefile.jinja +++ b/template/Makefile.jinja @@ -1,6 +1,8 @@ -[% from pathjoin("includes", "variable.jinja") import page_url with context -%] +[% from pathjoin("includes", "variable.jinja") import page_url with context %] .PHONY: clean deepclean install dev prerequisites mypy ruff ruff-format pyproject-fmt codespell lint pre-commit test-run test build publish doc-watch doc-build doc-coverage doc -[%- if project_name == "Serious Scaffold Python" %] template-watch template-build[% endif %] +[%- if project_name == "Serious Scaffold Python" %] + template-watch template-build +[% endif %] ######################################################################################## # Variables @@ -97,12 +99,12 @@ codespell: # Check jsonschema with check-jsonschema. check-jsonschema: -[%- if repo_platform == "github" %] +[% if repo_platform == "github" %] check-jsonschema --builtin-schema vendor.github-workflows .github/workflows/*.yml -[%- endif %] -[%- if repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' or project_name == "Serious Scaffold Python" %] +[% endif %] +[% if repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' or project_name == "Serious Scaffold Python" %] check-jsonschema --builtin-schema vendor.gitlab-ci --data-transform gitlab-ci .gitlab-ci.yml .gitlab/workflows/*.yml -[%- endif %] +[% endif %] check-jsonschema --builtin-schema vendor.readthedocs .readthedocs.yaml check-jsonschema --builtin-schema vendor.renovate .renovaterc.json @@ -160,7 +162,7 @@ doc-coverage: test-run # Generate all documentation with reports. doc: doc-build mypy doc-coverage -[% if project_name == "Serious Scaffold Python" -%] +[% if project_name == "Serious Scaffold Python" %] ######################################################################################## # Template ######################################################################################## @@ -175,7 +177,7 @@ template-build: copier copy -r HEAD --data-file includes/copier-answers-sample.yml -f . . rm -rf .copier-answers.yml -[% endif -%] +[% endif %] ######################################################################################## # End ######################################################################################## diff --git a/template/README.md.jinja b/template/README.md.jinja index fc36e16e..9ba0aea4 100644 --- a/template/README.md.jinja +++ b/template/README.md.jinja @@ -1,12 +1,12 @@ -[% from pathjoin("includes", "variable.jinja") import coverage_badge with context -%] -[% from pathjoin("includes", "variable.jinja") import license_badge with context -%] -[% from pathjoin("includes", "variable.jinja") import license_url with context -%] -[% from pathjoin("includes", "variable.jinja") import logo_badge with context -%] -[% from pathjoin("includes", "variable.jinja") import logo_badge_url with context -%] -[% from pathjoin("includes", "variable.jinja") import page_url with context -%] -[% from pathjoin("includes", "variable.jinja") import pipeline_badge with context -%] -[% from pathjoin("includes", "variable.jinja") import release_badge with context -%] -[% from pathjoin("includes", "variable.jinja") import repo_url with context -%] +[% from pathjoin("includes", "variable.jinja") import coverage_badge with context %] +[% from pathjoin("includes", "variable.jinja") import license_badge with context %] +[% from pathjoin("includes", "variable.jinja") import license_url with context %] +[% from pathjoin("includes", "variable.jinja") import logo_badge with context %] +[% from pathjoin("includes", "variable.jinja") import logo_badge_url with context %] +[% from pathjoin("includes", "variable.jinja") import page_url with context %] +[% from pathjoin("includes", "variable.jinja") import pipeline_badge with context %] +[% from pathjoin("includes", "variable.jinja") import release_badge with context %] +[% from pathjoin("includes", "variable.jinja") import repo_url with context %] # {{ project_name }} {{ project_description }} @@ -27,23 +27,22 @@ {{ logo_badge() }} [![Open in Dev Containers](https://img.shields.io/static/v1?label=Dev%20Containers&message=Open&color=blue&logo=visualstudiocode)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://{{ repo_url() }}) -[% if development_status == "Alpha" -%] +[% if development_status == "Alpha" %] > [!WARNING] -[% elif development_status == "Beta" -%] +[% elif development_status == "Beta" %] > [!IMPORTANT] -[% elif development_status == "Stable" -%] +[% elif development_status == "Stable" %] > [!NOTE] -[% endif -%] +[% endif %] > _{{ project_name }}_ is in the **{{ development_status }}** phase. -[%- if development_status == "Alpha" %] +[% if development_status == "Alpha" %] > Frequent changes and instability should be anticipated. -[%- elif development_status == "Beta" %] +[% elif development_status == "Beta" %] > Changes and potential instability should be anticipated. -[%- endif %] +[% endif %] > Any feedback, comments, suggestions and contributions are welcome! {{ readme_content }} - ## 📜 License {{ copyright_license }}, for more details, see the [LICENSE]({{ license_url() }}) file. diff --git a/template/[% if repo_platform == 'github' %].github[% endif %]/workflows/ci.yml.jinja b/template/[% if repo_platform == 'github' %].github[% endif %]/workflows/ci.yml.jinja index 0e71400a..8007c885 100644 --- a/template/[% if repo_platform == 'github' %].github[% endif %]/workflows/ci.yml.jinja +++ b/template/[% if repo_platform == 'github' %].github[% endif %]/workflows/ci.yml.jinja @@ -1,4 +1,4 @@ -[% from pathjoin("includes", "version_compare.jinja") import version_between -%] +[% from pathjoin("includes", "version_compare.jinja") import version_between %] name: CI on: @@ -36,35 +36,35 @@ jobs: strategy: matrix: os: -[%- if "macos" in platforms %] +[% if "macos" in platforms %] # renovate: github-runner - macos-14 -[%- endif %] -[%- if "ubuntu" in platforms %] +[% endif %] +[% if "ubuntu" in platforms %] # renovate: github-runner - ubuntu-24.04 -[%- endif %] -[%- if "windows" in platforms %] +[% endif %] +[% if "windows" in platforms %] # renovate: github-runner - windows-2022 -[%- endif %] +[% endif %] python-version: -[%- if version_between("3.9", min_py, max_py) %] +[% if version_between("3.9", min_py, max_py) %] - '3.9' -[%- endif %] -[%- if version_between("3.10", min_py, max_py) %] +[% endif %] +[% if version_between("3.10", min_py, max_py) %] - '3.10' -[%- endif %] -[%- if version_between("3.11", min_py, max_py) %] +[% endif %] +[% if version_between("3.11", min_py, max_py) %] - '3.11' -[%- endif %] -[%- if version_between("3.12", min_py, max_py) %] +[% endif %] +[% if version_between("3.12", min_py, max_py) %] - '3.12' -[%- endif %] -[%- if version_between("3.13", min_py, max_py) %] +[% endif %] +[% if version_between("3.13", min_py, max_py) %] - '3.13' -[%- endif %] -[%- if project_name == "Serious Scaffold Python" %] +[% endif %] +[% if project_name == "Serious Scaffold Python" %] consistency: if: {{ '${{ !cancelled() && ! failure() }}' }} runs-on: ubuntu-24.04 @@ -81,4 +81,4 @@ jobs: - run: git diff - run: git status --porcelain - run: test -z "$(git status --porcelain)" -[%- endif %] +[% endif %] diff --git a/template/[% if repo_platform == 'github' %].github[% endif %]/workflows/devcontainer.yml.jinja b/template/[% if repo_platform == 'github' %].github[% endif %]/workflows/devcontainer.yml.jinja index ce6835fe..07c5aa8d 100644 --- a/template/[% if repo_platform == 'github' %].github[% endif %]/workflows/devcontainer.yml.jinja +++ b/template/[% if repo_platform == 'github' %].github[% endif %]/workflows/devcontainer.yml.jinja @@ -1,4 +1,4 @@ -[% from pathjoin("includes", "version_compare.jinja") import version_between -%] +[% from pathjoin("includes", "version_compare.jinja") import version_between %] name: DevContainer on: @@ -77,18 +77,18 @@ jobs: strategy: matrix: python-version: -[%- if version_between("3.9", min_py, max_py) %] +[% if version_between("3.9", min_py, max_py) %] - '3.9' -[%- endif %] -[%- if version_between("3.10", min_py, max_py) %] +[% endif %] +[% if version_between("3.10", min_py, max_py) %] - '3.10' -[%- endif %] -[%- if version_between("3.11", min_py, max_py) %] +[% endif %] +[% if version_between("3.11", min_py, max_py) %] - '3.11' -[%- endif %] -[%- if version_between("3.12", min_py, max_py) %] +[% endif %] +[% if version_between("3.12", min_py, max_py) %] - '3.12' -[%- endif %] -[%- if version_between("3.13", min_py, max_py) %] +[% endif %] +[% if version_between("3.13", min_py, max_py) %] - '3.13' -[%- endif %] +[% endif %] diff --git a/template/[% if repo_platform == 'github' %].github[% endif %]/workflows/release.yml.jinja b/template/[% if repo_platform == 'github' %].github[% endif %]/workflows/release.yml.jinja index abde406e..a252d631 100644 --- a/template/[% if repo_platform == 'github' %].github[% endif %]/workflows/release.yml.jinja +++ b/template/[% if repo_platform == 'github' %].github[% endif %]/workflows/release.yml.jinja @@ -1,4 +1,4 @@ -[% from pathjoin("includes", "version_compare.jinja") import version_between -%] +[% from pathjoin("includes", "version_compare.jinja") import version_between %] name: Release on: @@ -112,21 +112,21 @@ jobs: strategy: matrix: python-version: -[%- if version_between("3.9", min_py, max_py) %] +[% if version_between("3.9", min_py, max_py) %] - '3.9' -[%- endif %] -[%- if version_between("3.10", min_py, max_py) %] +[% endif %] +[% if version_between("3.10", min_py, max_py) %] - '3.10' -[%- endif %] -[%- if version_between("3.11", min_py, max_py) %] +[% endif %] +[% if version_between("3.11", min_py, max_py) %] - '3.11' -[%- endif %] -[%- if version_between("3.12", min_py, max_py) %] +[% endif %] +[% if version_between("3.12", min_py, max_py) %] - '3.12' -[%- endif %] -[%- if version_between("3.13", min_py, max_py) %] +[% endif %] +[% if version_between("3.13", min_py, max_py) %] - '3.13' -[%- endif %] +[% endif %] package-publish: runs-on: ubuntu-24.04 steps: diff --git a/template/[% if repo_platform == 'github' %].github[% endif %]/workflows/renovate.yml.jinja b/template/[% if repo_platform == 'github' %].github[% endif %]/workflows/renovate.yml.jinja index aa938e9a..f0bbfdf9 100644 --- a/template/[% if repo_platform == 'github' %].github[% endif %]/workflows/renovate.yml.jinja +++ b/template/[% if repo_platform == 'github' %].github[% endif %]/workflows/renovate.yml.jinja @@ -7,11 +7,11 @@ jobs: RENOVATE_ALLOWED_POST_UPGRADE_COMMANDS: '["^git", "^pip", "^copier", "^find"]' RENOVATE_BRANCH_PREFIX: renovate-github/ RENOVATE_ENABLED: {{ '${{ vars.RENOVATE_ENABLED || true }}' }} -[%- if project_name == "Serious Scaffold Python" %] +[% if project_name == "Serious Scaffold Python" %] RENOVATE_ENABLED_MANAGERS: '["pep621", "github-actions", "gitlabci", "regex", "pre-commit"]' -[%- else %] +[% else %] RENOVATE_ENABLED_MANAGERS: '["pep621", "github-actions", "regex", "pre-commit"]' -[%- endif %] +[% endif %] RENOVATE_OPTIMIZE_FOR_DISABLED: 'true' RENOVATE_PLATFORM: github RENOVATE_REPOSITORIES: '["{{ '${{ github.repository }}' }}"]' diff --git a/template/[% if repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' %].gitlab[% endif %]/workflows/ci.yml.jinja b/template/[% if repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' %].gitlab[% endif %]/workflows/ci.yml.jinja index 661aad46..58e14fcf 100644 --- a/template/[% if repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' %].gitlab[% endif %]/workflows/ci.yml.jinja +++ b/template/[% if repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' %].gitlab[% endif %]/workflows/ci.yml.jinja @@ -1,4 +1,4 @@ -[% from pathjoin("includes", "version_compare.jinja") import version_between -%] +[% from pathjoin("includes", "version_compare.jinja") import version_between %] ci: artifacts: reports: @@ -19,21 +19,21 @@ ci: parallel: matrix: - PYTHON_VERSION: -[%- if version_between("3.9", min_py, max_py) %] +[% if version_between("3.9", min_py, max_py) %] - '3.9' -[%- endif %] -[%- if version_between("3.10", min_py, max_py) %] +[% endif %] +[% if version_between("3.10", min_py, max_py) %] - '3.10' -[%- endif %] -[%- if version_between("3.11", min_py, max_py) %] +[% endif %] +[% if version_between("3.11", min_py, max_py) %] - '3.11' -[%- endif %] -[%- if version_between("3.12", min_py, max_py) %] +[% endif %] +[% if version_between("3.12", min_py, max_py) %] - '3.12' -[%- endif %] -[%- if version_between("3.13", min_py, max_py) %] +[% endif %] +[% if version_between("3.13", min_py, max_py) %] - '3.13' -[%- endif %] +[% endif %] rules: - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == "push" - if: $CI_PIPELINE_SOURCE == 'merge_request_event' @@ -42,7 +42,7 @@ ci: - make dev - make lint test doc build stage: ci -[%- if project_name == 'Serious Scaffold Python' %] +[% if project_name == 'Serious Scaffold Python' %] consistency: interruptible: true rules: @@ -57,4 +57,4 @@ consistency: - git status --porcelain - test -z "$(git status --porcelain)" stage: ci -[%- endif %] +[% endif %] diff --git a/template/[% if repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' %].gitlab[% endif %]/workflows/devcontainer.yml.jinja b/template/[% if repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' %].gitlab[% endif %]/workflows/devcontainer.yml.jinja index 3a2e3427..abe36fb8 100644 --- a/template/[% if repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' %].gitlab[% endif %]/workflows/devcontainer.yml.jinja +++ b/template/[% if repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' %].gitlab[% endif %]/workflows/devcontainer.yml.jinja @@ -1,24 +1,24 @@ -[% from pathjoin("includes", "version_compare.jinja") import version_between -%] +[% from pathjoin("includes", "version_compare.jinja") import version_between %] dev-container-publish: image: docker:27.3.1@sha256:bec82cb05983f12a14d8f169b00748f4ded8573f4da5f1d15d375b6a2470289f parallel: matrix: - PYTHON_VERSION: -[%- if version_between("3.9", min_py, max_py) %] +[% if version_between("3.9", min_py, max_py) %] - '3.9' -[%- endif %] -[%- if version_between("3.10", min_py, max_py) %] +[% endif %] +[% if version_between("3.10", min_py, max_py) %] - '3.10' -[%- endif %] -[%- if version_between("3.11", min_py, max_py) %] +[% endif %] +[% if version_between("3.11", min_py, max_py) %] - '3.11' -[%- endif %] -[%- if version_between("3.12", min_py, max_py) %] +[% endif %] +[% if version_between("3.12", min_py, max_py) %] - '3.12' -[%- endif %] -[%- if version_between("3.13", min_py, max_py) %] +[% endif %] +[% if version_between("3.13", min_py, max_py) %] - '3.13' -[%- endif %] +[% endif %] rules: - changes: - .devcontainer/Dockerfile diff --git a/template/[% if repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' %].gitlab[% endif %]/workflows/release.yml.jinja b/template/[% if repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' %].gitlab[% endif %]/workflows/release.yml.jinja index f1e3b5b1..f61e485f 100644 --- a/template/[% if repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' %].gitlab[% endif %]/workflows/release.yml.jinja +++ b/template/[% if repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' %].gitlab[% endif %]/workflows/release.yml.jinja @@ -1,4 +1,4 @@ -[% from pathjoin("includes", "version_compare.jinja") import version_between -%] +[% from pathjoin("includes", "version_compare.jinja") import version_between %] pages-build: artifacts: paths: @@ -36,21 +36,21 @@ container-publish: parallel: matrix: - PYTHON_VERSION: -[%- if version_between("3.9", min_py, max_py) %] +[% if version_between("3.9", min_py, max_py) %] - '3.9' -[%- endif %] -[%- if version_between("3.10", min_py, max_py) %] +[% endif %] +[% if version_between("3.10", min_py, max_py) %] - '3.10' -[%- endif %] -[%- if version_between("3.11", min_py, max_py) %] +[% endif %] +[% if version_between("3.11", min_py, max_py) %] - '3.11' -[%- endif %] -[%- if version_between("3.12", min_py, max_py) %] +[% endif %] +[% if version_between("3.12", min_py, max_py) %] - '3.12' -[%- endif %] -[%- if version_between("3.13", min_py, max_py) %] +[% endif %] +[% if version_between("3.13", min_py, max_py) %] - '3.13' -[%- endif %] +[% endif %] rules: - if: $CI_COMMIT_TAG =~ /^v?(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-?(a|b|rc)(0|[1-9][0-9]*)?)?$/ script: diff --git a/template/docs/advanced/cicd.md.jinja b/template/docs/advanced/cicd.md.jinja index e2a8e84a..eec65cc2 100644 --- a/template/docs/advanced/cicd.md.jinja +++ b/template/docs/advanced/cicd.md.jinja @@ -10,23 +10,21 @@ The `ci` workflow is the most frequently used workflow, running on all pull/merg The `commitlint` workflow checks whether the pull/merge request title comply with the . This ensures consistent commit history and enable the possibility of automated release pipeline. -[% if repo_platform == 'github' -%] +[% if repo_platform == 'github' %] ## `delete-untagged-packages.yml` The `delete-untagged-packages` workflow removes untagged packages since GitHub will still keep the package when overridden with the same tag. It helps keep the GitHub Packages clean and tidy. - -[% endif -%] +[% endif %] ## `devcontainer.yml` The `devcontainer` workflow will be triggered by container related changes. It builds and tests the development and production containers and push the development container except during pull/merge requests, ensuring seamless containerized environments. -[% if repo_platform == 'github' -%] +[% if repo_platform == 'github' %] ## `readthedocs-preview.yml` The `readthedocs-preview` workflow leverage the [readthedocs/actions/preview](https://github.com/readthedocs/actions/tree/v1/preview) to add Read the Docs preview links to the related pull requests. These links make it easy to review documentation changes. - -[% endif -%] +[% endif %] ## `release.yml` diff --git a/template/docs/conf.py.jinja b/template/docs/conf.py.jinja index e6c51948..5c504533 100644 --- a/template/docs/conf.py.jinja +++ b/template/docs/conf.py.jinja @@ -38,11 +38,11 @@ html_theme_options = { "announcement": ( "{{ project_name }} " "is in the {{ development_status }} phase. " -[%- if development_status == "Alpha" %] +[% if development_status == "Alpha" %] "Frequent changes and instability should be anticipated. " -[%- elif development_status == "Beta" %] +[% elif development_status == "Beta" %] "Changes and potential instability should be anticipated. " -[%- endif %] +[% endif %] "Any feedback, comments, suggestions and contributions are welcome!" ), } diff --git a/template/docs/development/git-workflow.md.jinja b/template/docs/development/git-workflow.md.jinja index b509b581..3146b7f5 100644 --- a/template/docs/development/git-workflow.md.jinja +++ b/template/docs/development/git-workflow.md.jinja @@ -1,4 +1,4 @@ -[% from pathjoin("includes", "variable.jinja") import repo_url with context -%] +[% from pathjoin("includes", "variable.jinja") import repo_url with context %] # Git Workflow This pages shows the recommended Git workflow to keep the local repository clean and organized while ensuring smooth collaboration among team members. diff --git a/template/docs/index.md.jinja b/template/docs/index.md.jinja index c882388a..fc8a9197 100644 --- a/template/docs/index.md.jinja +++ b/template/docs/index.md.jinja @@ -1,4 +1,4 @@ -[% from pathjoin("includes", "variable.jinja") import releases_url with context -%] +[% from pathjoin("includes", "variable.jinja") import releases_url with context %] # Welcome to {{ project_name }}'s documentation ```{toctree} diff --git a/template/docs/management/init.md.jinja b/template/docs/management/init.md.jinja index eedcfa2e..225a8553 100644 --- a/template/docs/management/init.md.jinja +++ b/template/docs/management/init.md.jinja @@ -1,4 +1,4 @@ -[% from pathjoin("includes", "variable.jinja") import repo_url with context -%] +[% from pathjoin("includes", "variable.jinja") import repo_url with context %] # Project Initialization ## Prerequisites diff --git a/template/pyproject.toml.jinja b/template/pyproject.toml.jinja index f2272aa5..a2a46486 100644 --- a/template/pyproject.toml.jinja +++ b/template/pyproject.toml.jinja @@ -1,6 +1,6 @@ -[% from pathjoin("includes", "variable.jinja") import page_url with context -%] -[% from pathjoin("includes", "variable.jinja") import repo_url with context -%] -[% from pathjoin("includes", "version_compare.jinja") import version_between -%] +[% from pathjoin("includes", "variable.jinja") import page_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" requires = [ @@ -18,53 +18,53 @@ keywords = [ "project-template", "serious-scaffold", ] -[%- if copyright_license == "Apache Software License" %] +[% if copyright_license == "Apache Software License" %] license = { text = "Apache-2.0" } -[%- elif copyright_license == "Boost Software License 1.0 (BSL-1.0)" %] +[% elif copyright_license == "Boost Software License 1.0 (BSL-1.0)" %] license = { text = "BSL-1.0" } -[%- elif copyright_license == "GNU Affero General Public License v3" %] +[% elif copyright_license == "GNU Affero General Public License v3" %] license = { text = "AGPLv3" } -[%- elif copyright_license == "GNU General Public License v3 (GPLv3)" %] +[% elif copyright_license == "GNU General Public License v3 (GPLv3)" %] license = { text = "GPLv3" } -[%- elif copyright_license == "GNU Lesser General Public License v3 (LGPLv3)" %] +[% elif copyright_license == "GNU Lesser General Public License v3 (LGPLv3)" %] license = { text = "LGPLv3" } -[%- elif copyright_license == "MIT License" %] +[% elif copyright_license == "MIT License" %] license = { text = "MIT" } -[%- elif copyright_license == "Mozilla Public License 2.0 (MPL 2.0)" %] +[% elif copyright_license == "Mozilla Public License 2.0 (MPL 2.0)" %] license = { text = "MPL-2.0" } -[%- elif copyright_license == "The Unlicense (Unlicense)" %] +[% elif copyright_license == "The Unlicense (Unlicense)" %] license = { text = "Unlicense" } -[%- endif %] +[% endif %] authors = [ { email = "{{ author_email }}", name = "{{ author_name }}" }, ] requires-python = ">={{ min_py }}" classifiers = [ -[%- if development_status == "Alpha" %] +[% if development_status == "Alpha" %] "Development Status :: 3 - Alpha", -[%- elif development_status == "Beta" %] +[% elif development_status == "Beta" %] "Development Status :: 4 - Beta", -[%- elif development_status == "Stable" %] +[% elif development_status == "Stable" %] "Development Status :: 5 - Production/Stable", -[%- endif %] +[% endif %] "License :: OSI Approved :: {{ copyright_license }}", "Operating System :: OS Independent", "Programming Language :: Python :: 3 :: Only", -[%- if version_between("3.9", min_py, max_py) %] +[% if version_between("3.9", min_py, max_py) %] "Programming Language :: Python :: 3.9", -[%- endif %] -[%- if version_between("3.10", min_py, max_py) %] +[% endif %] +[% if version_between("3.10", min_py, max_py) %] "Programming Language :: Python :: 3.10", -[%- endif %] -[%- if version_between("3.11", min_py, max_py) %] +[% endif %] +[% if version_between("3.11", min_py, max_py) %] "Programming Language :: Python :: 3.11", -[%- endif %] -[%- if version_between("3.12", min_py, max_py) %] +[% endif %] +[% if version_between("3.12", min_py, max_py) %] "Programming Language :: Python :: 3.12", -[%- endif %] -[%- if version_between("3.13", min_py, max_py) %] +[% endif %] +[% if version_between("3.13", min_py, max_py) %] "Programming Language :: Python :: 3.13", -[%- endif %] +[% endif %] ] dynamic = [ "version", @@ -74,11 +74,11 @@ dependencies = [ "pydantic-settings", ] urls.documentation = "https://{{ page_url() }}" -[% if repo_platform == 'github' -%] +[% if repo_platform == 'github' %] urls.issue = "https://{{ repo_url() }}/issues" -[%- elif repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' -%] +[% elif repo_platform == 'gitlab' or repo_platform == 'gitlab-self-managed' %] urls.issue = "https://{{ repo_url() }}/-/issues" -[%- endif %] +[% endif %] urls.repository = "https://{{ repo_url() }}" scripts.{{ package_name }}-cli = "{{ module_name }}.cli:cli" @@ -112,11 +112,11 @@ fallback_version = "0.0.0" src = [ "src", ] -[% if project_name == "Serious Scaffold Python" -%] +[% if project_name == "Serious Scaffold Python" %] extend-exclude = [ "template", ] -[%- endif %] +[% endif %] fix = true lint.select = [ "B", # flake8-bugbear @@ -170,9 +170,9 @@ enable_error_code = [ exclude = [ "build", "doc", -[%- if project_name == "Serious Scaffold Python" %] +[% if project_name == "Serious Scaffold Python" %] "template", -[%- endif %] +[% endif %] ] no_implicit_optional = true show_error_codes = true diff --git a/template/src/{{ module_name }}/settings.py.jinja b/template/src/{{ module_name }}/settings.py.jinja index 68f6bd88..68d38a3c 100644 --- a/template/src/{{ module_name }}/settings.py.jinja +++ b/template/src/{{ module_name }}/settings.py.jinja @@ -1,11 +1,11 @@ -[% from pathjoin("includes", "version_compare.jinja") import version_higher_than -%] +[% from pathjoin("includes", "version_compare.jinja") import version_higher_than %] """Settings Module.""" import logging from logging import getLevelName -[%- if not version_higher_than(min_py, "3.10") %] +[% if not version_higher_than(min_py, "3.10") %] from typing import Optional -[%- endif %] +[% endif %] from pydantic_settings import BaseSettings, SettingsConfigDict @@ -20,14 +20,11 @@ class GlobalSettings(BaseSettings): class Settings(BaseSettings): """Project specific settings.""" - [%- if not version_higher_than(min_py, "3.10") %] - +[% if not version_higher_than(min_py, "3.10") %] logging_level: Optional[str] = getLevelName(logging.INFO) - - [%- else %] - +[% else %] logging_level: str | None = getLevelName(logging.INFO) - [%- endif %] +[% endif %] """Default logging level for the project.""" model_config = SettingsConfigDict(