From fccbc19cfedfa2b2bdfccfc8c7dd003726479d41 Mon Sep 17 00:00:00 2001 From: Steven van de Graaf Date: Thu, 13 Jun 2024 10:56:05 +0200 Subject: [PATCH] :alien: Apply changes from `cookiecutter-python-cli-app` --- .github/workflows/input-for-demo.txt | 2 +- .pre-commit-config.yaml | 5 +++-- README.md | 3 +-- cookiecutter.json | 6 +++--- pyproject.toml | 4 ++-- {{ cookiecutter.project_name }}/.pre-commit-config.yaml | 9 +++++---- {{ cookiecutter.project_name }}/docs/conf.py | 8 ++++++-- {{ cookiecutter.project_name }}/pyproject.toml | 4 ++-- 8 files changed, 23 insertions(+), 18 deletions(-) diff --git a/.github/workflows/input-for-demo.txt b/.github/workflows/input-for-demo.txt index 4fda84b..e274ac2 100644 --- a/.github/workflows/input-for-demo.txt +++ b/.github/workflows/input-for-demo.txt @@ -1,4 +1,4 @@ -cookiecutter-python-package-demo +Cookiecutter Python Package Demo Demo of https://github.com/sgraaf/cookiecutter-python-package. diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fb3b3dd..7d3b7bd 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,12 +19,12 @@ repos: - id: end-of-file-fixer - id: trailing-whitespace - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.28.3 + rev: 0.28.5 hooks: - id: check-dependabot - id: check-github-workflows - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.4.4 + rev: v0.4.8 hooks: - id: ruff args: @@ -34,3 +34,4 @@ repos: rev: v4.0.0-alpha.8 hooks: - id: prettier + additional_dependencies: ["prettier@3.1.0"] diff --git a/README.md b/README.md index 664ed43..d50aebc 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,7 @@ [![Supported Python Versions](https://img.shields.io/badge/python-3.8%20|%203.9%20|%203.10%20|%203.11%20|%203.12-blue)](https://github.com/sgraaf/cookiecutter-python-package) [![Nox](https://img.shields.io/badge/%F0%9F%A6%8A-Nox-D85E00.svg)](https://github.com/wntrblm/nox) -[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v1.json)](https://github.com/charliermarsh/ruff) -[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) +[![Code style: Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/format.json)](https://github.com/astral-sh/ruff) [![Checked with mypy](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/) [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit) diff --git a/cookiecutter.json b/cookiecutter.json index e9112fc..96ee496 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -1,7 +1,7 @@ { - "project_name": "python-project", + "friendly_name": "Python Package", + "project_name": "{{ cookiecutter.friendly_name | slugify }}", "package_name": "{{ cookiecutter.project_name.replace('-', '_').lower() }}", - "friendly_name": "{{ cookiecutter.project_name.replace('-', ' ').title() }}", "short_description": "{{ cookiecutter.friendly_name }} is a Python package for ...", "author": "", "email": "", @@ -29,9 +29,9 @@ "init_git": [true, false], "init_venv": [true, false], "__prompts__": { + "friendly_name": "The friendly name of your project (for use in documentation, etc.)", "project_name": "The name (slug) of your project", "package_name": "The name of your package", - "friendly_name": "The friendly name of your project (for use in documentation, etc.)", "short_description": "A short description of your projec", "author": "Your (full) name", "email": "Your e-mail address", diff --git a/pyproject.toml b/pyproject.toml index 6ea9bdd..91b9629 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,8 +1,8 @@ [tool.ruff] lint.select = ["ALL"] lint.ignore = [ - "E501", # line too long, handled by black - "COM", # flake8-commas, handled by black + "E501", # line too long, handled by ruff-format + "COM", # flake8-commas, handled by ruff-format "CPY", # flake8-copyright "ISC001", # single-line-implicit-string-concatenation "INP", # flake8-no-pep420 diff --git a/{{ cookiecutter.project_name }}/.pre-commit-config.yaml b/{{ cookiecutter.project_name }}/.pre-commit-config.yaml index 656b8cc..c7181d6 100644 --- a/{{ cookiecutter.project_name }}/.pre-commit-config.yaml +++ b/{{ cookiecutter.project_name }}/.pre-commit-config.yaml @@ -21,17 +21,17 @@ repos: - id: end-of-file-fixer - id: trailing-whitespace - repo: https://github.com/abravalheri/validate-pyproject - rev: v0.17 + rev: v0.18 hooks: - id: validate-pyproject - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.28.3 + rev: 0.28.5 hooks: - id: check-dependabot - id: check-github-workflows - id: check-readthedocs - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.4.4 + rev: v0.4.8 hooks: - id: ruff args: @@ -42,10 +42,11 @@ repos: hooks: - id: mypy - repo: https://github.com/codespell-project/codespell - rev: v2.2.6 + rev: v2.3.0 hooks: - id: codespell - repo: https://github.com/pre-commit/mirrors-prettier rev: v4.0.0-alpha.8 hooks: - id: prettier + additional_dependencies: ["prettier@3.1.0"] diff --git a/{{ cookiecutter.project_name }}/docs/conf.py b/{{ cookiecutter.project_name }}/docs/conf.py index 5341691..5aa57bd 100644 --- a/{{ cookiecutter.project_name }}/docs/conf.py +++ b/{{ cookiecutter.project_name }}/docs/conf.py @@ -1,6 +1,10 @@ """Sphinx configuration.""" + +from __future__ import annotations + import sys from pathlib import Path +from typing import Any sys.path.insert(0, str(Path(__file__).resolve().parents[1])) import {{ cookiecutter.package_name }} # noqa: E402 @@ -47,6 +51,6 @@ html_theme = "furo" html_static_path = ["_static"] -html_theme_options = { - "top_of_page_button": None, +html_theme_options: dict[str, Any] = { + "top_of_page_buttons": [], } diff --git a/{{ cookiecutter.project_name }}/pyproject.toml b/{{ cookiecutter.project_name }}/pyproject.toml index 95c265b..5af1b4d 100644 --- a/{{ cookiecutter.project_name }}/pyproject.toml +++ b/{{ cookiecutter.project_name }}/pyproject.toml @@ -69,12 +69,12 @@ name = "{{ cookiecutter.package_name }}" [tool.ruff] lint.select = ["ALL"] lint.ignore = [ - "E501", # line too long, handled by black (pycodestyle) + "E501", # line too long (pycodestyle), handled by ruff-format "ANN003", # missing-type-kwargs (flake8-annotations) "ANN101", # missing-type-self (flake8-annotations) "ANN102", # missing-type-cls (flake8-annotations) "ANN401", # any-type (flake8-annotations) - "COM", # flake8-commas, handled by black + "COM", # flake8-commas, handled by ruff-format "CPY", # flake8-copyright "ISC001", # single-line-implicit-string-concatenation (flake8-implicit-str-concat) "INP", # flake8-no-pep420