Skip to content

Commit edccd16

Browse files
committed
What happens if we apply the template to the template.
1 parent f83b6e9 commit edccd16

17 files changed

+840
-22
lines changed

.copier-answers.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Changes here will be overwritten by Copier
2+
_commit: v2.2.0
3+
_src_path: gh:lincc-frameworks/python-project-template
4+
author_email: lincc-frameworks-team@lists.lsst.org
5+
author_name: LINCC Frameworks
6+
create_example_module: false
7+
custom_install: custom
8+
enforce_style:
9+
- pylint
10+
- black
11+
- isort
12+
failure_notification: []
13+
include_benchmarks: false
14+
include_docs: true
15+
include_notebooks: false
16+
mypy_type_checking: none
17+
package_name: python_project_template
18+
project_description: LINCC-Framework's best practices for python code organization,
19+
testing, documentation, and automation.
20+
project_license: BSD
21+
project_name: python-project-template
22+
project_organization: lincc-frameworks
23+
python_versions:
24+
- '3.9'
25+
- '3.10'
26+
- '3.11'
27+
- '3.12'
28+
- '3.13'
29+
- '3.14'
30+
test_lowest_version: none

.git_archival.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node: $Format:%H$
2+
node-date: $Format:%cI$
3+
describe-name: $Format:%(describe:tags=true,match=*[0-9]*)$
4+
ref-names: $Format:%D$

.gitattributes

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# For explanation of this file and uses see
2+
# https://git-scm.com/docs/gitattributes
3+
# https://developer.lsst.io/git/git-lfs.html#using-git-lfs-enabled-repositories
4+
# https://lincc-ppt.readthedocs.io/en/latest/practices/git-lfs.html
5+
#
6+
# Used by https://github.com/lsst/afwdata.git
7+
# *.boost filter=lfs diff=lfs merge=lfs -text
8+
# *.dat filter=lfs diff=lfs merge=lfs -text
9+
# *.fits filter=lfs diff=lfs merge=lfs -text
10+
# *.gz filter=lfs diff=lfs merge=lfs -text
11+
#
12+
# apache parquet files
13+
# *.parq filter=lfs diff=lfs merge=lfs -text
14+
#
15+
# sqlite files
16+
# *.sqlite3 filter=lfs diff=lfs merge=lfs -text
17+
#
18+
# gzip files
19+
# *.gz filter=lfs diff=lfs merge=lfs -text
20+
#
21+
# png image files
22+
# *.png filter=lfs diff=lfs merge=lfs -text
23+
24+
.git_archival.txt export-subst
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
2+
# This workflow runs pre-commit hooks on pushes and pull requests to main
3+
# to enforce coding style. To ensure correct configuration, please refer to:
4+
# https://lincc-ppt.readthedocs.io/en/latest/practices/ci_precommit.html
5+
name: Run pre-commit hooks
6+
7+
on:
8+
push:
9+
branches: [ main ]
10+
pull_request:
11+
branches: [ main ]
12+
13+
jobs:
14+
pre-commit-ci:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v6
18+
with:
19+
fetch-depth: 0
20+
- name: Set up Python
21+
uses: actions/setup-python@v6
22+
with:
23+
python-version: '3.11'
24+
- name: Install uv
25+
uses: astral-sh/setup-uv@v7
26+
- name: Install dependencies
27+
run: |
28+
sudo apt-get update
29+
uv pip install --system .[dev]
30+
if [ -f requirements.txt ]; then uv pip install --system -r requirements.txt; fi
31+
- uses: pre-commit/action@v3.0.1
32+
with:
33+
extra_args: --all-files --verbose
34+
env:
35+
SKIP: "check-lincc-frameworks-template-version,no-commit-to-branch,check-added-large-files,validate-pyproject,sphinx-build,pytest-check"
36+
- uses: pre-commit-ci/lite-action@v1.1.0
37+
if: failure() && github.event_name == 'pull_request' && github.event.pull_request.draft == false

.github/workflows/smoke-test.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ jobs:
2323
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14']
2424

2525
steps:
26-
- uses: actions/checkout@main
26+
- uses: actions/checkout@v6
2727
- name: Set up Python ${{ matrix.python-version }}
28-
uses: actions/setup-python@main
28+
uses: actions/setup-python@v6
2929
with:
3030
python-version: ${{ matrix.python-version }}
3131
- name: Install uv
@@ -34,6 +34,7 @@ jobs:
3434
run: |
3535
sudo apt-get update
3636
uv pip install --system -e .[dev]
37+
if [ -f requirements.txt ]; then uv pip install --system -r requirements.txt; fi
3738
- name: List dependencies
3839
run: |
3940
pip list

.github/workflows/ci.yml renamed to .github/workflows/testing-and-coverage.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
name: CI for Template
1+
2+
# This workflow will install Python dependencies, run tests and report code coverage with a variety of Python versions
3+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
4+
5+
name: Unit test and code coverage
26

37
on:
48
push:
@@ -15,11 +19,11 @@ jobs:
1519
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14']
1620

1721
steps:
18-
- uses: actions/checkout@main
22+
- uses: actions/checkout@v6
1923
with:
2024
fetch-depth: 0
2125
- name: Set up Python ${{ matrix.python-version }}
22-
uses: actions/setup-python@main
26+
uses: actions/setup-python@v6
2327
with:
2428
python-version: ${{ matrix.python-version }}
2529
- name: Install uv
@@ -28,6 +32,7 @@ jobs:
2832
run: |
2933
sudo apt-get update
3034
uv pip install --system -e .[dev]
35+
if [ -f requirements.txt ]; then uv pip install --system -r requirements.txt; fi
3136
- name: Run unit tests with pytest / pytest-copie
3237
run: |
3338
git config --global init.defaultBranch main

