Skip to content

Commit 1dd024f

Browse files
authored
Merge pull request #99 from Snuffy2/Change-to-ruff
Change to ruff
2 parents e7bbbf4 + 916b8bc commit 1dd024f

File tree

3 files changed

+287
-2540
lines changed

3 files changed

+287
-2540
lines changed

AGENTS.md

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -38,26 +38,22 @@ This document provides comprehensive guidelines for AI coding agents contributin
3838

3939
This project uses the following tools to maintain consistent code quality:
4040

41-
- **Black**: Automatic code formatter with a 100-character line length (configured in `pyproject.toml`)
42-
- **isort**: Import statement organizer with Black-compatible profile
43-
- **flake8**: Style guide enforcement (configured in `pyproject.toml` to ignore `E501` and `W503`)
41+
- **ruff**: Automatic code formatter with options configured in `pyproject.toml`
4442

4543
### Formatting Workflow
4644

4745
Before committing code changes:
4846

4947
```bash
50-
./.venv/bin/black <file_or_directory>
51-
./.venv/bin/isort <file_or_directory>
52-
./.venv/bin/flake8 <file_or_directory>
48+
./.venv/bin/ruff check --fix <file_or_directory>
49+
./.venv/bin/ruff format <file_or_directory>
5350
```
5451

5552
Alternatively, format the entire project:
5653

5754
```bash
58-
./.venv/bin/black app/ tests/
59-
./.venv/bin/isort app/ tests/
60-
./.venv/bin/flake8 app/ tests/
55+
./.venv/bin/ruff check --fix app/ tests/
56+
./.venv/bin/ruff format app/ tests/
6157
```
6258

6359
---
@@ -68,6 +64,7 @@ Alternatively, format the entire project:
6864

6965
- **Mandatory typing**: Add type annotations to all function signatures, method signatures, and class attributes.
7066
- **Return types**: Always specify return types, including `None` when applicable.
67+
- **Minimize `Any`**: Do not just use `Any` for typing to make the error go away. Use appropriate type annotations and only use `Any` when applicable (ex. if there are > 3 different return types possible).
7168
- **Forward references**: Use `from __future__ import annotations` to defer evaluation of type annotations, allowing forward references without string literals.
7269
- **Python 3.11+ type hints**: Use built-in generic types instead of typing module equivalents (e.g., `dict[str, Any]` instead of `Dict[str, Any]`, `list[str]` instead of `List[str]`).
7370

@@ -179,7 +176,9 @@ except json.JSONDecodeError as e:
179176

180177
### Logging Practices
181178

182-
- **Use loguru**: The project uses `loguru` for logging. Import it as `from loguru import logger`.
179+
- **Use loguru**:
180+
- The project uses `loguru` for logging. Import it as `from loguru import logger`.
181+
- Use f-string format for logging strings.
183182
- **Appropriate log levels**:
184183
- `logger.debug()`: Detailed diagnostic information
185184
- `logger.info()`: General informational messages (startup, shutdown, major operations)
@@ -209,7 +208,7 @@ except ModelLoadError as e:
209208

210209
- **Explicit user request required**: Only create new branches or open pull requests when the user explicitly asks for it **or** when the user includes the hashtag `#github-pull-request-agent` in their request.
211210
- **Asynchronous agent handoff**: The `#github-pull-request-agent` hashtag signals that the task should be handed off to the asynchronous GitHub Copilot coding agent after all planning, analysis, and preparation are complete.
212-
- **Default behavior**: By default, work directly on the current branch and commit changes locally without creating PRs.
211+
- **No staging or committing without permission**: Agents must **not** stage (`git add`) or commit changes unless the user explicitly requests it. Only make code changes to files - leave git operations to the user.
213212

214213
### Commit Messages
215214

@@ -271,7 +270,7 @@ When an agent cannot or chooses not to follow one or more guidelines in this doc
271270
**Example disclosure:**
272271

273272
> **⚠️ Deviation Notice:**
274-
> The code was not formatted with Black/isort because the dev dependencies are not installed in the current environment. Run `./.venv/bin/pip install -e '.[dev]'` to enable linting/formatting tools.
273+
> The code was not formatted with ruff because the dev dependencies are not installed in the current environment. Run `./.venv/bin/pip install -e '.[dev]'` to enable linting/formatting tools.
275274
276275
### Communication Principles
277276

@@ -309,10 +308,9 @@ When an agent cannot or chooses not to follow one or more guidelines in this doc
309308
Before finalizing any code contribution, verify:
310309

311310
- ✅ Virtual environment (`./.venv`) is used for all operations
312-
- ✅ Code is formatted with Black and isort
313-
- ✅ Code passes flake8 linting
311+
- ✅ Code passes ruff linting and formatting
314312
- ✅ Type annotations are present on all functions/methods
315-
- ✅ Docstrings follow PEP 257 conventions
313+
- ✅ Docstrings follow NumPy style conventions
316314
- ✅ Specific exceptions are caught (not bare `Exception`)
317315
- ✅ Appropriate logging is in place
318316
- ✅ Existing comments are preserved

0 commit comments

Comments
 (0)