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
24 changes: 12 additions & 12 deletions .github/workflows/ci.yml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ jobs:
strategy:
matrix:
python-version:
{%- if version_between("3.8", minimal_python_version, maximal_python_version) | bool %}
{%- if version_between("3.8", min_py, max_py) %}
- '3.8'
{%- endif %}
{%- if version_between("3.9", minimal_python_version, maximal_python_version) | bool %}
{%- if version_between("3.9", min_py, max_py) %}
- '3.9'
{%- endif %}
{%- if version_between("3.10", minimal_python_version, maximal_python_version) | bool %}
{%- if version_between("3.10", min_py, max_py) %}
- '3.10'
{%- endif %}
{%- if version_between("3.11", minimal_python_version, maximal_python_version) | bool %}
{%- if version_between("3.11", min_py, max_py) %}
- '3.11'
{%- endif %}
test:
Expand All @@ -46,16 +46,16 @@ jobs:
strategy:
matrix:
python-version:
{%- if version_between("3.8", minimal_python_version, maximal_python_version) | bool %}
{%- if version_between("3.8", min_py, max_py) %}
- '3.8'
{%- endif %}
{%- if version_between("3.9", minimal_python_version, maximal_python_version) | bool %}
{%- if version_between("3.9", min_py, max_py) %}
- '3.9'
{%- endif %}
{%- if version_between("3.10", minimal_python_version, maximal_python_version) | bool %}
{%- if version_between("3.10", min_py, max_py) %}
- '3.10'
{%- endif %}
{%- if version_between("3.11", minimal_python_version, maximal_python_version) | bool %}
{%- if version_between("3.11", min_py, max_py) %}
- '3.11'
{%- endif %}
{%- if project_name == "Serious Scaffold Python" %}
Expand Down Expand Up @@ -88,16 +88,16 @@ jobs:
strategy:
matrix:
python-version:
{%- if version_between("3.8", minimal_python_version, maximal_python_version) | bool %}
{%- if version_between("3.8", min_py, max_py) %}
- '3.8'
{%- endif %}
{%- if version_between("3.9", minimal_python_version, maximal_python_version) | bool %}
{%- if version_between("3.9", min_py, max_py) %}
- '3.9'
{%- endif %}
{%- if version_between("3.10", minimal_python_version, maximal_python_version) | bool %}
{%- if version_between("3.10", min_py, max_py) %}
- '3.10'
{%- endif %}
{%- if version_between("3.11", minimal_python_version, maximal_python_version) | bool %}
{%- if version_between("3.11", min_py, max_py) %}
- '3.11'
{%- endif %}
{%- endif %}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
uses: actions/setup-python@v4
with:
cache: pip
python-version: 3.x
python-version: '3.11'
- run: env | sort
- run: make dev-package
- run: make build
Expand All @@ -28,7 +28,7 @@ jobs:
uses: actions/setup-python@v4
with:
cache: pip
python-version: 3.x
python-version: '3.11'
- run: env | sort
- run: make dev-docs
- run: make docs-all
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/release.yml.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
jobs:
deploy-package:
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
cache: pip
python-version: '{{ default_py }}'
- run: env | sort
- run: make dev-package
- run: make build
- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: {{ '${{ secrets.PYPI_API_TOKEN }}' }}
deploy-pages:
permissions:
pages: write
id-token: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
cache: pip
python-version: '{{ default_py }}'
- run: env | sort
- run: make dev-docs
- run: make docs-all
- name: Upload pages artifact
uses: actions/upload-pages-artifact@v2
with:
path: public
- id: deployment
name: Deploy to GitHub Pages
uses: actions/deploy-pages@v2
name: Deploy Python Package & GitHub Pages
on:
release:
types:
- published
18 changes: 9 additions & 9 deletions .gitlab-ci.yml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ stages:
- lint_test
- build_release
default:
image: python:3.11
image: python:{{ default_py }}
lint:
image: python:$PYTHON_VERSION
interruptible: true
Expand All @@ -14,16 +14,16 @@ lint:
parallel:
matrix:
- PYTHON_VERSION:
{%- if version_between("3.8", minimal_python_version, maximal_python_version) | bool %}
{%- if version_between("3.8", min_py, max_py) %}
- '3.8'
{%- endif %}
{%- if version_between("3.9", minimal_python_version, maximal_python_version) | bool %}
{%- if version_between("3.9", min_py, max_py) %}
- '3.9'
{%- endif %}
{%- if version_between("3.10", minimal_python_version, maximal_python_version) | bool %}
{%- if version_between("3.10", min_py, max_py) %}
- '3.10'
{%- endif %}
{%- if version_between("3.11", minimal_python_version, maximal_python_version) | bool %}
{%- if version_between("3.11", min_py, max_py) %}
- '3.11'
{%- endif %}
script:
Expand All @@ -47,16 +47,16 @@ test:
parallel:
matrix:
- PYTHON_VERSION:
{%- if version_between("3.8", minimal_python_version, maximal_python_version) | bool %}
{%- if version_between("3.8", min_py, max_py) %}
- '3.8'
{%- endif %}
{%- if version_between("3.9", minimal_python_version, maximal_python_version) | bool %}
{%- if version_between("3.9", min_py, max_py) %}
- '3.9'
{%- endif %}
{%- if version_between("3.10", minimal_python_version, maximal_python_version) | bool %}
{%- if version_between("3.10", min_py, max_py) %}
- '3.10'
{%- endif %}
{%- if version_between("3.11", minimal_python_version, maximal_python_version) | bool %}
{%- if version_between("3.11", min_py, max_py) %}
- '3.11'
{%- endif %}
script:
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build:
- make dev-docs
os: ubuntu-22.04
tools:
python: '3'
python: '3.11'
sphinx:
fail_on_warning: true
version: 2
12 changes: 12 additions & 0 deletions .readthedocs.yaml.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
build:
jobs:
post_build:
- make reports
post_install:
- make dev-docs
os: ubuntu-22.04
tools:
python: '{{ default_py }}'
sphinx:
fail_on_warning: true
version: 2
12 changes: 8 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"pathjoin",
"pipenv",
"pipx",
"pycache",
"pydantic",
"pytest",
"Quickstart",
Expand Down Expand Up @@ -74,15 +75,18 @@
"_exclude",
"project_name",
"project_description",
"repo_namespace",
"author_name",
"organization_name",
"author_email",
"repo_namespace",
"repo_name",
"package_name",
"module_name",
"test_coverage_threshold",
"minimal_python_version",
"maximal_python_version",
"coverage_threshold",
"min_py",
"max_py",
"default_py",
"choices",
"stages",
"default",
"lint",
Expand Down
67 changes: 38 additions & 29 deletions copier.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,80 +11,89 @@ _exclude:
- ~*
project_name:
default: Serious Scaffold Python
help: 'Project name in CamelCase:'
help: 'Enter the name of the project in CamelCase format:'
type: str
project_description:
default: A development-focused Python project template with various integrations, configurations and modules.
help: 'Brief project description:'
type: str
repo_namespace:
default: serious-scaffold
help: 'Repo namespace, it should be the name of an user or an organization:'
help: 'Provide a brief description for the project:'
type: str
author_name:
default: huxuan
help: 'Author name:'
help: 'Specify the name of the author:'
type: str
organization_name:
default: Serious Scaffold
help: 'Provide the name of the organization associated with the project:'
type: str
author_email:
default: i@{{ author_name }}.org
help: 'Author email:'
default: |-
{% if author_name == 'huxuan' and organization_name == 'Serious Scaffold' -%}
i@huxuan.org
{%- else -%}
{{ author_name }}@{{ organization_name|lower|replace(" ", "-") }}.com
{%- endif %}
help: 'Specify the email address of the author:'
type: str
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:'
type: str
repo_name:
default: '{{ project_name|lower|replace(" ", "-") }}'
help: 'Repo name:'
help: 'Provide a name for the repository:'
type: str
package_name:
default: '{{ repo_name|regex_replace("-python$", "") }}'
help: 'Package name:'
help: 'Specify the name of the distributable package for the project (often used in "pip install <package_name>"):'
type: str
module_name:
default: '{{ package_name|lower|replace("-", "_") }}'
help: 'Module name:'
help: 'Specify the name of the primary module within the package (often used in "import <module_name>"):'
type: str
test_coverage_threshold:
coverage_threshold:
default: 100
help: 'Threshold for test coverage (0-100):'
help: 'Set the threshold for test coverage, ranging from 0 to 100:'
type: int
validator: '{% if not 0 <= test_coverage_threshold <= 100 %}Invalid threshold{% endif %}'
minimal_python_version:
validator: '{% if not 0 <= coverage_threshold <= 100 %}Test Coverage threshold should be between 0 and 100{% endif %}'
min_py:
choices:
- '3.8'
- '3.9'
- '3.10'
- '3.11'
default: '3.8'
help: 'Minimal Python Version to support:'
help: 'Choose the minimal Python version the project should support:'
type: str
maximal_python_version:
max_py:
choices:
'3.8':
validator: '{% from pathjoin("includes", "version_compare.jinja") import version_lt -%}{{ "Invalid" if version_lt("3.8", minimal_python_version) | bool }}'
validator: '{% from pathjoin("includes", "version_compare.jinja") import version_higher_than_validator %}{{ version_higher_than_validator("3.8", min_py) }}'
value: '3.8'
'3.9':
validator: '{% from pathjoin("includes", "version_compare.jinja") import version_lt -%}{{ "Invalid" if version_lt("3.9", minimal_python_version) | bool }}'
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':
validator: '{% from pathjoin("includes", "version_compare.jinja") import version_lt -%}{{ "Invalid" if version_lt("3.10", minimal_python_version) | bool }}'
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.11'
default: '3.11'
help: 'Maximal Python Version to support:'
help: 'Choose the maximal Python version the project should support:'
type: str
default_python_version:
default_py:
choices:
'3.8':
validator: '{% from pathjoin("includes", "version_compare.jinja") import version_between %}{{ "Invalid" if not version_between("3.8", minimal_python_version, maximal_python_version) | bool }}'
validator: '{% from pathjoin("includes", "version_compare.jinja") import version_between_validator %}{{ version_between_validator("3.8", min_py, max_py) }}'
value: '3.8'
'3.9':
validator: '{% from pathjoin("includes", "version_compare.jinja") import version_between %}{{ "Invalid" if not version_between("3.9", minimal_python_version, maximal_python_version) | bool }}'
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':
validator: '{% from pathjoin("includes", "version_compare.jinja") import version_between %}{{ "Invalid" if not version_between("3.10", minimal_python_version, maximal_python_version) | bool }}'
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':
validator: '{% from pathjoin("includes", "version_compare.jinja") import version_between %}{{ "Invalid" if not version_between("3.11", minimal_python_version, maximal_python_version) | bool }}'
validator: '{% from pathjoin("includes", "version_compare.jinja") import version_between_validator %}{{ version_between_validator("3.11", min_py, max_py) }}'
value: '3.11'
default: '{{ maximal_python_version }}'
help: 'Default Python Version (e.g. for daily development, docs generation):'
default: '{{ max_py }}'
help: 'Choose the default Python version for development, documentation generation, and package build:'
type: str
22 changes: 19 additions & 3 deletions includes/version_compare.jinja
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
{% macro version_lt(version1, version2) -%}
{{ 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)
}}
{%- endmacro %}

{% macro version_between(version, version_min, version_max) -%}
{{ (version_min.split(".") | map("int") | list <= version.split(".") | map("int") | list <= version_max.split(".") | map("int") | list ) }}
{{
"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)
}}
{%- endmacro %}
Loading