.gitignore

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,18 @@ dmypy.json
133133
# vscode
134134
.vscode/
135135

136+
# dask
137+
dask-worker-space/
138+
139+
# tmp directory
140+
tmp/
141+
136142
# Mac OS
137143
.DS_Store
138144

139145
# Airspeed Velocity performance results
140146
_results/
141-
_html/
147+
_html/
148+
149+
# Project initialization script
150+
.initialize_new_project.sh

.pre-commit-config.yaml

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,26 @@
1+
12
repos:
3+
# Compare the local template version to the latest remote template version
4+
# This hook should always pass. It will print a message if the local version
5+
# is out of date.
6+
- repo: https://github.com/lincc-frameworks/pre-commit-hooks
7+
rev: v0.2.2
8+
hooks:
9+
- id: check-lincc-frameworks-template-version
10+
name: Check template version
11+
description: Compare current template version against latest
12+
verbose: true
13+
# Clear output from jupyter notebooks so that only the input cells are committed.
14+
- repo: local
15+
hooks:
16+
- id: jupyter-nb-clear-output
17+
name: Clear output from Jupyter notebooks
18+
description: Clear output from Jupyter notebooks.
19+
files: \.ipynb$
20+
exclude: ^docs/pre_executed
21+
stages: [pre-commit]
22+
language: system
23+
entry: jupyter nbconvert --clear-output
224
# Prevents committing directly branches named 'main' and 'master'.
325
- repo: https://github.com/pre-commit/pre-commit-hooks
426
rev: v6.0.0
@@ -44,7 +66,7 @@ repos:
4466
[
4567
"-rn", # Only display messages
4668
"-sn", # Don't display the score
47-
"--max-line-length=120",
69+
"--rcfile=tests/.pylintrc",
4870
]
4971
# Analyze the code style and report code that doesn't adhere.
5072
- repo: https://github.com/psf/black
@@ -57,7 +79,7 @@ repos:
5779
# supported by your project here, or alternatively use
5880
# pre-commit's default_language_version, see
5981
# https://pre-commit.com/#top_level-default_language_version
60-
language_version: python3.12
82+
language_version: python3.11
6183
# Run unit tests, verify that they pass. Note that coverage is run against
6284
# the ./src directory here because that is what will be committed. In the
6385
# github workflow script, the coverage is run against the installed package

.readthedocs.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1+
12
# .readthedocs.yml
23
# Read the Docs configuration file
3-
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
45

56
# Required
67
version: 2
78

89
build:
910
os: ubuntu-22.04
1011
tools:
11-
python: "3.10"
12+
python: "3.11"
1213

1314
# Build documentation in the docs/ directory with Sphinx
1415
sphinx:
@@ -18,5 +19,6 @@ sphinx:
1819
python:
1920
install:
2021
- requirements: docs/requirements.txt
22+
- requirements: requirements.txt
2123
- method: pip
22-
path: .
24+
path: .

.setup_dev.sh

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/usr/bin/env bash
2+
3+
# Bash Unofficial strict mode (http://redsymbol.net/articles/unofficial-bash-strict-mode/)
4+
# and (https://disconnected.systems/blog/another-bash-strict-mode/)
5+
set -o nounset # Any uninitialized variable is an error
6+
set -o errexit # Exit the script on the failure of any command to execute without error
7+
set -o pipefail # Fail command pipelines on the failure of any individual step
8+
IFS=$'\n\t' #set internal field separator to avoid iteration errors
9+
# Trap all exits and output something helpful
10+
trap 's=$?; echo "$0: Error on line "$LINENO": $BASH_COMMAND"; exit $s' ERR
11+
12+
# This script should be run by new developers to install this package in
13+
# editable mode and configure their local environment
14+
15+
echo "Checking virtual environment"
16+
if [ "${VIRTUAL_ENV:-missing}" = "missing" ] && [ "${CONDA_PREFIX:-missing}" = "missing" ]; then
17+
echo 'No virtual environment detected: none of $VIRTUAL_ENV or $CONDA_PREFIX is set.'
18+
echo
19+
echo "=== This script is going to install the project in the system python environment ==="
20+
echo "Proceed? [y/N]"
21+
read -r RESPONCE
22+
if [ "${RESPONCE}" != "y" ]; then
23+
echo "See https://lincc-ppt.readthedocs.io/ for details."
24+
echo "Exiting."
25+
exit 1
26+
fi
27+
28+
fi
29+
30+
echo "Checking pip version"
31+
MINIMUM_PIP_VERSION=22
32+
pipversion=( $(python -m pip --version | awk '{print $2}' | sed 's/\./\n\t/g') )
33+
if let "${pipversion[0]}<${MINIMUM_PIP_VERSION}"; then
34+
echo "Insufficient version of pip found. Requires at least version ${MINIMUM_PIP_VERSION}."
35+
echo "See https://lincc-ppt.readthedocs.io/ for details."
36+
exit 1
37+
fi
38+
39+
echo "Installing package and runtime dependencies in local environment"
40+
python -m pip install -e . > /dev/null
41+
42+
echo "Installing developer dependencies in local environment"
43+
python -m pip install -e .'[dev]' > /dev/null
44+
if [ -f docs/requirements.txt ]; then python -m pip install -r docs/requirements.txt > /dev/null; fi
45+
46+
echo "Installing pre-commit"
47+
pre-commit install > /dev/null
48+
49+
#######################################################
50+
# Include any additional configurations below this line
51+
#######################################################

0 commit comments

Comments
 (0)