diff --git a/copier.yml b/copier.yml index 08443fd..ac64b22 100644 --- a/copier.yml +++ b/copier.yml @@ -1,7 +1,7 @@ # see https://copier.readthedocs.io/en/stable/configuring/ ### Settings ### -_min_copier_version: "6.0.0" +_min_copier_version: "7.0.0" _subdirectory: project-template _templates_suffix: "" # empty suffix will process all files _jinja_extensions: @@ -12,15 +12,15 @@ _jinja_extensions: full_name: type: str - help: Enter your full name. This will appear in the License generated and `setup.py`'s authors field. + help: Enter your full name. This will appear in the License generated and `pyproject.toml`'s authors field. -github_username: +email: type: str - help: You Github username or organization name under which the projects lives. + help: Your E-mail address. This will appear in the License generated and `pyproject.toml`'s authors field. -email: +github_username: type: str - help: Your E-mail address. This will appear in the License generated and `setup.py`'s authors field. + help: You Github username or organization name under which the projects lives. project_name: type: str diff --git a/project-template/{{ project_repo_name }}/.github/workflows/release-drafter.yml b/project-template/{{ project_repo_name }}/.github/workflows/release-drafter.yml index ca31345..08bdcfc 100644 --- a/project-template/{{ project_repo_name }}/.github/workflows/release-drafter.yml +++ b/project-template/{{ project_repo_name }}/.github/workflows/release-drafter.yml @@ -31,4 +31,4 @@ jobs: # config-name: my-config.yml # disable-autolabeler: true env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: {% raw %}${{ secrets.GITHUB_TOKEN }}{% endraw %} diff --git a/project-template/{{ project_repo_name }}/.github/workflows/test.yml b/project-template/{{ project_repo_name }}/.github/workflows/test.yml index fd1e355..45bc723 100644 --- a/project-template/{{ project_repo_name }}/.github/workflows/test.yml +++ b/project-template/{{ project_repo_name }}/.github/workflows/test.yml @@ -6,7 +6,36 @@ on: jobs: testing: - # reuse workflow definitions - uses: xonsh/actions/.github/workflows/test-pip-xontrib.yml@main - with: - cache-dependency-path: pyproject.toml + strategy: + matrix: + os: + - ubuntu-latest + - macos-latest + - windows-latest + python-version: + - "3.8" + - "3.9" + - "3.10" + - "3.11" + runs-on: {% raw %}${{ matrix.os }}{% endraw %} + steps: + - uses: actions/checkout@v3 +{%- if package_manager == 'poetry' %} + - name: Install poetry + run: pipx install poetry +{% endif -%} +{% raw %} + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} {% endraw %} + cache: {% if package_manager == 'poetry' %}poetry{% else %}pip{% endif %} + cache-dependency-path: pyproject.toml + + - uses: pre-commit/action@v3.0.0 + - name: Install dependencies + run: {% if package_manager == 'poetry' %}poetry install{% else %}pip install ".[dev]"{% endif %} + - name: Run tests + run: | + xonsh -c "xontrib load {{ project_package_name}}" + poetry run pytest diff --git a/project-template/{{ project_repo_name }}/README.md b/project-template/{{ project_repo_name }}/README.md index 9d1ddc5..2b301f6 100644 --- a/project-template/{{ project_repo_name }}/README.md +++ b/project-template/{{ project_repo_name }}/README.md @@ -39,6 +39,16 @@ xontrib load {{project_package_name}} ... +## Development +{% if enable_pre_commit_hooks %} +- activate [pre-commit](https://github.com/pre-commit/pre-commit) hooks +```sh +# install pre-commit plugins and activate the commit hook +pre-commit install +pre-commit autoupdate +``` +{% endif %} + ## Releasing your package - Bump the version of your package. diff --git a/project-template/{{ project_repo_name }}/pyproject.toml b/project-template/{{ project_repo_name }}/pyproject.toml index 14b70b3..472665d 100644 --- a/project-template/{{ project_repo_name }}/pyproject.toml +++ b/project-template/{{ project_repo_name }}/pyproject.toml @@ -100,9 +100,6 @@ xontrib = ["*.xsh"] {% endif %} {% endif %} -[tool.isort] -profile = "black" - [tool.black] include = '\.pyi?$' force-exclude = ''' @@ -121,3 +118,7 @@ force-exclude = ''' | disk-cache.sqlite3 )/ ''' + +[tool.ruff] +# Enable flake8-bugbear (`B`) rules. +select = ["E", "F", "B"] diff --git a/project-template/{{ project_repo_name }}/{% if enable_pre_commit_hooks %}.pre-commit-config.yaml{%endif%} b/project-template/{{ project_repo_name }}/{% if enable_pre_commit_hooks %}.pre-commit-config.yaml{%endif%} index fa9204a..2b3a6df 100644 --- a/project-template/{{ project_repo_name }}/{% if enable_pre_commit_hooks %}.pre-commit-config.yaml{%endif%} +++ b/project-template/{{ project_repo_name }}/{% if enable_pre_commit_hooks %}.pre-commit-config.yaml{%endif%} @@ -1,29 +1,24 @@ repos: - - repo: https://github.com/pycqa/isort - rev: 5.12.0 + - repo: https://github.com/charliermarsh/ruff-pre-commit + rev: "" hooks: - - id: isort - args: [ - "--filter-files", # skip files that are excluded in config file - "--profile=black", - "--skip=migrations" - ] + - id: ruff - repo: https://github.com/ambv/black - rev: 22.3.0 + rev: "" hooks: - id: black language_version: python3.8 - repo: https://github.com/pre-commit/mirrors-mypy - rev: "v0.941" # Use the sha / tag you want to point at + rev: "" # Use the sha / tag you want to point at hooks: - id: mypy args: [ "--allow-untyped-globals", "--ignore-missing-imports" ] additional_dependencies: [ types-all ] - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.1.0 + rev: "" hooks: - id: trailing-whitespace - id: check-yaml @@ -32,23 +27,8 @@ repos: - id: debug-statements - id: check-added-large-files - - repo: https://github.com/pycqa/flake8 - rev: "4.0.1" # pick a git hash / tag to point to - hooks: - - id: flake8 - args: [ "--ignore=E501,W503,W504,E203,E251,E266,E401,E126,E124,C901" ] - additional_dependencies: [ - 'flake8-bugbear', - ] - - - repo: https://github.com/asottile/pyupgrade - rev: v2.31.1 - hooks: - - id: pyupgrade - args: - - "--py37-plus" - repo: https://github.com/compilerla/conventional-pre-commit - rev: v1.2.0 + rev: "" hooks: - id: conventional-pre-commit stages: [commit-msg]