Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: ['3.11', '3.12', '3.13']
python-version: ['3.12', '3.13', '3.14']
copier_config:
- name: Base example
package_name: example_package # The default package_name
Expand Down
42 changes: 42 additions & 0 deletions python-project-template/.github/actions/install-rail/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
name: 'Install rail'
description: >
Install rail_bae and it dependencies using install_rail.py from
LSSTDESC/rail_setup (rail-packages=none installs only the pz-rail base
without any algorithm packages), then installs the local checkout on top.

runs:
using: 'composite'
steps:
- name: System dependencies
shell: bash
run: |
sudo apt-get update

- name: Download install_rail.py
shell: bash
run: |
curl -fsSL -o install_rail.py \
https://raw.githubusercontent.com/LSSTDESC/rail_setup/main/install_rail.py

- name: Install base rail dependencies via install_rail.py
shell: bash
run: |
python install_rail.py \
--install-conda mamba \
--env-name rail_ci \
--rail-packages None \
--python-version {{ $inputs.python-version }} \
--install-devtools no

- name: Add conda environment to PATH
shell: bash
run: |
echo "${HOME}/mambaforge/envs/rail_ci/bin" >> $GITHUB_PATH

- name: Install local rail_base and dev extras
shell: bash
run: |
pip install .
pip install .[dev]
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
---
name: Add bugs to bugs project

on:
issues:
types:
- opened
pull_request:
types: [opened, reopened]
types:
- opened
- reopened

jobs:
add-to-project:
Expand All @@ -14,7 +17,5 @@ jobs:
steps:
- uses: actions/add-to-project@v0.4.0
with:
# You can target a repository in a different organization
# to the issue
project-url: https://github.com/orgs/LSSTDESC/projects/6
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
47 changes: 24 additions & 23 deletions python-project-template/.github/workflows/linting.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,34 @@
# This workflow will install Python dependencies, then perform static linting analysis.
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

---
name: Lint

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

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.12']
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
- 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
- name: Analyze code with linter
run: |
pylint -rn -sn --recursive=y ./src
pylint -rn -sn --recursive=y ./tests
# the following line allows the CI test to pass, even if pylint fails
continue-on-error: true
- uses: actions/checkout@v3
with:
fetch-tags: true
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install rail
uses: ./.github/actions/install-rail
with:
python-version: ${{ matrix.python-version }}
- name: Analyze code with linter
run: |
pylint -rn -sn --recursive=y ./src
pylint -rn -sn --recursive=y ./tests
# the following line allows the CI test to pass, even if pylint fails
continue-on-error: true
49 changes: 27 additions & 22 deletions python-project-template/.github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://github.com/pypa/gh-action-pypi-publish#trusted-publishing

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

---
name: Upload Python Package

on:
Expand All @@ -17,21 +10,33 @@ permissions:

jobs:
deploy:

runs-on: ubuntu-latest
permissions:
id-token: write
strategy:
matrix:
python-version: ['3.12']
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
- uses: actions/checkout@v3
with:
fetch-tags: true
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install rail
uses: ./.github/actions/install-rail
with:
python-version: ${{ matrix.python-version }}
- name: Run unit tests with pytest
run: |
python -m pytest tests
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
38 changes: 17 additions & 21 deletions python-project-template/.github/workflows/smoke-test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# This workflow will run daily at 06:45.
# It will install Python dependencies and run tests with a variety of Python versions.

---
name: Unit test smoke test

on:
Expand All @@ -12,25 +10,23 @@ on:

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.11', '3.12', '3.13']

python-version: ['3.12', '3.13', '3.14']
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
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]
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Run unit tests with pytest
run: |
python -m pytest tests
- uses: actions/checkout@v3
with:
fetch-tags: true
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install rail
uses: ./.github/actions/install-rail
with:
python-version: ${{ matrix.python-version }}
- name: Run unit tests with pytest
run: |
python -m pytest tests
35 changes: 35 additions & 0 deletions python-project-template/.github/workflows/testing-and-coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
name: Unit test and code coverage

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

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.12', '3.13', '3.14']
steps:
- uses: actions/checkout@v3
with:
fetch-tags: true
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install rail
uses: ./.github/actions/install-rail
with:
python-version: ${{ matrix.python-version }}
- name: Run unit tests with pytest
run: |
python -m pytest tests --cov=rail --cov-report=xml
- name: Upload coverage report to codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}

This file was deleted.

2 changes: 1 addition & 1 deletion python-project-template/pyproject.toml.jinja
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "{{project_name}}"
requires-python = ">=3.11"
requires-python = ">=3.12"
license = {file = "LICENSE"}
readme = "README.md"
authors = [
Expand Down
Loading