Skip to content

Commit

Permalink
Merge pull request #2 from LSSTISSC/update-ppt
Browse files Browse the repository at this point in the history
Update PPT to 1.5.0
  • Loading branch information
hombit authored Feb 7, 2024
2 parents bc4d313 + 8f8f64f commit 59b5274
Show file tree
Hide file tree
Showing 15 changed files with 226 additions and 35 deletions.
14 changes: 10 additions & 4 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
# Changes here will be overwritten by Copier
_commit: v1.4.6
_commit: v1.5.0
_src_path: https://github.com/lincc-frameworks/python-project-template.git
author_email: [email protected]
author_name: LSST ISSC
create_example_module: true
custom_install: true
enforce_style:
- ruff
failure_notification:
- none
include_benchmarks: false
include_docs: true
include_notebooks: true
mypy_type_checking: none
package_name: stamps_ad
preferred_linter: none
project_license: MIT
project_name: stamps-ad
project_organization: lsstissc
use_isort: false
project_organization: LSSTISSC
python_versions:
- '3.9'
- '3.10'
- '3.11'
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE/0-general_issue.md
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 .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.
18 changes: 18 additions & 0 deletions .github/ISSUE_TEMPLATE/2-feature_request.md
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.
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "monthly"
4 changes: 2 additions & 2 deletions .github/workflows/build-documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@main
- name: Set up Python 3.10
uses: actions/setup-python@v4
uses: actions/setup-python@main
with:
python-version: '3.10'
- name: Install dependencies
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/code_style.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# 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: Code Style analysis

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11']

steps:
- uses: actions/checkout@main
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@main
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo apt-get update
python -m pip install --upgrade pip
pip install .[dev]
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Analyze code with ruff
run: |
ruff format --check
ruff check
33 changes: 33 additions & 0 deletions .github/workflows/pre-commit-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This workflow runs pre-commit hooks on pull requests to enforce coding style.
# To ensure correct configuration, please refer to:
# https://lincc-ppt.readthedocs.io/en/latest/practices/ci_precommit.html

name: Run pre-commit hooks

on:
pull_request:

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
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@main
with:
python-version: '3.10'
- name: Install dependencies
run: |
sudo apt-get update
python -m pip install --upgrade pip
pip install .[dev]
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- uses: pre-commit/action@main # Still using Node 16
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()
4 changes: 2 additions & 2 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ jobs:
permissions:
id-token: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@main
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@main
with:
python-version: '3.10'
- name: Install dependencies
Expand Down
11 changes: 5 additions & 6 deletions .github/workflows/smoke-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,23 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10']
python-version: ['3.9', '3.10', '3.11']

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@main
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@main
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo apt-get update
python -m pip install --upgrade pip
pip install .
pip install .[dev]
pip install -e .[dev]
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: List dependencies
run: |
pip list
- name: Run unit tests with pytest
run: |
python -m pytest tests
python -m pytest
15 changes: 8 additions & 7 deletions .github/workflows/testing-and-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,24 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10']
python-version: ['3.9', '3.10', '3.11']

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@main
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@main
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo apt-get update
python -m pip install --upgrade pip
pip install .
pip install .[dev]
pip install -e .[dev]
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Run unit tests with pytest
run: |
python -m pytest tests --cov=stamps_ad --cov-report=xml
python -m pytest --cov=stamps_ad --cov-report=xml
- name: Upload coverage report to codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@main
with:
token: ${{ secrets.CODECOV_TOKEN }}
18 changes: 7 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
fail_fast: true
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
# is out of date.
Expand All @@ -11,7 +10,6 @@ repos:
name: Check template version
description: Compare current template version against latest
verbose: true

# Clear output from jupyter notebooks so that only the input cells are committed.
- repo: local
hooks:
Expand All @@ -22,7 +20,6 @@ repos:
stages: [commit]
language: system
entry: jupyter nbconvert --clear-output

# Prevents committing directly branches named 'main' and 'master'.
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
Expand All @@ -34,21 +31,20 @@ repos:
name: Check for large files
description: Prevent the user from committing very large files.
args: ['--maxkb=500']

# Verify that pyproject.toml is well formed
- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.12.1
hooks:
- id: validate-pyproject
name: Validate pyproject.toml
description: Verify that pyproject.toml adheres to the established schema.







- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.1.3
hooks:
- id: ruff
name: Format and lint code using ruff
types_or: [ python, pyi, jupyter ]
# 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
Expand Down
11 changes: 10 additions & 1 deletion .prepare_project.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
#!/usr/bin/env bash

echo "Checking pip version"
MINIMUM_PIP_VERSION=22
pipversion=( $(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 "Initializing local git repository"
{
gitversion=( $(git version | sed 's/^.* //;s/\./ /g') )
gitversion=( $(git version | git version | awk '{print $3}' | sed 's/\./ /g') )
if let "${gitversion[0]}<2"; then
# manipulate directly
git init . && echo 'ref: refs/heads/main' >.git/HEAD
Expand Down
Loading

0 comments on commit 59b5274

Please sign in to comment.