Skip to content

Commit

Permalink
Merge pull request #13 from LSSTDESC/ppt_application
Browse files Browse the repository at this point in the history
Apply Python Project Template
  • Loading branch information
drewoldag authored Sep 30, 2024
2 parents 0c68338 + f0b67ac commit 17a4c33
Show file tree
Hide file tree
Showing 85 changed files with 1,117 additions and 56 deletions.
20 changes: 20 additions & 0 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Changes here will be overwritten by Copier
_commit: v2.0.2
_src_path: gh:lincc-frameworks/python-project-template
author_email: contact@cosmostatistics-initiative.org
author_name: The RESSPECT team
create_example_module: false
custom_install: true
enforce_style: []
failure_notification: []
include_benchmarks: true
include_docs: false
mypy_type_checking: none
package_name: resspect
project_license: MIT
project_name: resspect
project_organization: LSSTDESC
python_versions:
- '3.9'
- '3.10'
- '3.11'
4 changes: 4 additions & 0 deletions .git_archival.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node: $Format:%H$
node-date: $Format:%cI$
describe-name: $Format:%(describe:tags=true,match=*[0-9]*)$
ref-names: $Format:%D$
24 changes: 24 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# For explanation of this file and uses see
# https://git-scm.com/docs/gitattributes
# https://developer.lsst.io/git/git-lfs.html#using-git-lfs-enabled-repositories
# https://lincc-ppt.readthedocs.io/en/latest/practices/git-lfs.html
#
# Used by https://github.com/lsst/afwdata.git
# *.boost filter=lfs diff=lfs merge=lfs -text
# *.dat filter=lfs diff=lfs merge=lfs -text
# *.fits filter=lfs diff=lfs merge=lfs -text
# *.gz filter=lfs diff=lfs merge=lfs -text
#
# apache parquet files
# *.parq filter=lfs diff=lfs merge=lfs -text
#
# sqlite files
# *.sqlite3 filter=lfs diff=lfs merge=lfs -text
#
# gzip files
# *.gz filter=lfs diff=lfs merge=lfs -text
#
# png image files
# *.png filter=lfs diff=lfs merge=lfs -text

.git_archival.txt export-subst
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 description 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.
14 changes: 8 additions & 6 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
version: 2
updates:
- package-ecosystem: pip
directory: "/"
schedule:
interval: daily
time: "09:00"
open-pull-requests-limit: 10
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "monthly"
63 changes: 63 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<!--
Thank you for your contribution to the repo :)
Pull Request (PR) Instructions:
Provide a general summary of your changes in the Title above. Fill out each section of the template, and replace the space with an `x` in all the boxes that apply. If you're unsure about any of these, don't hesitate to ask. We're here to help! Once you are satisfied with the pull request, click the "Create pull request" button to submit it for review.
Before submitting this PR, please ensure that your input and responses are entered in the designated space provided below each section to keep all project-related information organized and easily accessible.
How to link to a PR:
https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue
-->

## Change Description
<!---
Describe your changes in detail. In your description, you should answer questions like "Why is this change required? What problem does it solve?".
If it fixes an open issue, please link to the issue here. If this PR closes an issue, put the word 'closes' before the issue link to auto-close the issue when the PR is merged.
-->
- [ ] My PR includes a link to the issue that I am addressing



## Solution Description
<!-- Please explain the technical solution that I have provided and how it addresses the issue or feature being implemented -->



## Code Quality
- [ ] I have read the Contribution Guide
- [ ] My code follows the code style of this project
- [ ] My code builds (or compiles) cleanly without any errors or warnings
- [ ] My code contains relevant comments and necessary documentation

## Project-Specific Pull Request Checklists
<!--- Please only use the checklist that apply to your change type(s) -->

### Bug Fix Checklist
- [ ] My fix includes a new test that breaks as a result of the bug (if possible)
- [ ] My change includes a breaking change
- [ ] My change includes backwards compatibility and deprecation warnings (if possible)

