Skip to content

Commit

Permalink
feat: Select requires-python from list
Browse files Browse the repository at this point in the history
  • Loading branch information
attakei committed Sep 16, 2024
1 parent d7d433f commit 198a21f
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 10 deletions.
5 changes: 1 addition & 4 deletions cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,5 @@
"author_name": "Kazuya Takei",
"author_email": "[email protected]",
"version": "0.0.0",
"local_python_version": "3.8.17",
"_copy_without_render": [
".github/workflows"
]
"requires_python": ["3.9", "3.10", "3.11", "3.12"]
}
18 changes: 16 additions & 2 deletions {{cookiecutter.project_basename}}/.github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,32 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
python-version:
{%- if cookiecutter.requires_python in ["3.9"] %}
- '3.9'
{%- endif %}
{%- if cookiecutter.requires_python in ["3.9", "3.10"] %}
- '3.10'
{%- endif %}
{%- if cookiecutter.requires_python in ["3.9", "3.10", "3.11"] %}
- '3.11'
{%- endif %}
{%- if cookiecutter.requires_python in ["3.9", "3.10", "3.11", "3.12"] %}
- '3.12'
{%- endif %}
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v2
- uses: actions/setup-python@v5
id: 'setup-python'
with:
python-version: ${{ matrix.python-version }}
python-version: {% raw %}${{ matrix.python-version }}{% endraw %}
- name: Run tests
run: |
{%- raw %}
uv sync --frozen --python='${{ steps.setup-python.outputs.python-path }}'
uv run pytest
{%- endraw %}
doc-test:
runs-on: ubuntu-latest
steps:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{%- raw -%}
name: 'Release new version'

on:
Expand Down Expand Up @@ -74,3 +75,4 @@ jobs:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
{%- endraw %}
2 changes: 1 addition & 1 deletion {{cookiecutter.project_basename}}/.python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{{ cookiecutter.local_python_version }}
{{ cookiecutter.requires_python }}
12 changes: 9 additions & 3 deletions {{cookiecutter.project_basename}}/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "{{ cookiecutter.version }}"
description = "{{ cookiecutter.description }}"
authors = [{name = "{{ cookiecutter.author_name }}", email = "{{ cookiecutter.author_email }}"}]
license = "Apache-2.0"
requires-python = ">= 3.8"
requires-python = ">= {{ cookiecutter.requires_python }}"
classifiers = [
"Development Status :: 3 - Alpha",
"Framework :: Sphinx",
Expand All @@ -14,11 +14,18 @@ classifiers = [
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
{%- if cookiecutter.requires_python in ["3.9"] %}
"Programming Language :: Python :: 3.9",
{%- endif %}
{%- if cookiecutter.requires_python in ["3.9", "3.10"] %}
"Programming Language :: Python :: 3.10",
{%- endif %}
{%- if cookiecutter.requires_python in ["3.9", "3.10", "3.11"] %}
"Programming Language :: Python :: 3.11",
{%- endif %}
{%- if cookiecutter.requires_python in ["3.9", "3.10", "3.11", "3.12"] %}
"Programming Language :: Python :: 3.12",
{%- endif %}
"Topic :: Documentation",
"Topic :: Documentation :: Sphinx",
"Topic :: Software Development",
Expand All @@ -28,7 +35,6 @@ classifiers = [
"Topic :: Text Processing",
"Topic :: Text Processing :: Markup",
"Topic :: Text Processing :: Markup :: reStructuredText",

]
readme = "README.rst"
dependencies = [
Expand Down

0 comments on commit 198a21f

Please sign in to comment.