Skip to content

Commit

Permalink
new template
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael R. Blanton committed May 11, 2024
1 parent 3d210a0 commit 9a4e563
Show file tree
Hide file tree
Showing 13 changed files with 193 additions and 125 deletions.
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 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"
53 changes: 53 additions & 0 deletions .github/workflows/publish-benchmarks-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# This workflow publishes a benchmarks comment on a pull request. It is triggered after the
# benchmarks are computed in the asv-pr workflow. This separation of concerns allows us limit
# access to the target repository private tokens and secrets, increasing the level of security.
# Based on https://securitylab.github.com/research/github-actions-preventing-pwn-requests/.
name: Publish benchmarks comment to PR

on:
workflow_run:
workflows: ["Run benchmarks for PR"]
types: [completed]

jobs:
upload-pr-comment:
runs-on: ubuntu-latest
if: >
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success'
permissions:
issues: write
pull-requests: write
steps:
- name: Display Workflow Run Information
run: |
echo "Workflow Run ID: ${{ github.event.workflow_run.id }}"
echo "Head SHA: ${{ github.event.workflow_run.head_sha }}"
echo "Head Branch: ${{ github.event.workflow_run.head_branch }}"
echo "Conclusion: ${{ github.event.workflow_run.conclusion }}"
echo "Event: ${{ github.event.workflow_run.event }}"
- name: Download artifact
uses: dawidd6/action-download-artifact@v3
with:
name: benchmark-artifacts
run_id: ${{ github.event.workflow_run.id }}
- name: Extract artifacts information
id: pr-info
run: |
printf "PR number: $(cat pr)\n"
printf "Output:\n$(cat output)"
printf "pr=$(cat pr)" >> $GITHUB_OUTPUT
- name: Find benchmarks comment
uses: peter-evans/find-comment@v3
id: find-comment
with:
issue-number: ${{ steps.pr-info.outputs.pr }}
comment-author: 'github-actions[bot]'
body-includes: view all benchmarks
- name: Create or update benchmarks comment
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ steps.find-comment.outputs.comment-id }}
issue-number: ${{ steps.pr-info.outputs.pr }}
body-path: output
edit-mode: replace
5 changes: 1 addition & 4 deletions .github/workflows/smoke-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,9 @@ on:
# Runs this workflow automatically
schedule:
- cron: 45 6 * * *
<<<<<<< before updating
=======

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
>>>>>>> after updating

jobs:
build:
Expand All @@ -42,4 +39,4 @@ jobs:
pip list
- name: Run unit tests with pytest
run: |
python -m pytest
python -m pytest
51 changes: 0 additions & 51 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,56 +41,6 @@ repos:
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.28.0
hooks:
<<<<<<< before updating
- id: isort
name: Run isort
description: Sort and organize imports in .py and .pyi files.
types_or: [python, pyi]



# Analyze the src code style and report code that doesn't adhere.
#- repo: local
#hooks:
#- id: pylint
#name: pylint (python files in src/)
#entry: pylint
#language: system
#types: [python]
#files: ^src/
#args:
#[
#"-rn", # Only display messages
#"-sn", # Don't display the score
#"--rcfile=src/.pylintrc",
#]
#
# Analyze the tests code style and report code that doesn't adhere.
#- repo: local
#hooks:
#- id: pylint
#name: pylint (python files in tests/ and benchmarks/)
#entry: pylint
#language: system
#types: [python]
#files: ^(tests|benchmarks)/
#args:
#[
#"-rn", # Only display messages
#"-sn", # Don't display the score
#"--rcfile=tests/.pylintrc",
#]




# 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
# and uploaded to Codecov by calling pytest like so:
# `python -m pytest --cov=<package_name> --cov-report=xml`
- repo: local
=======
- id: check-github-workflows
args: ["--verbose"]
- repo: https://github.com/astral-sh/ruff-pre-commit
Expand All @@ -104,7 +54,6 @@ repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.2.1
>>>>>>> after updating
hooks:
- id: ruff-format
name: Format code using ruff
Expand Down
42 changes: 42 additions & 0 deletions .setup_dev.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/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
if [ -f docs/requirements.txt ]; then python -m pip install -r docs/requirements.txt; fi

echo "Installing pre-commit"
pre-commit install > /dev/null

