Skip to content

Commit

Permalink
Better consistency check. (#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
huxuan authored Aug 11, 2023
1 parent 30d43a4 commit db5d1b7
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,22 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Git
run: |
git config --global user.name github-actions
git config --global user.email github-actions@github.com
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
cache: pip
python-version: ${{ matrix.python-version }}
- run: env | sort
- run: pip install copier
- run: copier copy -r HEAD -f . .
- name: Install copier for template rendering
run: python -m pip install --user copier
- name: Generate the project with the default value
run: |
rm -rf src/serious_scaffold
copier copy -x '!src/serious_scaffold' -r HEAD -f . .
- run: git diff
- run: git status --porcelain
- run: |
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/ci.yml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,22 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Git
run: |
git config --global user.name github-actions
git config --global user.email github-actions@github.com
- name: Set up Python {{ '${{ matrix.python-version }}' }}
uses: actions/setup-python@v4
with:
cache: pip
python-version: {{ '${{ matrix.python-version }}' }}
- run: env | sort
- run: pip install copier
- run: copier copy -r HEAD -f . .
- name: Install copier for template rendering
run: python -m pip install --user copier
- name: Generate the project with the default value
run: |
rm -rf src/serious_scaffold
copier copy -x '!src/serious_scaffold' -r HEAD -f . .
- run: git diff
- run: git status --porcelain
- run: |
Expand Down
3 changes: 2 additions & 1 deletion src/{{ module_name }}/settings.py.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ class GlobalSettings(BaseSettings):

class Settings(BaseSettings):
"""Project specific settings."""

{%- if version_lt(minimal_python_version, "3.10") | bool %}

# NOTE(huxuan): Pydantic cannot leverage future annotations at runtime prior to
# Python 3.10, so `from __future__ import annotations` cannot be used here, and the
# lint error need to be ignored unless the minimal Python version >= 3.10.
# Reference: https://github.com/pydantic/pydantic/issues/3300#issuecomment-1034007897
logging_level: Optional[str] = getLevelName(logging.INFO) # noqa: FA100
{%- else %}

logging_level: str | None = getLevelName(logging.INFO)
{%- endif %}
"""Default logging level for the project."""
Expand Down

0 comments on commit db5d1b7

Please sign in to comment.