-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from lincc-frameworks/update-template
Update template to consolidate pre-commit logic
- Loading branch information
Showing
13 changed files
with
128 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# Changes here will be overwritten by Copier | ||
_commit: v1.4.6-59-g4c84e58 | ||
_commit: v1.5.1-11-g34358f1 | ||
_src_path: gh:lincc-frameworks/python-project-template | ||
author_email: [email protected] | ||
author_name: Sandro Campos | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,30 +5,32 @@ | |
name: Run pre-commit hooks | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
pre-commit-ci: | ||
runs-on: ubuntu-latest | ||
env: | ||
SKIP: "check-lincc-frameworks-template-version,pytest-check,no-commit-to-branch,validate-pyproject,check-added-large-files,sphinx-build" | ||
steps: | ||
- uses: actions/checkout@main | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up Python | ||
uses: actions/setup-python@main | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.10' | ||
- name: Install dependencies | ||
run: | | ||
sudo apt-get update | ||
python -m pip install --upgrade pip | ||
pip install . | ||
pip install .[dev] | ||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
- uses: pre-commit/action@main # Still using Node 16 | ||
- uses: pre-commit/action@v3.0.1 | ||
with: | ||
extra_args: --from-ref ${{ github.event.pull_request.base.sha }} --to-ref ${{ github.event.pull_request.head.sha }} | ||
- uses: pre-commit-ci/lite-action@main | ||
if: always() | ||
extra_args: --all-files --verbose | ||
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/[email protected] | ||
if: failure() && github.event_name == 'pull_request' && github.event.pull_request.draft == false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/usr/bin/env bash | ||
|
||
# This script should be run by new developers to install this package in | ||
# editable mode and configure their local environment | ||
|
||
echo "Checking virtual environment" | ||
if [ -z "${VIRTUAL_ENV}" ] && [ -z "${CONDA_PREFIX}" ]; then | ||
echo 'No virtual environment detected: none of $VIRTUAL_ENV or $CONDA_PREFIX is set.' | ||
echo | ||
echo "=== This script is going to install the project in the system python environment ===" | ||
echo "Proceed? [y/N]" | ||
read -r RESPONCE | ||
if [ "${RESPONCE}" != "y" ]; then | ||
echo "See https://lincc-ppt.readthedocs.io/ for details." | ||
echo "Exiting." | ||
exit 1 | ||
fi | ||
|
||
fi | ||
|
||
echo "Checking pip version" | ||
MINIMUM_PIP_VERSION=22 | ||
pipversion=( $(python -m pip --version | awk '{print $2}' | sed 's/\./ /g') ) | ||
if let "${pipversion[0]}<${MINIMUM_PIP_VERSION}"; then | ||
echo "Insufficient version of pip found. Requires at least version ${MINIMUM_PIP_VERSION}." | ||
echo "See https://lincc-ppt.readthedocs.io/ for details." | ||
exit 1 | ||
fi | ||
|
||
echo "Installing package and runtime dependencies in local environment" | ||
python -m pip install -e . > /dev/null | ||
|
||
echo "Installing developer dependencies in local environment" | ||
python -m pip install -e .'[dev]' > /dev/null | ||
|
||
echo "Installing pre-commit" | ||
pre-commit install > /dev/null | ||
|
||
####################################################### | ||
# Include any additional configurations below this line | ||
####################################################### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.