#######################################################
# Include any additional configurations below this line
#######################################################
31 changes: 0 additions & 31 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,38 +7,7 @@

.. rubric:: :header_no_toc:`kcorrect documentation`

<<<<<<< before updating
Overview
=========================
=======
.. code-block:: console
>> conda create env -n <env_name> python=3.10
>> conda activate <env_name>
Once you have created a new environment, you can install this project for local
development using the following commands:

.. code-block:: console
>> pip install -e .'[dev]'
>> pre-commit install
>> conda install pandoc
Notes:

1) The single quotes around ``'[dev]'`` may not be required for your operating system.
2) ``pre-commit install`` 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
`pre-commit <https://lincc-ppt.readthedocs.io/en/latest/practices/precommit.html>`_.
3) Installing ``pandoc`` allows you to verify that automatic rendering of Jupyter notebooks
into documentation for ReadTheDocs works as expected. For more information, see
the Python Project Template documentation on
`Sphinx and Python Notebooks <https://lincc-ppt.readthedocs.io/en/latest/practices/sphinx.html#python-notebooks>`_.
>>>>>>> after updating

This page has documentation for the kcorrect product to calculate
astronomical K-corrections for galaxies.
Expand Down
15 changes: 1 addition & 14 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,8 @@
<<<<<<< before updating
#sphinx==6.1.3
#sphinx-rtd-theme==1.2.0
#sphinx-autoapi==2.0.1
#astroid==2.15.7
sphinx
sphinx-rtd-theme
sphinx-autoapi
nbsphinx
=======

ipykernel
>>>>>>> after updating
ipython
jupytext
nbconvert
nbsphinx
sphinx
sphinx-autoapi
sphinx-copybutton
sphinx-rtd-theme
sphinx-rtd-theme
40 changes: 15 additions & 25 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@ classifiers = [
dynamic = ["version"]
requires-python = ">=3.9"
dependencies = [
<<<<<<< before updating
"ipykernel", # Support for Jupyter notebooks
"matplotlib>=3.5.2",
"numpy>=1.18.1",
"scipy>=1.8.1",
"astropy>=3.0.0"
=======
>>>>>>> after updating
]

[project.urls]
Expand All @@ -37,24 +29,22 @@ dev = [
"pre-commit", # Used to run checks before finalizing a git commit
"pytest",
"pytest-cov", # Used to report total code coverage
<<<<<<< before updating
"pre-commit", # Used to run checks before finalizing a git commit
"sphinx", # Used to automatically generate documentation
"sphinx-rtd-theme", # Used to render documentation
"sphinx-autoapi", # Used to automatically generate api documentation
"pylint", # Used for static linting of files
# if you add dependencies here while experimenting in a notebook and you
# want that notebook to render in your documentation, please add the
# dependencies to ./docs/requirements.txt as well.
# "nbconvert", # Needed for pre-commit check to clear output from Python notebooks
"nbsphinx", # Used to integrate Python notebooks into Sphinx documentation
# "ipython", # Also used in building notebooks into Sphinx
"matplotlib", # Used in sample notebook intro_notebook.ipynb
"numpy", # Used in sample notebook intro_notebook.ipynb
"asv==0.5.1", # Used to compute performance benchmarks
=======
# before updating
# "pre-commit", # Used to run checks before finalizing a git commit
# "sphinx", # Used to automatically generate documentation
# "sphinx-rtd-theme", # Used to render documentation
# "sphinx-autoapi", # Used to automatically generate api documentation
# "pylint", # Used for static linting of files
# # if you add dependencies here while experimenting in a notebook and you
# # want that notebook to render in your documentation, please add the
# # dependencies to ./docs/requirements.txt as well.
# # "nbconvert", # Needed for pre-commit check to clear output from Python notebooks
# "nbsphinx", # Used to integrate Python notebooks into Sphinx documentation
# # "ipython", # Also used in building notebooks into Sphinx
# "matplotlib", # Used in sample notebook intro_notebook.ipynb
# "numpy", # Used in sample notebook intro_notebook.ipynb
# "asv==0.5.1", # Used to compute performance benchmarks
"ruff", # Used for static linting of files
>>>>>>> after updating
]

[build-system]
Expand Down

0 comments on commit 9a4e563

Please sign in to comment.