diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..859ac3d --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,7 @@ +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v2.3.0 + hooks: + - id: check-yaml + - id: end-of-file-fixer + - id: trailing-whitespace diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f8de88..f4a7afa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,4 +5,28 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). - \ No newline at end of file + +## [1.0.0](https://github.com/ilbumi/copier-python-vscode/releases/tag/1.0.0) - 2023-08-20 + +[Compare with first commit](https://github.com/ilbumi/copier-python-vscode/compare/0.1.0...1.0.0) + +### Features + +- Add pre-commit hooks +- Add VSCode Dev Containers support +- Add semi-automatic changelog generation + + +## [0.1.0](https://github.com/ilbumi/copier-python-vscode/releases/tag/0.1.0) - 2023-08-20 + +[Compare with first commit](https://github.com/ilbumi/copier-python-vscode/compare/946c697f571f5a4e7c0df91c70607b3c931e8157...0.1.0) + +### Features + +- Add PDM project config +- Add basic static code analysis (ruff, bandit, safety) +- Add basic formatting (black, ssort, isort) +- Add basic tests (pytest, coverage) +- Add basic GitHub Workflows +- Add nox as a task runner +- Add LICENSE generation diff --git a/copier.yml b/copier.yml index e1e8440..fee488b 100644 --- a/copier.yml +++ b/copier.yml @@ -120,4 +120,9 @@ python_package_import_name: python_package_command_line_name: type: str help: Your CLI name if any (for use in the shell) - default: "{{ project_name | slugify }}" \ No newline at end of file + default: "{{ project_name | slugify }}" + +docker_base_image: + type: str + help: Base image for the dev container. Edit Dockerfile.dev if your image is not ubuntu-based or have no python installed. + default: "python:3.11" diff --git a/project/.devcontainer/Dockerfile.dev.jinja b/project/.devcontainer/Dockerfile.dev.jinja new file mode 100644 index 0000000..582539e --- /dev/null +++ b/project/.devcontainer/Dockerfile.dev.jinja @@ -0,0 +1,12 @@ +ARG BASE_IMAGE={{ docker_base_image }} +FROM ${BASE_IMAGE} +RUN apt-get update \ + && apt-get install build-essential git gcc -y \ + && apt-get clean + +RUN pip install -U pip setuptools wheel +RUN pip install pdm + +RUN mkdir /data + +CMD "" diff --git a/project/.devcontainer/devcontainer.json.jinja b/project/.devcontainer/devcontainer.json.jinja new file mode 100644 index 0000000..f868127 --- /dev/null +++ b/project/.devcontainer/devcontainer.json.jinja @@ -0,0 +1,23 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-dockerfile +{ + "name": "Development docker containers", + "dockerComposeFile": "docker-compose.yml", + "service": "app", + "workspaceFolder": "/app", + "shutdownAction": "stopCompose", + "overrideCommand": true, + "customizations": { + "vscode": { + "extensions": [ + "vivaxy.vscode-conventional-commits", + "DavidAnson.vscode-markdownlint", + "ionutvmi.path-autocomplete", + "ms-python.vscode-pylance", + "ms-python.python", + "ms-python.black-formatter", + "charliermarsh.ruff" + ] + } + } +} diff --git a/project/.devcontainer/docker-compose.yml b/project/.devcontainer/docker-compose.yml new file mode 100644 index 0000000..38bd9aa --- /dev/null +++ b/project/.devcontainer/docker-compose.yml @@ -0,0 +1,11 @@ +version: "3.8" + +services: + app: + build: + context: .. + dockerfile: .devcontainer/Dockerfile.dev + command: "/bin/sh -c \"while sleep 1000; do :; done\"" + user: "${UID}:${GID}" + volumes: + - "../:/app" diff --git a/project/noxfile.py.jinja b/project/noxfile.py.jinja index a71392e..e7d7cc2 100644 --- a/project/noxfile.py.jinja +++ b/project/noxfile.py.jinja @@ -71,3 +71,13 @@ def check_safety(session: Session) -> None: "pdm", "export", "-f", "requirements", "-o", requirements.name, "--without-hashes", external=True ) session.run("safety", "check", f"--file={requirements.name}", "--full-report") + + +@nox.session +def generate_changelog(session: Session) -> None: + """Generate changelog from the commits. It should be reviewed and cleaned up by a human. + + Args: + session (Session): nox session object + """ + session.run("git-changelog", "-Tbio", "CHANGELOG.md", "-c", "angular") diff --git a/project/setup_project.sh b/project/setup_project.sh new file mode 100644 index 0000000..df4dfe0 --- /dev/null +++ b/project/setup_project.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +set -e + +git init . +git add -A . +git commit -m "feat: init a repo" + +pdm install diff --git a/tests/setup.sh b/tests/setup.sh index 5cb36ae..cf65b0a 100755 --- a/tests/setup.sh +++ b/tests/setup.sh @@ -34,6 +34,4 @@ copier copy --trust --defaults -r HEAD "${template}" "${DEST}" \ -d repository_provider="github.com" pushd $DEST -git init . -git add -A . -git commit -m "feat: init a repo" \ No newline at end of file +source setup_project.sh