diff --git a/.github/ISSUE_TEMPLATE/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE/ISSUE_TEMPLATE.md index 1b53dab..78e5646 100644 --- a/.github/ISSUE_TEMPLATE/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE/ISSUE_TEMPLATE.md @@ -1,5 +1,5 @@ --- -name: "🐞 Issue report for {{ cookiecutter.package_name }}" +name: "🐞 Issue report for package-template itself" about: Create a report describing unexpected or incorrect behavior. title: "[Issue]: " labels: bug diff --git a/{{ cookiecutter.package_name }}/.github/workflows/labeler.yml b/.github/labeler.yml similarity index 90% rename from {{ cookiecutter.package_name }}/.github/workflows/labeler.yml rename to .github/labeler.yml index d58675e..763f5e5 100644 --- a/{{ cookiecutter.package_name }}/.github/workflows/labeler.yml +++ b/.github/labeler.yml @@ -22,19 +22,18 @@ jobs: documentation: - changed-files: - - all-globs-to-any-file: ['*.rst', '!CHANGES.rst'] + - all-globs-to-any-file: ['*.rst', '!CHANGES.rst', '!licenses/LICENSE.rst'] - any-glob-to-any-file: - 'docs/**/*' - '*.md' - '.readthedocs.yaml' - - 'licenses/LICENSE.rst' installation: - changed-files: - any-glob-to-any-file: - 'pyproject.toml' - 'setup.*' - - 'requirements-*.txt' + - 'requirements*.txt' - 'MANIFEST.in' # --------------------------------------- testing --------------------------------------- diff --git a/.github/workflows/label_pull_request.yaml b/.github/workflows/label_pull_request.yaml new file mode 100644 index 0000000..0f51840 --- /dev/null +++ b/.github/workflows/label_pull_request.yaml @@ -0,0 +1,18 @@ +name: Label pull request + +on: + pull_request_target: + types: + - opened + - synchronize + +jobs: + triage: + runs-on: ubuntu-latest + steps: + - uses: actions/labeler@8558fd74291d67161a8a78ce36a881fa63b766a9 # v5.0.0 + if: github.event_name == 'pull_request_target' || github.event_name == 'pull_request' + with: + repo-token: "${{ secrets.GITHUB_TOKEN }}" + sync-labels: true + \ No newline at end of file diff --git a/cookiecutter.json b/cookiecutter.json index 696a864..9d60a17 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -11,7 +11,6 @@ "BSD 3-Clause" ], "minimum_python_version": [ - "3.10", "3.11", "3.12", "3.13" diff --git a/tests/conftest.py b/tests/conftest.py index 6f27dfa..d7f42c8 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,4 +1,3 @@ -import py import pytest import tox diff --git a/tox.ini b/tox.ini index 17b9b0c..9d409eb 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] envlist = - py{310,311,312}-test + py{311,312,313}-test build-docs [testenv] diff --git a/{{ cookiecutter.package_name }}/.github/labeler.yml b/{{ cookiecutter.package_name }}/.github/labeler.yml new file mode 100644 index 0000000..3c34b6c --- /dev/null +++ b/{{ cookiecutter.package_name }}/.github/labeler.yml @@ -0,0 +1,57 @@ +name: "Pull Request Labeler" + +on: + pull_request_target: + types: + - opened + - synchronize + +{% raw %} +# needs pull_request_target to label forks +jobs: + labeler: + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write + steps: + - uses: actions/labeler@8558fd74291d67161a8a78ce36a881fa63b766a9 # v5.0.0 + if: github.event_name == 'pull_request_target' || github.event_name == 'pull_request' + with: + repo-token: "${{ secrets.GITHUB_TOKEN }}" + +documentation: + - changed-files: + - all-globs-to-any-file: ['*.rst', '!CHANGES.rst', '!licenses/LICENSE.rst'] + - any-glob-to-any-file: + - 'docs/**/*' + - '*.md' + - '.readthedocs.yaml' + - 'CITATION.cff' + +installation: + - changed-files: + - any-glob-to-any-file: + - 'pyproject.toml' + - 'setup.*' + - 'requirements*.txt' + - 'MANIFEST.in' + +# --------------------------------------- testing --------------------------------------- + +automation: + - changed-files: + - any-glob-to-any-file: + - '.github/**' + - '.bandit.yaml' + - '.codecov.yml' + +testing: + - changed-files: + - any-glob-to-any-file: + - '**/tests/**' + - '.github/workflows/*ci*.yml' + - 'conftest.py' + - 'tox.ini' + +{% endraw %} diff --git a/{{ cookiecutter.package_name }}/.github/workflows/changelog.yml b/{{ cookiecutter.package_name }}/.github/workflows/changelog.yml new file mode 100644 index 0000000..af632ef --- /dev/null +++ b/{{ cookiecutter.package_name }}/.github/workflows/changelog.yml @@ -0,0 +1,37 @@ +name: changelog + +on: + pull_request: + types: + - labeled + - unlabeled + - opened + - synchronize + - reopened + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + check: + runs-on: ubuntu-latest + steps: + - uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 + with: + python-version: 3 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + fetch-depth: 0 + - run: pip install . + - run: pip install towncrier + - run: towncrier check + - run: towncrier build --draft | grep -P '#${{ github.event.number }}' + prevent_manually_editing_changlog: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + fetch-depth: 0 + - name: prevent direct changes to `CHANGES.rst` + run: git diff HEAD ${{ github.event.pull_request.base.sha }} --no-patch --exit-code CHANGES.rst \ No newline at end of file diff --git a/{{ cookiecutter.package_name }}/.github/workflows/run_labeler.yml b/{{ cookiecutter.package_name }}/.github/workflows/run_labeler.yml new file mode 100644 index 0000000..78636ec --- /dev/null +++ b/{{ cookiecutter.package_name }}/.github/workflows/run_labeler.yml @@ -0,0 +1,18 @@ +name: Label pull request + +on: + pull_request_target: + types: + - opened + - synchronize + +jobs: + triage: + runs-on: ubuntu-latest + steps: + - id: label-the-PR + - uses: actions/labeler@8558fd74291d67161a8a78ce36a881fa63b766a9 # v5.0.0 + if: github.event_name == 'pull_request_target' || github.event_name == 'pull_request' + with: + repo-token: "${{ secrets.GITHUB_TOKEN }}" + sync-labels: true \ No newline at end of file diff --git a/{{ cookiecutter.package_name }}/.github/workflows/sphinx-deploy.yml b/{{ cookiecutter.package_name }}/.github/workflows/sphinx-deploy.yml index 012a789..c6907c5 100644 --- a/{{ cookiecutter.package_name }}/.github/workflows/sphinx-deploy.yml +++ b/{{ cookiecutter.package_name }}/.github/workflows/sphinx-deploy.yml @@ -8,7 +8,7 @@ on: jobs: pages: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest permissions: contents: write steps: diff --git a/{{ cookiecutter.package_name }}/CHANGES.rst b/{{ cookiecutter.package_name }}/CHANGES.rst new file mode 100644 index 0000000..fc42f41 --- /dev/null +++ b/{{ cookiecutter.package_name }}/CHANGES.rst @@ -0,0 +1,4 @@ +.. towncrier release notes start + +Package development begun {% now 'utc', '%Y-%m-%d' %} +===================================================== \ No newline at end of file diff --git a/{{ cookiecutter.package_name }}/pyproject.toml b/{{ cookiecutter.package_name }}/pyproject.toml index 33fdcaa..e67adb4 100644 --- a/{{ cookiecutter.package_name }}/pyproject.toml +++ b/{{ cookiecutter.package_name }}/pyproject.toml @@ -119,19 +119,18 @@ exclude_lines = [ ] [tool.towncrier] -filename = "CHANGES.rst" -# Where you want your news files to come out, `NEWS.rst` is the default. +# Where you want your news files to come out, filename=`NEWS.rst` is the default. # This can be .rst or .md, towncrier's default template works with both. -# filename = "NEWS.rst" +filename = "CHANGES.rst" directory = "changes" -package = "{{ cookiecutter.package_name }}" +package = "{{ cookiecutter.module_name }}" title_format = "{version} ({project_date})" ignore = [".gitkeep"] wrap = true issue_format = "`#{issue} <https://github.com/Roman-Supernova-PIT/{{ cookiecutter.package_name }}/issues/{issue}>`_" [[tool.towncrier.type]] -directory = "general" +directory = "/" name = "General" showcontent = true @@ -139,3 +138,10 @@ showcontent = true directory = "docs" name = "Documentation" showcontent = true + +[[tool.towndcrier.type]] +directory = {{ cookiecutter.module_name }} +name = " {{ cookiecutter.module_name }}" +showcontent = true + + diff --git a/{{ cookiecutter.package_name }}/{{ cookiecutter.module_name }}/tests/conftest.py b/{{ cookiecutter.package_name }}/{{ cookiecutter.module_name }}/tests/conftest.py new file mode 100644 index 0000000..ed10637 --- /dev/null +++ b/{{ cookiecutter.package_name }}/{{ cookiecutter.module_name }}/tests/conftest.py @@ -0,0 +1,5 @@ +# this is a module level file +import pytest + +import tox +from tox.pytest import init_fixture