Skip to content

Commit

Permalink
refined package and template files
Browse files Browse the repository at this point in the history
  • Loading branch information
sosey committed Dec 1, 2024
1 parent 08dd1dd commit 26c12d7
Show file tree
Hide file tree
Showing 13 changed files with 155 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -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]: <title>"
labels: bug
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 ---------------------------------------
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/label_pull_request.yaml
Original file line number Diff line number Diff line change
@@ -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

1 change: 0 additions & 1 deletion cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"BSD 3-Clause"
],
"minimum_python_version": [
"3.10",
"3.11",
"3.12",
"3.13"
Expand Down
1 change: 0 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import py
import pytest

import tox
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
envlist =
py{310,311,312}-test
py{311,312,313}-test
build-docs

[testenv]
Expand Down
57 changes: 57 additions & 0 deletions {{ cookiecutter.package_name }}/.github/labeler.yml
Original file line number Diff line number Diff line change
@@ -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 %}
37 changes: 37 additions & 0 deletions {{ cookiecutter.package_name }}/.github/workflows/changelog.yml
Original file line number Diff line number Diff line change
@@ -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
18 changes: 18 additions & 0 deletions {{ cookiecutter.package_name }}/.github/workflows/run_labeler.yml
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
pages:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
permissions:
contents: write
steps:
Expand Down
4 changes: 4 additions & 0 deletions {{ cookiecutter.package_name }}/CHANGES.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.. towncrier release notes start
Package development begun {% now 'utc', '%Y-%m-%d' %}
=====================================================
16 changes: 11 additions & 5 deletions {{ cookiecutter.package_name }}/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -119,23 +119,29 @@ 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

[[tool.towncrier.type]]
directory = "docs"
name = "Documentation"
showcontent = true

[[tool.towndcrier.type]]
directory = {{ cookiecutter.module_name }}
name = " {{ cookiecutter.module_name }}"
showcontent = true


Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# this is a module level file
import pytest

import tox
from tox.pytest import init_fixture

0 comments on commit 26c12d7

Please sign in to comment.