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
42 changes: 42 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Linting

on:
push:
branches: [ main, dev, refactor/** ]
pull_request:
branches: [ main, dev ]

jobs:
lint:
runs-on: ubuntu-latest
continue-on-error: true # Don't block on linting errors

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install linting tools
run: |
python -m pip install --upgrade pip
pip install ruff black isort

- name: Run Ruff
continue-on-error: true
run: ruff check src/ --output-format=github || true

- name: Check Black formatting
continue-on-error: true
run: black --check src/ || true

- name: Check import sorting
continue-on-error: true
run: isort --check-only src/ || true

- name: Lint summary
if: always()
run: echo "Linting completed (issues are reported but don't block the workflow)"
59 changes: 59 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Tests

on:
push:
branches: [ main, dev, refactor/** ]
pull_request:
branches: [ main, dev ]

jobs:
test:
runs-on: ubuntu-latest
continue-on-error: true # Don't fail the workflow if tests fail

strategy:
matrix:
python-version: ['3.10', '3.11']

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive # Include AION, AstroCLIP, astroPT submodules

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

- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libhdf5-dev

- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install pytest pytest-cov

# Install package in editable mode
if [ -f pyproject.toml ]; then
pip install -e .
fi

# Install test requirements if they exist
if [ -f requirements-test.txt ]; then
pip install -r requirements-test.txt
elif [ -f requirements.txt ]; then
pip install -r requirements.txt
fi

- name: Run tests
continue-on-error: true # Don't fail even if tests fail
run: |
pytest tests/ -v --tb=short --continue-on-collection-errors || true

- name: Test summary
if: always()
run: echo "Tests completed (failures are reported but don't block the workflow)"
37 changes: 37 additions & 0 deletions LINTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Linting and Formatting

This project uses Black, isort, and Ruff for code quality.

## Run Formatters Locally

```bash
# Install tools
pip install black isort ruff

# Format code with Black
black src/

# Sort imports with isort
isort src/

# Check linting with Ruff
ruff check src/

# Auto-fix Ruff issues
ruff check src/ --fix
```

## Pre-commit Hook

Install pre-commit to automatically format before commits:

```bash
pip install pre-commit
pre-commit install
```

## Configuration Files

- **Black**: Uses default settings (88 chars, py310+)
- **isort**: Compatible with Black
- **Ruff**: Configured in `pyproject.toml`
1 change: 0 additions & 1 deletion src/fmb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@
Module: fmb.__init__
Description: FMB module: fmb.__init__
"""

Loading