Skip to content

Commit ff9a09f

Browse files
JoshLoeckerdependabot[bot]mumo-devSarahNakamura
authored
Version 2.0 (#252)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: mumo-dev <samuelmumo@Samuels-MacBook-Pro.local> Co-authored-by: SarahNakamura <snakamura@unomaha.edu> Co-authored-by: JoshLoecker <JoshLoecker@users.noreply.github.com>
1 parent 6d74649 commit ff9a09f

198 files changed

Lines changed: 2695808 additions & 3420579 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.githooks/post-commit

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
# Detect if COMO.ipynb exists in non-pushed git history
6+
# If it does, clear its cell outputs before committing
7+
NOTEBOOK="main/COMO.ipynb"
8+
if git diff-tree --no-commit-id --name-only -r HEAD | grep -q "^$NOTEBOOK$"; then
9+
jupyter-nbconvert --clear-output --inplace "$NOTEBOOK"
10+
11+
# re-commit if the notebook was changed
12+
if ! git diff --quiet "$NOTEBOOK"; then
13+
git add "$NOTEBOOK"
14+
git commit -m "Clear outputs from jupyter notebook"
15+
fi
16+
fi

.githooks/pre-commit

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
# Run `ruff check` only on staged files
5+
files=$(git diff --cached --name-only --diff-filter=ACM | grep '\.py$')
6+
if [ -z "$files" ]; then
7+
exit 0
8+
fi
9+
ruff check --no-fix "$files"
10+
status=$?
11+
if [ $status -ne 0 ]; then
12+
echo "Ruff found issues. Commit aborted."
13+
exit 1
14+
fi
15+
16+
# If `ruff check` is good, then format all staged files
17+
ruff check --fix --select I "$files"
18+
ruff format "$files"
19+
20+
21+
exit 0

.github/dependabot.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ version: 2
22
updates:
33
- package-ecosystem: "github-actions"
44
directory: "/"
5+
target-branch: "hotfix"
56
schedule:
67
# Check for updates to GitHub Actions every weekday
78
interval: "daily"

.github/workflows/container_build.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@ env:
1111

1212
jobs:
1313
build-and-push-image:
14+
# IMPORTANT: Only run the publish job when a tag starting with 'v' is pushed
15+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
16+
1417
name: Build and Push Docker Image
15-
runs-on: ubuntu-20.04
18+
runs-on: ubuntu-latest
1619
permissions:
1720
contents: read
1821
packages: write

.github/workflows/continuous_integration.yml

Lines changed: 2 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -7,62 +7,11 @@ on:
77
workflow_dispatch:
88

99
jobs:
10-
format:
11-
runs-on: ubuntu-latest
12-
steps:
13-
- name: Checkout
14-
uses: actions/checkout@v4
15-
16-
- name: Install uv
17-
uses: astral-sh/setup-uv@v5
18-
19-
- name: Create Virtual Environment
20-
run: uv venv
21-
22-
- name: Install Jupyter
23-
run: uv pip install jupyter nbconvert
24-
25-
- name: Strip Notebook Output
26-
run: uv run jupyter nbconvert --clear-output --inplace "main/COMO.ipynb"
27-
28-
- name: Format Python Imports
29-
uses: astral-sh/ruff-action@v3
30-
with:
31-
args: "check --fix --select I"
32-
33-
- name: Format code
34-
uses: astral-sh/ruff-action@v3
35-
with:
36-
args: "format"
37-
38-
- name: Format Notebook
39-
uses: astral-sh/ruff-action@v3
40-
with:
41-
args: "format main/COMO.ipynb"
42-
43-
- name: Commit Changes
44-
uses: stefanzweifel/git-auto-commit-action@v5
45-
with:
46-
commit_message: "style: format code, Jupyter Notebook(s), and Python imports with `ruff`"
47-
file_pattern: "main/como/*.py"
48-
49-
50-
lint:
51-
runs-on: ubuntu-latest
52-
steps:
53-
- name: Checkout
54-
uses: actions/checkout@v4
55-
56-
- name: Check Lint
57-
uses: astral-sh/ruff-action@v3
58-
with:
59-
args: "check --no-fix --verbose"
60-
6110
test:
6211
runs-on: ubuntu-latest
6312
strategy:
6413
matrix:
65-
python-version: [ "3.10" ]
14+
python-version: [ "3.11", "3.12", "3.13" ]
6615
steps:
6716
- name: Checkout
6817
uses: actions/checkout@v4
@@ -78,7 +27,7 @@ jobs:
7827
run: uv sync --python "${{ matrix.python-version }}" --all-extras --dev
7928

8029
- name: Run tests
81-
run: uv run --python "${{ matrix.python-version }}" pytest --cov --junitxml=junit.xml -o junit_family=legacy
30+
run: uv run --python "${{ matrix.python-version }}" pytest
8231

8332
- name: Cache Clear
8433
run: uv cache prune --ci
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Build and publish python package
2+
3+
on:
4+
push:
5+
tags:
6+
- "*"
7+
8+
# Define permissions needed for the workflow GITHUB_TOKEN
9+
permissions:
10+
contents: read # Allow checkout
11+
packages: write # Allow publishing to GitHub Packages
12+
13+
14+
jobs:
15+
build:
16+
strategy:
17+
matrix:
18+
operating-system: [macos-latest, ubuntu-latest, windows-latest]
19+
python-version: [ 3.10, 3.11, 3.12, 3.13 ]
20+
21+
name: Build Python Package (${{ matrix.operating-system }}, Python ${{ matrix.python-version }})
22+
runs-on: ${{ matrix.operating-system }}
23+
24+
steps:
25+
- name: Checkout Code
26+
uses: actions/checkout@v4
27+
with:
28+
ref: ${{ github.ref }}
29+
30+
- name: Set up Python ${{ matrix.python-version }}
31+
uses: actions/setup-python@v5
32+
with:
33+
python-version: ${{ matrix.python-version }}
34+
35+
- name: Install Hatch
36+
run: pip install hatch
37+
38+
- name: Build distributions
39+
run: hatch build # Uses pyproject.toml to build sdist and wheel into dist/
40+
41+
- name: Upload distributions artifact
42+
uses: actions/upload-artifact@v4 # Action to save artifacts between jobs
43+
with:
44+
name: como-distribution-package-${{ matrix.operating-system }}-${{ matrix.python-version }} # Name for the artifact
45+
path: dist/ # Path to the directory to upload
46+
47+
publish:
48+
strategy:
49+
matrix:
50+
python-version: [ 3.10, 3.11, 3.12, 3.13 ]
51+
operating-system: [macos-latest, windows-latest, ubuntu-latest]
52+
53+
name: Publish to GitHub Packages
54+
runs-on: ubuntu-latest
55+
needs: build # Depends on the build job succeeding
56+
57+
# IMPORTANT: Only run the publish job when a tag starting with 'v' is pushed
58+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
59+
60+
61+
permissions: # Explicit permissions needed for this job
62+
packages: write # Required to write to GitHub Packages registry
63+
contents: read # Needed if accessing repo content (e.g., for download artifact)
64+
65+
steps:
66+
- name: Download distributions artifact
67+
uses: actions/download-artifact@v4 # Action to retrieve artifacts from previous job.
68+
with:
69+
name: como-distribution-package-${{ matrix.operating-system }}-${{ matrix.python-version }}
70+
path: dist/
71+
72+
- name: Set up Python 3.11
73+
uses: actions/setup-python@v5
74+
with:
75+
python-version: ${{ matrix.python-version }}
76+
77+
- name: Install Twine
78+
run: pip install twine
79+
80+
- name: Publish package to GitHub Packages
81+
env:
82+
# Use __token__ as username and the automatically generated GITHUB_TOKEN as password
83+
TWINE_USERNAME: __token__
84+
TWINE_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
85+
run: |
86+
echo "Uploading to GitHub Packages for repository: ${{ github.repository }}"
87+
# Construct the repository URL dynamically using the repository owner
88+
TWINE_REPOSITORY_URL="https://pypi.pkg.github.com/${{ github.repository_owner }}"
89+
python -m twine upload --verbose --repository-url ${TWINE_REPOSITORY_URL} dist/*
90+
91+
92+

.pre-commit-config.yaml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
# See https://pre-commit.com for more information
2-
# See https://pre-commit.com/hooks.html for more hooks
31
repos:
4-
- repo: https://github.com/opensource-nepal/commitlint
5-
rev: v1.2.0
2+
- repo: https://github.com/commitizen-tools/commitizen
3+
rev: master
64
hooks:
7-
- id: commitlint
8-
name: Commit Lint
5+
- id: commitizen
6+
stages: [ commit-msg ]

0 commit comments

Comments
 (0)