Skip to content

Commit

Permalink
Merge branch 'main' into issue/312/failure-emails
Browse files Browse the repository at this point in the history
  • Loading branch information
OliviaLynn authored Feb 5, 2024
2 parents f153570 + f39c171 commit 43f06d7
Show file tree
Hide file tree
Showing 12 changed files with 181 additions and 15 deletions.
8 changes: 1 addition & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,7 @@ jobs:
git commit -m initial
pip install .
pip install .[dev]
- name: pylint checks
if: ${{ contains (matrix.copier_config.name, 'Base') }}
run: |
cd ../test/${{ matrix.copier_config.foldername }}
python -m pylint --recursive=y ./src/ --rcfile=./src/.pylintrc
- name: black checks
uses: psf/black@stable
with:
Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ For all the information, see the detailed user guide in

Choose where you would like to create your new project, and call copier with the template.

```
>$ copier copy gh:lincc-frameworks/python-project-template <path/to/destination>
```sh
copier copy gh:lincc-frameworks/python-project-template <path/to/destination>
cd <path/to/destination>
bash .prepare_project.sh
```

## Contributing to the Template
Expand All @@ -29,4 +31,4 @@ See full documentation at [readthedocs](https://lincc-ppt.readthedocs.io/en/late

LINCC Frameworks is supported by Schmidt Futures, a philanthropic initiative
founded by Eric and Wendy Schmidt, as part of the Virtual Institute of
Astrophysics (VIA).
Astrophysics (VIA).
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ please :doc:`/source/contact`
practices/ci_testing
practices/code_coverage
practices/git-lfs
practices/issue_pr_templating
practices/linting
practices/namespace_project
practices/pipx
Expand Down
62 changes: 62 additions & 0 deletions docs/practices/issue_pr_templating.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
Issue and Pull Request Templates
===============================================================================

What is it? Why do it?
-------------------------------------------------------------------------------

Issues and Pull Requests form the core of developer-community communication
regarding identified problems/requested features and their implementation in
a given software package. The main function of templates is to provide
guidelines on the content of these, usually focused on ensuring a given
user/developer provides enough context in a given issue/pull request (PR) for
others to understand the motivation and technical details.

Issue Templates
-------------------------------------------------------------------------------

Issue templates are highly customizable, and it's often appropriate to have
multiple available to users to promote better organization of common issue
types. By default, the python-project-template provides three base templates

* **general-issue-template**: A general issue template for issues that don't fit into other categories.
* **bug-report-template**: A template specific to identifying bugs within the package.
* **feature-request-template**: A template for requesting new features of the package.

A user will be prompted to choose between these templates any time they attempt
to create a new issue in the repository. You may add new templates to this
list as additional common issue themes become clear in your project.

Modifying using the Github Web-Interface
...............................................................................
Github offers native support for adding and modifying issue templates directly
in it's web-interface. This is done within the settings menu, and Github has a
straightforward guide on how to access this interface,
`here <https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/configuring-issue-templates-for-your-repository>`_.

Changing Template Ordering
...............................................................................
The ordering of issue templates is controlled by alpha-numeric names of the
template files themselves. To best control ordering, it's recommended to prefix
the template files with a number (e.g. ``0-first_template.md``,
``1-second_template.md``, etc.). This is also covered in it's own section of
the `github issue templating guide <https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/configuring-issue-templates-for-your-repository#changing-the-order-of-templates>`_.

.. note::
The issue template files can be found in the ``.github/ISSUE_TEMPLATE``
subdirectory of your repository.

Pull Request Template
-------------------------------------------------------------------------------

A pull request template is used to pre-populate any submitted PRs to the
repository. By default, the python-project-template provides a single template
to the project (located at ``.github/pull_request_template.md``). This template
provides generic fields for:

* **Change Description**: Prompt for overview of what the PR changes
* **Solution Description**: Prompt for technical details of the solution
* **Code Quality**: Checkboxes to verify that the PR adheres to the coding standards of the repository

As well as a set of additional project and issue-specific fields. This template
only serves as an initial framework, and you should feel free to modify this as
you see fit by directly modifying the template file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
name: General issue
about: Quickly create a general issue
title: ''
labels: ''
assignees: ''

