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..526eaa3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -21,9 +21,13 @@ 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 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 +36,13 @@ repos: name: Check for large files description: Prevent the user from committing very large files. args: ['--maxkb=500'] + - 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 files that contain merge conflict strings # Verify that pyproject.toml is well formed - repo: https://github.com/abravalheri/validate-pyproject rev: 17e12779811926f000bdfa1795f9e3735dd71ac3 @@ -79,7 +90,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/.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/.pre-commit-config.yaml.jinja b/python-project-template/.pre-commit-config.yaml.jinja index c0401e0..0afa409 100644 --- a/python-project-template/.pre-commit-config.yaml.jinja +++ b/python-project-template/.pre-commit-config.yaml.jinja @@ -21,7 +21,11 @@ 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 outstanding merge conflict markers in the codebase. - repo: https://github.com/pre-commit/pre-commit-hooks rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # v6.0.0 hooks: @@ -32,6 +36,13 @@ repos: name: Check for large files description: Prevent the user from committing very large files. args: ['--maxkb=500'] + - 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 +.