Skip to content

Commit f4ebd32

Browse files
JoshLoeckerdependabot[bot]mumo-dev
authored
Fix ruff linting errors (#218)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: mumo-dev <samuelmumo@Samuels-MacBook-Pro.local>
1 parent f1753c7 commit f4ebd32

File tree

11 files changed

+2034
-1693
lines changed

11 files changed

+2034
-1693
lines changed

.github/workflows/continuous_integration.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
uses: actions/checkout@v4
1515

1616
- name: Install uv
17-
uses: astral-sh/setup-uv@v4
17+
uses: astral-sh/setup-uv@v5
1818

1919
- name: Create Virtual Environment
2020
run: uv venv
@@ -26,17 +26,17 @@ jobs:
2626
run: uv run jupyter nbconvert --clear-output --inplace "main/COMO.ipynb"
2727

2828
- name: Format Python Imports
29-
uses: astral-sh/ruff-action@v2
29+
uses: astral-sh/ruff-action@v3
3030
with:
3131
args: "check --fix --select I"
3232

3333
- name: Format code
34-
uses: astral-sh/ruff-action@v2
34+
uses: astral-sh/ruff-action@v3
3535
with:
3636
args: "format"
3737

3838
- name: Format Notebook
39-
uses: astral-sh/ruff-action@v2
39+
uses: astral-sh/ruff-action@v3
4040
with:
4141
args: "format main/COMO.ipynb"
4242

@@ -54,7 +54,7 @@ jobs:
5454
uses: actions/checkout@v4
5555

5656
- name: Check Lint
57-
uses: astral-sh/ruff-action@v2
57+
uses: astral-sh/ruff-action@v3
5858
with:
5959
args: "check --no-fix --verbose"
6060

@@ -68,7 +68,7 @@ jobs:
6868
uses: actions/checkout@v4
6969

7070
- name: Install uv
71-
uses: astral-sh/setup-uv@v4
71+
uses: astral-sh/setup-uv@v5
7272
with:
7373
enable-cache: "true"
7474
cache-suffix: "${{ matrix.python-version }}"
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+

0 commit comments

Comments
 (0)