diff --git a/.git_archival.txt b/.git_archival.txt index b1a286b..8fb235d 100644 --- a/.git_archival.txt +++ b/.git_archival.txt @@ -1,4 +1,4 @@ node: $Format:%H$ node-date: $Format:%cI$ describe-name: $Format:%(describe:tags=true,match=*[0-9]*)$ -ref-names: $Format:%D$ \ No newline at end of file +ref-names: $Format:%D$ diff --git a/.gitattributes b/.gitattributes index 343a755..f0e3f77 100644 --- a/.gitattributes +++ b/.gitattributes @@ -21,4 +21,4 @@ # png image files # *.png filter=lfs diff=lfs merge=lfs -text -.git_archival.txt export-subst \ No newline at end of file +.git_archival.txt export-subst diff --git a/.github/workflows/smoke-test.yml b/.github/workflows/smoke-test.yml index 946b205..a1468eb 100644 --- a/.github/workflows/smoke-test.yml +++ b/.github/workflows/smoke-test.yml @@ -10,7 +10,7 @@ on: # Runs this workflow automatically schedule: - cron: 45 6 * * * - + # Allows you to run this workflow manually from the Actions tab workflow_dispatch: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ac6fbbb..b14b692 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ repos: # Compare the local template version to the latest remote template version - # This hook should always pass. It will print a message if the local version + # This hook should always pass. It will print a message if the local version # is out of date. - repo: https://github.com/lincc-frameworks/pre-commit-hooks rev: 439dda8bd784f4aa721851ecec03877df286f6b5 @@ -21,9 +21,14 @@ repos: stages: [pre-commit] language: system entry: jupyter nbconvert --clear-output - # Prevents committing directly branches named 'main' and 'master'. + # Run a series of standard precommit checks, including: + # - no commits to branches named 'main' and 'master'. + # - No large files (>= 500kb) + # - All YAML and TOML files are valid. + # - No whitespace at the end of lines and a single newline at end of file. + # - No outstanding merge conflict markers in the codebase. - repo: https://github.com/pre-commit/pre-commit-hooks - rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c + rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # v6.0.0 hooks: - id: no-commit-to-branch name: Prevent main branch commits @@ -32,6 +37,18 @@ repos: name: Check for large files description: Prevent the user from committing very large files. args: ['--maxkb=500'] + - id: trailing-whitespace + exclude: \.(rst|md|txt|html)$ # Skip rst, md, txt, and html files + name: Fix trailing whitespace + - id: end-of-file-fixer + name: Files end with a newline + - id: check-toml + name: Validate TOML files + - id: check-yaml + args: [--allow-multiple-documents] # Allow multiple document format + name: Validate YAML files + - id: check-merge-conflict + name: Check for merge conflicts # Verify that pyproject.toml is well formed - repo: https://github.com/abravalheri/validate-pyproject rev: 17e12779811926f000bdfa1795f9e3735dd71ac3 @@ -79,7 +96,9 @@ repos: # supported by your project here, or alternatively use # pre-commit's default_language_version, see # https://pre-commit.com/#top_level-default_language_version - language_version: python3.11 + # This currently uses the default language version. Uncomment + # the following line to use the max version. + # language_version: python{{ py.max(python_versions) }} # Run unit tests, verify that they pass. Note that coverage is run against # the ./src directory here because that is what will be committed. In the # github workflow script, the coverage is run against the installed package diff --git a/docs/practices/issue_pr_templating.rst b/docs/practices/issue_pr_templating.rst index f76e57c..d4fd3bc 100644 --- a/docs/practices/issue_pr_templating.rst +++ b/docs/practices/issue_pr_templating.rst @@ -60,4 +60,4 @@ provides generic fields for: 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. \ No newline at end of file +you see fit by directly modifying the template file. diff --git a/docs/source/update_project.rst b/docs/source/update_project.rst index 7a688fd..7cefd7d 100644 --- a/docs/source/update_project.rst +++ b/docs/source/update_project.rst @@ -141,4 +141,4 @@ For all the details about updating with Copier checkout the Still have questions? ------------------------------------- -:doc:`/source/contact` \ No newline at end of file +:doc:`/source/contact` diff --git a/python-project-template/.git_archival.txt b/python-project-template/.git_archival.txt index b1a286b..8fb235d 100644 --- a/python-project-template/.git_archival.txt +++ b/python-project-template/.git_archival.txt @@ -1,4 +1,4 @@ node: $Format:%H$ node-date: $Format:%cI$ describe-name: $Format:%(describe:tags=true,match=*[0-9]*)$ -ref-names: $Format:%D$ \ No newline at end of file +ref-names: $Format:%D$ diff --git a/python-project-template/.gitattributes b/python-project-template/.gitattributes index 343a755..f0e3f77 100644 --- a/python-project-template/.gitattributes +++ b/python-project-template/.gitattributes @@ -21,4 +21,4 @@ # png image files # *.png filter=lfs diff=lfs merge=lfs -text -.git_archival.txt export-subst \ No newline at end of file +.git_archival.txt export-subst diff --git a/python-project-template/.github/workflows/README.md b/python-project-template/.github/workflows/README.md index e34a71f..231bf1e 100644 --- a/python-project-template/.github/workflows/README.md +++ b/python-project-template/.github/workflows/README.md @@ -6,4 +6,4 @@ or when you create a new PR. For more information about CI and workflows, look here: https://lincc-ppt.readthedocs.io/en/latest/practices/ci.html -Or if you still have questions contact us: https://lincc-ppt.readthedocs.io/en/latest/source/contact.html \ No newline at end of file +Or if you still have questions contact us: https://lincc-ppt.readthedocs.io/en/latest/source/contact.html diff --git a/python-project-template/.github/workflows/pre-commit-ci.yml.jinja b/python-project-template/.github/workflows/pre-commit-ci.yml.jinja index 47e522f..9f40a11 100644 --- a/python-project-template/.github/workflows/pre-commit-ci.yml.jinja +++ b/python-project-template/.github/workflows/pre-commit-ci.yml.jinja @@ -39,4 +39,4 @@ jobs: env: SKIP: "check-lincc-frameworks-template-version,no-commit-to-branch,check-added-large-files,validate-pyproject,sphinx-build,pytest-check" - uses: pre-commit-ci/lite-action@062bca0919bc9d6e66755cc05074b70c77e111fc # v1.2.0 - if: failure() && github.event_name == 'pull_request' && github.event.pull_request.draft == false \ No newline at end of file + if: failure() && github.event_name == 'pull_request' && github.event.pull_request.draft == false diff --git a/python-project-template/.github/workflows/{% if contains_code %}smoke-test.yml{% endif %}.jinja b/python-project-template/.github/workflows/{% if contains_code %}smoke-test.yml{% endif %}.jinja index cc82270..1a25aa5 100644 --- a/python-project-template/.github/workflows/{% if contains_code %}smoke-test.yml{% endif %}.jinja +++ b/python-project-template/.github/workflows/{% if contains_code %}smoke-test.yml{% endif %}.jinja @@ -122,4 +122,4 @@ jobs: ] } {%- endraw %} -{%- endif %} \ No newline at end of file +{%- endif %} diff --git a/python-project-template/.github/workflows/{% if contains_code %}testing-and-coverage.yml{% endif %}.jinja b/python-project-template/.github/workflows/{% if contains_code %}testing-and-coverage.yml{% endif %}.jinja index f620030..5972f33 100644 --- a/python-project-template/.github/workflows/{% if contains_code %}testing-and-coverage.yml{% endif %}.jinja +++ b/python-project-template/.github/workflows/{% if contains_code %}testing-and-coverage.yml{% endif %}.jinja @@ -83,4 +83,4 @@ jobs: run: | source venv/bin/activate python -m pytest -{%- endif %} \ No newline at end of file +{%- endif %} diff --git a/python-project-template/.github/workflows/{% if include_benchmarks %}asv-main.yml{% endif %}.jinja b/python-project-template/.github/workflows/{% if include_benchmarks %}asv-main.yml{% endif %}.jinja index 2eb356d..5aaa2e9 100644 --- a/python-project-template/.github/workflows/{% if include_benchmarks %}asv-main.yml{% endif %}.jinja +++ b/python-project-template/.github/workflows/{% if include_benchmarks %}asv-main.yml{% endif %}.jinja @@ -73,4 +73,5 @@ jobs: with: branch: gh-pages folder: ${{env.WORKING_DIR}}/_html -{%- endraw -%} \ No newline at end of file + +{%- endraw -%} diff --git a/python-project-template/.github/workflows/{% if include_benchmarks %}asv-nightly.yml{% endif %}.jinja b/python-project-template/.github/workflows/{% if include_benchmarks %}asv-nightly.yml{% endif %}.jinja index 745b136..3459efc 100644 --- a/python-project-template/.github/workflows/{% if include_benchmarks %}asv-nightly.yml{% endif %}.jinja +++ b/python-project-template/.github/workflows/{% if include_benchmarks %}asv-nightly.yml{% endif %}.jinja @@ -79,4 +79,5 @@ jobs: with: path: ${{env.WORKING_DIR}} key: nightly-results-${{steps.nightly-dates.outputs.today}} -{%- endraw -%} \ No newline at end of file + +{%- endraw -%} diff --git a/python-project-template/.github/workflows/{% if include_benchmarks %}asv-pr.yml{% endif %}.jinja b/python-project-template/.github/workflows/{% if include_benchmarks %}asv-pr.yml{% endif %}.jinja index 511785a..5440bea 100644 --- a/python-project-template/.github/workflows/{% if include_benchmarks %}asv-pr.yml{% endif %}.jinja +++ b/python-project-template/.github/workflows/{% if include_benchmarks %}asv-pr.yml{% endif %}.jinja @@ -78,4 +78,5 @@ jobs: with: name: benchmark-artifacts path: ${{env.ARTIFACTS_DIR}} -{%- endraw -%} \ No newline at end of file + +{%- endraw -%} diff --git a/python-project-template/.github/workflows/{% if include_benchmarks %}publish-benchmarks-pr.yml{% endif %}.jinja b/python-project-template/.github/workflows/{% if include_benchmarks %}publish-benchmarks-pr.yml{% endif %}.jinja index f1aa290..70c53fa 100644 --- a/python-project-template/.github/workflows/{% if include_benchmarks %}publish-benchmarks-pr.yml{% endif %}.jinja +++ b/python-project-template/.github/workflows/{% if include_benchmarks %}publish-benchmarks-pr.yml{% endif %}.jinja @@ -55,4 +55,5 @@ jobs: issue-number: ${{ steps.pr-info.outputs.pr }} body-path: output edit-mode: replace + {%- endraw -%} diff --git a/python-project-template/.pre-commit-config.yaml.jinja b/python-project-template/.pre-commit-config.yaml.jinja index c0401e0..837e9de 100644 --- a/python-project-template/.pre-commit-config.yaml.jinja +++ b/python-project-template/.pre-commit-config.yaml.jinja @@ -21,7 +21,12 @@ repos: stages: [pre-commit] language: system entry: jupyter nbconvert --clear-output - # Prevents committing directly branches named 'main' and 'master'. + # Run a series of standard precommit checks, including: + # - no commits to branches named 'main' and 'master'. + # - No large files (>= 500kb) + # - All YAML and TOML files are valid. + # - No whitespace at the end of lines and a single newline at end of file. + # - No outstanding merge conflict markers in the codebase. - repo: https://github.com/pre-commit/pre-commit-hooks rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # v6.0.0 hooks: @@ -32,6 +37,18 @@ repos: name: Check for large files description: Prevent the user from committing very large files. args: ['--maxkb=500'] + - id: trailing-whitespace + exclude: \.(rst|md|txt|html)$ # Skip rst, md, txt, and html files + name: Fix trailing whitespace + - id: end-of-file-fixer + name: Files end with a newline + - id: check-toml + name: Validate TOML files + - id: check-yaml + args: [--allow-multiple-documents] # Allow multiple document format + name: Validate YAML files + - id: check-merge-conflict + name: Check for merge conflicts # Verify that pyproject.toml is well formed - repo: https://github.com/abravalheri/validate-pyproject rev: 17e12779811926f000bdfa1795f9e3735dd71ac3 # v0.26 diff --git a/python-project-template/README.md.jinja b/python-project-template/README.md.jinja index 2913a20..777dee0 100644 --- a/python-project-template/README.md.jinja +++ b/python-project-template/README.md.jinja @@ -15,13 +15,13 @@ [![Benchmarks](https://img.shields.io/github/actions/workflow/status/{{project_organization}}/{{project_name}}/asv-main.yml?label=benchmarks)](https://{{project_organization}}.github.io/{{project_name}}/) {%- endif %} -This project was automatically generated using the LINCC-Frameworks +This project was automatically generated using the LINCC-Frameworks [python-project-template](https://github.com/lincc-frameworks/python-project-template). A repository badge was added to show that this project uses the python-project-template, however it's up to you whether or not you'd like to display it! -For more information about the project template see the +For more information about the project template see the [documentation](https://lincc-ppt.readthedocs.io/en/latest/). ## Dev Guide - Getting Started @@ -47,7 +47,7 @@ development using the following commands: Notes: 1. `./.setup_dev.sh` will initialize pre-commit for this local repository, so that a set of tests will be run prior to completing a local commit. For more - information, see the Python Project Template documentation on + information, see the Python Project Template documentation on [pre-commit](https://lincc-ppt.readthedocs.io/en/latest/practices/precommit.html) {%- if include_notebooks %} 2. Install `pandoc` allows you to verify that automatic rendering of Jupyter notebooks diff --git a/python-project-template/{% if include_dev_guide %}DEVELOPMENT_GUIDE.md{% endif %}.jinja b/python-project-template/{% if include_dev_guide %}DEVELOPMENT_GUIDE.md{% endif %}.jinja index da6d001..dc1b89d 100644 --- a/python-project-template/{% if include_dev_guide %}DEVELOPMENT_GUIDE.md{% endif %}.jinja +++ b/python-project-template/{% if include_dev_guide %}DEVELOPMENT_GUIDE.md{% endif %}.jinja @@ -65,4 +65,3 @@ benchmarks/ ASV performance benchmarks - **File naming:** `tests/{{package_name}}//test_.py`, mirroring the `src/{{package_name}}/` layout. - **Fixtures:** defined in `tests/conftest.py`. Use existing fixtures, do not duplicate test data. - Default test run: `python -m pytest` - diff --git a/python-project-template/{% if project_license == 'GPL3' %}LICENSE{% endif%}.jinja b/python-project-template/{% if project_license == 'GPL3' %}LICENSE{% endif%}.jinja index e72bfdd..f288702 100644 --- a/python-project-template/{% if project_license == 'GPL3' %}LICENSE{% endif%}.jinja +++ b/python-project-template/{% if project_license == 'GPL3' %}LICENSE{% endif%}.jinja @@ -671,4 +671,4 @@ into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read -. \ No newline at end of file +.