diff --git a/python-minimal/README.md b/python-minimal/README.md index 44c3f66..2f9fe35 100644 --- a/python-minimal/README.md +++ b/python-minimal/README.md @@ -4,8 +4,7 @@ This template is designed for simple data science project in Python. It suggests a combination of notebooks and a module for shared utilities. Development tools are kept to a minimum. -Python 3.10 is chosen as a minimum, as 3.9 will reach end-of-life in 2025 (cf. [Python Release Cycle](https://devguide.python.org/versions/#python-release-cycle)). -We recommend 3.11, as some packages may not fully support 3.12 yet. +Python 3.12 is chosen as a minimum, as 3.11 will reach end-of-life in 2027 (cf. [Python Release Cycle](https://devguide.python.org/versions/#python-release-cycle)). ## Dependencies and reproducibility diff --git a/python-minimal/cookiecutter.json b/python-minimal/cookiecutter.json index 7daf7b2..2e203d8 100644 --- a/python-minimal/cookiecutter.json +++ b/python-minimal/cookiecutter.json @@ -1,4 +1,10 @@ { + "__python_version": "3.12", + "__uv_version": "0.10.2", + "__pre_commit_version": "4.5", + "__ruff_version": "0.15.0", + "__pytest_version": "9.0", + "__notebook_version": "7.5", "project_name": "Project", "project_slug": "{{ cookiecutter.project_name.lower().replace(' ', '-') }}", "module_name": "{{ cookiecutter.project_slug.replace('-', '_') }}", diff --git a/python-minimal/{{cookiecutter.project_slug}}/.github/workflows/tests.yml b/python-minimal/{{cookiecutter.project_slug}}/.github/workflows/tests.yml index ae678c4..d7d5726 100644 --- a/python-minimal/{{cookiecutter.project_slug}}/.github/workflows/tests.yml +++ b/python-minimal/{{cookiecutter.project_slug}}/.github/workflows/tests.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.10", "3.11", "3.12"] + python-version: ["{{ cookiecutter.__python_version }}"] steps: @@ -23,7 +23,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r requirements.txt . pytest + pip install -r requirements.txt . {%- if cookiecutter.use_ruff_format %} - name: Check format with ruff diff --git a/python-minimal/{{cookiecutter.project_slug}}/.gitlab-ci.yml b/python-minimal/{{cookiecutter.project_slug}}/.gitlab-ci.yml index cd96752..8219b9d 100644 --- a/python-minimal/{{cookiecutter.project_slug}}/.gitlab-ci.yml +++ b/python-minimal/{{cookiecutter.project_slug}}/.gitlab-ci.yml @@ -3,9 +3,9 @@ stages: run-tests: stage: test - image: python:3.10 + image: python:{{ cookiecutter.__python_version }} before_script: - - pip install -r requirements.txt . pytest + - pip install -r requirements.txt . script: {%- if cookiecutter.use_ruff_format %} - ruff format --check diff --git a/python-minimal/{{cookiecutter.project_slug}}/.pre-commit-config.yaml b/python-minimal/{{cookiecutter.project_slug}}/.pre-commit-config.yaml index bfb32bc..1e742fc 100644 --- a/python-minimal/{{cookiecutter.project_slug}}/.pre-commit-config.yaml +++ b/python-minimal/{{cookiecutter.project_slug}}/.pre-commit-config.yaml @@ -17,7 +17,7 @@ repos: - id: trailing-whitespace {%- if cookiecutter.use_ruff_format or cookiecutter.use_ruff_lint %} - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.12.3 + rev: v{{ cookiecutter.__ruff_version }} hooks: {%- if cookiecutter.use_ruff_lint %} - id: ruff-check @@ -29,7 +29,7 @@ repos: {%- endif %} {%- if cookiecutter.use_uv %} - repo: https://github.com/astral-sh/uv-pre-commit - rev: 0.9.26 + rev: {{ cookiecutter.__uv_version }} hooks: - id: uv-lock - id: uv-export @@ -41,7 +41,7 @@ repos: entry: uv pip compile pyproject.toml --group dev --universal --output-file requirements.txt --quiet --no-progress language: python additional_dependencies: - - uv==0.9.26 + - uv=={{ cookiecutter.__uv_version }} pass_filenames: false files: ^pyproject\.toml$ {%- endif %} diff --git a/python-minimal/{{cookiecutter.project_slug}}/.python-version b/python-minimal/{{cookiecutter.project_slug}}/.python-version new file mode 100644 index 0000000..e782cc3 --- /dev/null +++ b/python-minimal/{{cookiecutter.project_slug}}/.python-version @@ -0,0 +1 @@ +{{ cookiecutter.__python_version }} diff --git a/python-minimal/{{cookiecutter.project_slug}}/pyproject.toml b/python-minimal/{{cookiecutter.project_slug}}/pyproject.toml index 19cdf0e..fa02b95 100644 --- a/python-minimal/{{cookiecutter.project_slug}}/pyproject.toml +++ b/python-minimal/{{cookiecutter.project_slug}}/pyproject.toml @@ -11,7 +11,7 @@ authors = [ ] description = "" readme = "README.md" -requires-python = ">=3.10" +requires-python = "~={{ cookiecutter.__python_version }}" dependencies = [ # TODO configure install dependencies ] @@ -19,13 +19,13 @@ dynamic = ["version"] [dependency-groups] dev = [ - "notebook~=7.4", - "pre-commit~=4.2", + "notebook~={{ cookiecutter.__notebook_version }}", + "pre-commit~={{ cookiecutter.__pre_commit_version }}", {%- if cookiecutter.use_pytest %} - "pytest~=8.4", + "pytest~={{ cookiecutter.__pytest_version }}", {%- endif %} {%- if cookiecutter.use_ruff_format or cookiecutter.use_ruff_lint %} - "ruff==0.12.3", + "ruff=={{ cookiecutter.__ruff_version }}", {%- endif %} ] @@ -34,7 +34,7 @@ version = {attr = "{{ cookiecutter.module_name }}.__version__"} {%- if cookiecutter.use_ruff_format or cookiecutter.use_ruff_lint %} [tool.ruff] -target-version = "py310" +target-version = "py{{ cookiecutter.__python_version.replace(".", "") }}" line-length = 88 {%- if cookiecutter.use_ruff_lint %}