Skip to content
Merged
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
57 changes: 57 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: CI

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

jobs:
test:
runs-on: ubuntu-latest
# needs: format_and_lint
strategy:
matrix:
python-version: ["3.11", "3.12"]

steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.python-version }}
enable-cache: true
cache-dependency-glob: "uv.lock"

# - name: Set up Python ${{ matrix.python-version }}
# uses: actions/setup-python@v5
# with:
# python-version: ${{ matrix.python-version }}

- name: Install the project
run: uv sync --all-extras --dev

- name: Build
run: uv build

- name: Run tests
run: uv run pytest tests/

format_and_lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install the code linting and formatting tool Ruff
run: pipx install ruff
- name: Lint code with Ruff
run: ruff check --output-format=github --target-version=py311
- name: Check code formatting with Ruff
run: ruff format --diff --target-version=py311
# continue-on-error: true

5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,7 @@ allow-direct-references = true
[tool.pytest.ini_options]
markers = [
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
]
]

[tool.ruff]
lint.ignore = ["F722"] # https://docs.kidger.site/jaxtyping/faq/#flake8-or-ruff-are-throwing-an-error
2 changes: 1 addition & 1 deletion src/stamp/preprocessing/extractor/empty.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def empty() -> Extractor[_EmptyModel]:
transform=torchvision.transforms.Compose(
[
torchvision.transforms.PILToTensor(),
torchvision.transforms.Lambda(lambda x: x.float()),
torchvision.transforms.Lambda(torch.Tensor.float),
]
),
identifier="empty",
Expand Down