---
17 changes: 17 additions & 0 deletions python-project-template/.github/ISSUE_TEMPLATE/1-bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: Bug report
about: Tell us about a problem to fix
title: 'Short description'
labels: 'bug'
assignees: ''

---
**Bug report**


**Before submitting**
Please check the following:

- [ ] I have described the situation in which the bug arose, including what code was executed, information about my environment, and any applicable data others will need to reproduce the problem.
- [ ] I have included available evidence of the unexpected behavior (including error messages, screenshots, and/or plots) as well as a descriprion of what I expected instead.
- [ ] If I have a solution in mind, I have provided an explanation and/or pseudocode and/or task list.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: Feature request
about: Suggest an idea for this project
title: 'Short description'
labels: 'enhancement'
assignees: ''

---

** Feature request**


**Before submitting**
Please check the following:

- [ ] I have described the purpose of the suggested change, specifying what I need the enhancement to accomplish, i.e. what problem it solves.
- [ ] I have included any relevant links, screenshots, environment information, and data relevant to implementing the requested feature, as well as pseudocode for how I want to access the new functionality.
- [ ] If I have ideas for how the new feature could be implemented, I have provided explanations and/or pseudocode and/or task lists for the steps.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will install Python dependencies, then perform static type checking analysis.
# This workflow will install Python dependencies, then perform static analysis for code style and type checking.
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: mypy Type checking
name: Code Style analysis

on:
push:
Expand Down Expand Up @@ -33,11 +33,31 @@ jobs:
pip install .
pip install .[dev]
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
{%- if mypy_type_checking == 'basic' -%}
- name: Analyze code with mypy
{% if mypy_type_checking == 'basic' %}
run: |
mypy ./src ./tests --ignore-missing-imports
{% elif mypy_type_checking == 'strict' %}
{%- elif mypy_type_checking == 'strict' -%}
- name: Analyze code with mypy
run: |
mypy ./src ./tests --strict
{% endif -%}
{%- endif -%}
{%- if 'black' in enforce_style %}
- name: Analyze code for black formatting
run: |
black --check .
{%- endif -%}
{%- if 'pylint' in enforce_style %}
- name: Analyze code with pylint
run: |
pylint -rn -sn --recursive=y ./src --rcfile=./src/.pylintrc
pylint -rn -sn --recursive=y ./tests --rcfile=./tests/.pylintrc
{%- if include_benchmarks %}
pylint -rn -sn --recursive=y ./benchmarks --rcfile=./tests/.pylintrc
{%- endif -%}
{%- endif -%}
{%- if 'ruff' in enforce_style %}
- name: Analyze code with ruff
ruff format --check
ruff check
{%- endif -%}
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ jobs:
{% endraw %}
{%- endif %}
{%- if 'slack' in failure_notification %}
{%- raw %}
- name: Send status to Slack app
if: {% raw %}${{ failure() && github.event_name != 'workflow_dispatch' }}{% endraw %} # Only post if the workflow failed and was not manually started. Customize this as necessary.
id: slack
Expand Down
25 changes: 25 additions & 0 deletions python-project-template/pyproject.toml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ line_length = 110
[tool.ruff]
line-length = 110
target-version = "py38"

[tool.ruff.lint]
select = [
# pycodestyle
"E",
Expand All @@ -105,7 +107,30 @@ select = [
"SIM",
# isort
"I",
# docstrings
"D101",
"D102",
"D103",
"D106",
"D206",
"D207",
"D208",
"D300",
"D417",
"D419",

]

ignore = [
"UP006", # Allow non standard library generics in type hints
"UP007", # Allow Union in type hints
"SIM114", # Allow if with same arms
"B028", # Allow default warning level
"SIM117", # Allow nested with
"UP015", # Allow redundant open parameters
"UP028", # Allow yield in for loop
]

{%- if mypy_type_checking != 'none' %}
[tool.setuptools.package-data]
{{package_name}} = ["py.typed"]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
extend = "../pyproject.toml"

[lint]
ignore = [
"D100",
"D101",
"D102",
"D103",
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
extend = "../pyproject.toml"

[lint]
ignore = [
"D100",
"D101",
"D102",
"D103",
]

0 comments on commit 43f06d7

Please sign in to comment.