### New Feature Checklist
- [ ] I have added or updated the docstrings associated with my feature using the [NumPy docstring format](https://numpydoc.readthedocs.io/en/latest/format.html)
- [ ] I have updated the tutorial to highlight my new feature (if appropriate)
- [ ] I have added unit/End-to-End (E2E) test cases to cover my new feature
- [ ] My change includes a breaking change
- [ ] My change includes backwards compatibility and deprecation warnings (if possible)

### Documentation Change Checklist
- [ ] Any updated docstrings use the [NumPy docstring format](https://numpydoc.readthedocs.io/en/latest/format.html)

### Build/CI Change Checklist
- [ ] If required or optional dependencies have changed (including version numbers), I have updated the README to reflect this
- [ ] If this is a new CI setup, I have added the associated badge to the README

<!-- ### Version Change Checklist [For Future Use] -->

### Other Change Checklist
- [ ] Any new or updated docstrings use the [NumPy docstring format](https://numpydoc.readthedocs.io/en/latest/format.html).
- [ ] I have updated the tutorial to highlight my new feature (if appropriate)
- [ ] I have added unit/End-to-End (E2E) test cases to cover any changes
- [ ] My change includes a breaking change
- [ ] My change includes backwards compatibility and deprecation warnings (if possible)
101 changes: 101 additions & 0 deletions .github/workflows/asv-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# This workflow will run benchmarks with airspeed velocity (asv),
# store the new results in the "benchmarks" branch and publish them
# to a dashboard on GH Pages.

name: Run ASV benchmarks for main

on:
push:
branches: [ main ]

env:
PYTHON_VERSION: "3.10"
WORKING_DIR: ${{ github.workspace }}/benchmarks

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

jobs:

setup-python:
runs-on: ubuntu-latest

steps:
- name: Cache Python ${{ env.PYTHON_VERSION }}
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: python-${{ env.PYTHON_VERSION }}

- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v5
with:
python-version: "${{ env.PYTHON_VERSION }}"

asv-main:
runs-on: ubuntu-latest
needs: setup-python

permissions:
contents: write

defaults:
run:
working-directory: ${{ env.WORKING_DIR }}

steps:
- name: Checkout main branch of the repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Cache Python ${{ env.PYTHON_VERSION }}
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: python-${{ env.PYTHON_VERSION }}

- name: Install dependencies
run: |
sudo apt-get update
python -m pip install --upgrade pip
pip install asv==0.6.1 virtualenv tabulate
- name: Configure git
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Create ASV machine config file
run: asv machine --machine gh-runner --yes

- name: Fetch previous results from the "benchmarks" branch
run: |
if git ls-remote --exit-code origin benchmarks > /dev/null 2>&1; then
git merge origin/benchmarks \
--allow-unrelated-histories \
--no-commit
mv ../_results .
fi
- name: Run ASV for the main branch
run: asv run ALL --skip-existing --verbose || true

- name: Submit new results to the "benchmarks" branch
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: benchmarks
folder: ${{ env.WORKING_DIR }}/_results
target-folder: _results

- name: Generate dashboard HTML
run: |
asv show
asv publish
- name: Deploy to Github pages
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: ${{ env.WORKING_DIR }}/_html
93 changes: 93 additions & 0 deletions .github/workflows/asv-nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# This workflow will run daily at 06:45.
# It will run benchmarks with airspeed velocity (asv)
# and compare performance with the previous nightly build.

name: Run benchmarks nightly job

on:
schedule:
- cron: 45 6 * * *
workflow_dispatch:

env:
PYTHON_VERSION: "3.10"
WORKING_DIR: ${{ github.workspace }}/benchmarks
NIGHTLY_HASH_FILE: nightly-hash

jobs:

asv-nightly:
runs-on: ubuntu-latest

defaults:
run:
working-directory: ${{ env.WORKING_DIR }}

steps:
- name: Checkout main branch of the repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Cache Python ${{ env.PYTHON_VERSION }}
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: python-${{ env.PYTHON_VERSION }}

- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v5
with:
python-version: "${{ env.PYTHON_VERSION }}"

- name: Install dependencies
run: |
sudo apt-get update
python -m pip install --upgrade pip
pip install asv==0.6.1 virtualenv
- name: Configure git
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Create ASV machine config file
run: asv machine --machine gh-runner --yes

- name: Fetch previous results from the "benchmarks" branch
run: |
if git ls-remote --exit-code origin benchmarks > /dev/null 2>&1; then
git merge origin/benchmarks \
--allow-unrelated-histories \
--no-commit
mv ../_results .
fi
- name: Get nightly dates under comparison
id: nightly-dates
run: |
echo "yesterday=$(date -d yesterday +'%Y-%m-%d')" >> $GITHUB_OUTPUT
echo "today=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
- name: Use last nightly commit hash from cache
uses: actions/cache@v4
with:
path: ${{ env.WORKING_DIR }}
key: nightly-results-${{ steps.nightly-dates.outputs.yesterday }}

- name: Run comparison of main against last nightly build
run: |
HASH_FILE=${{ env.NIGHTLY_HASH_FILE }}
CURRENT_HASH=${{ github.sha }}
if [ -f $HASH_FILE ]; then
PREV_HASH=$(cat $HASH_FILE)
asv continuous $PREV_HASH $CURRENT_HASH --verbose || true
asv compare $PREV_HASH $CURRENT_HASH --sort ratio --verbose
fi
echo $CURRENT_HASH > $HASH_FILE
- name: Update last nightly hash in cache
uses: actions/cache@v4
with:
path: ${{ env.WORKING_DIR }}
key: nightly-results-${{ steps.nightly-dates.outputs.today }}
Loading

0 comments on commit 17a4c33

Please sign in to comment.