Skip to content
Closed
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
15 changes: 15 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# .github/workflows/ci.yml
name: ci

on:
Expand All @@ -6,6 +7,20 @@ on:
pull_request:

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install development dependencies
run: python -m pip install -e ".[dev]"
- name: Check lint with Ruff
run: ruff check .
- name: Check formatting with Ruff
run: ruff format --check .

test:
name: ${{ matrix.os }} py${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
Expand Down
19 changes: 19 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,25 @@ python -m pytest -q

Supported Python: 3.9+.

### Linting and formatting

Install the development dependencies, then run Ruff before opening a pull
request:

```bash
ruff check .
ruff format --check .
```

Both commands are required CI checks. Ruff targets Python 3.9 and the documented
80-character line limit, with import sorting and Python error checks enabled.

The gate covers production code, scripts, and test code. It excludes learner
exercises, reference solutions, shared-namespace curriculum checks, and
intentionally invalid test fixtures. Those files have different execution and
teaching requirements. Curriculum checks are validated by the reference-solution
suite; their separate style cleanup is tracked in #133.

## Curriculum Changes

Every exercise is five artifacts that must stay in sync:
Expand Down
22 changes: 22 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ Documentation = "https://pythonlings.abhik.ai/"
dev = [
"pytest>=7.0",
"pytest-asyncio>=0.21",
"ruff==0.16.4",
]

[project.scripts]
Expand All @@ -77,3 +78,24 @@ packages = ["pythonlings"]
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "function"
testpaths = ["tests"]

[tool.ruff]
line-length = 80
target-version = "py39"
include = ["*.py", "*.pyi", "pyproject.toml"]
extend-exclude = [
"exercises",
"solutions",
"checks",
"tests/fixtures",
]

[tool.ruff.lint]
select = [
"E4",
"E7",
"E9",
"E501",
"F",
Comment thread
abhiksark marked this conversation as resolved.
Resolved
"I",
]
Loading