Skip to content

Commit

Permalink
Merge pull request #7 from Roman-Supernova-PIT/test-prs
Browse files Browse the repository at this point in the history
Test prs
  • Loading branch information
sosey authored Dec 9, 2024
2 parents 08dd1dd + b438fb6 commit 91320fc
Show file tree
Hide file tree
Showing 19 changed files with 179 additions and 20 deletions.
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
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
assignees: ''
assignees: 'software-admins'
---

<!--
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: "Feature request"
name: "Feature request for package-template"
about: Suggest an idea for this project
title: "[New Feature]: "
labels: enhancement, needs triage
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

2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ As members of the community,

- We pledge to be conscientious of the perceptions of the wider community and to respond to criticism respectfully. We will strive to model behaviors that encourage productive debate and disagreement, both within our community and where we are criticized. We will treat those outside our community with the same respect as people within our community.

- We pledge to help the entire community follow the code of conduct, and to not remain silent when we see violations of the code of conduct. We will take action when members of our community violate this code such as such as contacting [email protected] (all emails sent to this address will be treated with the strictest confidence) or talking privately with the person.
- We pledge to help the entire community follow the code of conduct, and to not remain silent when we see violations of the code of conduct. We will take action when members of our community violate this code such as such as contacting TBD (all emails sent to this address will be treated with the strictest confidence) or talking privately with the person.

This code of conduct applies to all community situations online and offline, including mailing lists, forums, social media, conferences, meetings, associated social events, and one-to-one interactions.

Expand Down
19 changes: 16 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ To create a new package based on the template run:
$ pip install cookiecutter cruft
$ cruft create https://github.com/Roman-Supernova-PIT/package-template
and go through the steps offered in the cli naming your package and filling in your details.
Cruft is built on cookiecutter, and enables the updating of the template from the source.
This takes the form of pull requests to the repository that the new package is pushed to.
Expand All @@ -31,13 +32,25 @@ If you would like to stick to simply the cookiecutter approach, the template sti
$ pip install cookiecutter
$ cookiecutter gh:Roman-Supernova-PIT/package-template -o ./output_directory
This will create a new directory in your current directory named the same as the value of "packagename" you supplied.
Change into this directory and run ``git init`` to make it into a git repository, and make an initial commit.
This is required in order to have software versioning working for your package.
This will create a new directory in your current directory named the same as the value of "packagename" you supplied. Change into this directory and run ``git init`` to make it into a git repository, and make an initial commit. Then pip install into a clean environment and try building docs:

.. code-block:: console
$ cd <your package name>
$ git init
$ pip install -e ".[docs,test]"
$ cd docs
$ make html
This is required in order to have software versioning working for your package, and to test creating docs.

The goal of the template is to quickly get you setup with the files described in the guide.
The template currently implements the following optional flags, all of which default to off:

* ``include_example_code``: This option will fill your new package with some example functions to allow you to test it.
* ``use_compiled_extensions``: This turns on the features needed to support compiled extensions
* ``enable_dynamic_dev_versions``: This enables a feature which ensures that ``my_package.__version__`` always returns the current git version as calculated by ``setuptools_scm`` when the package is installed as an editable install.



2 changes: 2 additions & 0 deletions codespell-ignore.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Add words to ignore for spelling check
# https://github.com/codespell-project/codespell
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' %}
=====================================================
2 changes: 1 addition & 1 deletion {{ cookiecutter.package_name }}/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ As members of the community,

- We pledge to be conscientious of the perceptions of the wider community and to respond to criticism respectfully. We will strive to model behaviors that encourage productive debate and disagreement, both within our community and where we are criticized. We will treat those outside our community with the same respect as people within our community.

- We pledge to help the entire community follow the code of conduct, and to not remain silent when we see violations of the code of conduct. We will take action when members of our community violate this code such as such as contacting [email protected] (all emails sent to this address will be treated with the strictest confidence) or talking privately with the person.
- We pledge to help the entire community follow the code of conduct, and to not remain silent when we see violations of the code of conduct. We will take action when members of our community violate this code such as such as contacting TBD (all emails sent to this address will be treated with the strictest confidence) or talking privately with the person.

This code of conduct applies to all community situations online and offline, including mailing lists, forums, social media, conferences, meetings, associated social events, and one-to-one interactions.

Expand Down
2 changes: 2 additions & 0 deletions {{ cookiecutter.package_name }}/codespell-ignore.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# add words to ignore for spelling
# https://github.com/codespell-project/codespell
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 91320fc

Please sign in to comment.