Skip to content

Commit 5769220

Browse files
committed
update ci
1 parent ba02a16 commit 5769220

File tree

8 files changed

+57
-14
lines changed

8 files changed

+57
-14
lines changed

.github/actions/setup/action.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
1+
name: 'Setup Python Environment'
2+
description: 'Install uv, create venv, and install project dependencies'
13
runs:
2-
using: composite
4+
using: "composite"
35
steps:
4-
- name: "Install UV"
6+
- name: "Install UV and add to PATH"
57
shell: bash
68
run: |
7-
curl -LsSf https://astral.sh/uv/install.sh | sh
9+
curl -LsSf https://astral.sh/uv/install.sh | sh
10+
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
11+
12+
- name: "Create Virtual Environment"
13+
shell: bash
14+
run: uv venv
15+
16+
- name: "Install Python Dependencies"
17+
shell: bash
18+
run: uv sync

.github/workflows/code-quality.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name: Python Code Quality
22

33
on:
4-
pull_request:
5-
push:
6-
branches:
7-
- main
4+
pull_request:
5+
push:
6+
branches:
7+
- main
88

99
jobs:
1010
lock_file:
@@ -20,26 +20,26 @@ jobs:
2020
steps:
2121
- uses: actions/checkout@v4
2222
- uses: ./.github/actions/setup
23-
- run: uvx ruff check src/
23+
- run: make check_format
2424

2525
formatting:
2626
runs-on: ubuntu-latest
2727
needs: [lock_file]
2828
steps:
2929
- uses: actions/checkout@v4
3030
- uses: ./.github/actions/setup
31-
- run: uvx ruff format --check src/
31+
- run: make check_formatting
3232

3333
type_consistency:
3434
runs-on: ubuntu-latest
3535
needs: [lock_file]
3636
steps:
3737
- uses: actions/checkout@v4
3838
- uses: ./.github/actions/setup
39-
- run: uv run mypy src/
39+
- run: make mypy
4040

4141
build:
42-
runs-on: [ubuntu-latest]
42+
runs-on: ubuntu-latest
4343
needs: [linting, formatting, type_consistency]
4444
steps:
4545
- uses: actions/checkout@v4

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ format:
55
check_format:
66
uv run ruff check src
77

8+
check_formatting:
9+
uv run ruff format --check src/
10+
811
mypy:
912
uv run mypy src/ --exclude "src/research"
1013

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ dependencies = [
1717
"scipy>=1.15.2",
1818
"sentence-transformers>=4.1.0",
1919
"stubs>=1.0.0",
20+
"ruff>=0.9.3",
2021
"torch>=2.6.0",
2122
"transformers>=4.48.3",
2223
]

src/models/autoencoder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,4 +138,4 @@ def _initialize_weights(
138138

139139
def forward(self, x: torch.Tensor) -> torch.Tensor:
140140
x = self.encoder(x)
141-
return self.decoder(x) # type: ignore[no-any-return]
141+
return self.decoder(x) # type: ignore[no-any-return]

src/recovery/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import numpy as np
66
import torch
77
from numpy.typing import NDArray
8-
from scipy.optimize import linear_sum_assignment # type: ignore[import-untyped]
8+
from scipy.optimize import linear_sum_assignment # type: ignore[import-untyped]
99
from torch import Tensor, nn, optim
1010

1111
from .reconstruction_stats import compare_H

src/spectra/run.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def full_extraction(
172172
coef = 2**iteration
173173

174174
layer_idx = 4 - (iteration - 1)
175-
pre, post = get_layer_outputs(autoencoder, inputs, layer_idx)
175+
pre, _ = get_layer_outputs(autoencoder, inputs, layer_idx)
176176
pre_restored = inverse_activation_dict[str(activation.activation_fun)](pre)
177177

178178
if torch.device("cuda") == DEVICE and svd_driver == "gesvd":

uv.lock

Lines changed: 28 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)