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
3 changes: 1 addition & 2 deletions .ai/python-guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ ruff format <touched_paths>
ruff check --fix <touched_paths>
```

Or use pre-commit (runs isort, black, flake8, ruff, and more):
Or use pre-commit (runs isort, black, ruff, and more):

```bash
pre-commit run --files <touched_files>
Expand All @@ -369,7 +369,6 @@ The repo's `.pre-commit-config.yaml` runs these Python hooks:

- **isort** -- import sorting (`profile = "black"`, configured in `pyproject.toml`)
- **black** -- code formatting
- **flake8** -- style checks (`max-line-length=88`)
- **ruff** -- fast linting with auto-fix
- **codespell** -- spelling checks
- **trailing-whitespace**, **end-of-file-fixer**, **check-yaml**, **check-json**, **check-toml**
Expand Down
10 changes: 2 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,6 @@ repos:
hooks:
- id: black
types_or: [python, cython]
- repo: https://github.com/PyCQA/flake8
rev: 7.3.0 # 5.0.4 crashes on Python 3.12+ (ast.Str removed)
hooks:
- id: flake8
args: [--max-line-length=88, --select=C,E,F,W,B,B950, --extend-ignore = E203,E501]
types_or: [python, cython]
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v16.0.5
hooks:
Expand Down Expand Up @@ -71,9 +65,9 @@ repos:

# Fast linting
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.2
rev: v0.17.3
hooks:
- id: ruff
- id: ruff-check
args: [--fix, --exit-non-zero-on-fix]

# NOTE: pyright may be able to find other classes of errors not covered above,
Expand Down
2 changes: 1 addition & 1 deletion docs/fern/scripts/tests/test_gen_python_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
``conftest.py`` next to this file owns the ``sys.path`` shim that makes the
top-level imports of ``api_discovery`` / ``api_rendering`` /
``gen_python_api`` resolve, so this module keeps every import at the top
and stays clean under the repo's flake8 config.
and stays clean under the repo's ruff config.

Invocation from an isolated environment (bypasses the repo's Python
resolution, which is unrelated to this generator)::
Expand Down
2 changes: 1 addition & 1 deletion lib/bindings/kvbm/python/kvbm/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

# flake8: noqa
# ruff: noqa
import logging

logger = logging.getLogger(__name__)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const MAX_LINE_LEN: usize = 88;

/// Emit one `NAME = "value"` assignment, wrapping in parentheses exactly the way black
/// does when the single-line form would exceed `MAX_LINE_LEN`. Comments are left alone —
/// black does not reflow them, and flake8 has `E501` in `extend-ignore`.
/// black does not reflow them, and the ruff hook does not select `E501`.
fn push_assignment(body_pad: &str, name: &str, value: &str, lines: &mut Vec<String>) {
let single = format!("{}{} = \"{}\"", body_pad, name, value);
if single.chars().count() <= MAX_LINE_LEN {
Expand Down
11 changes: 4 additions & 7 deletions lib/bindings/python/src/dynamo/llm/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

# flake8: noqa

import logging
from collections.abc import AsyncIterator
from typing import Any, Protocol

from dynamo._core import AisPerfConfig as AisPerfConfig
from dynamo._core import EngineType
from dynamo._core import EngineType as EngineType
from dynamo._core import EntrypointArgs as EntrypointArgs
from dynamo._core import FpmDirectPublisher as FpmDirectPublisher
from dynamo._core import FpmEventRelay as FpmEventRelay
Expand Down Expand Up @@ -48,9 +45,9 @@
from dynamo._core import compute_block_hash_for_seq as compute_block_hash_for_seq
from dynamo._core import fetch_model as fetch_model
from dynamo._core import lora_name_to_id as lora_name_to_id
from dynamo._core import make_engine
from dynamo._core import make_engine as make_engine
from dynamo._core import register_model as register_model
from dynamo._core import run_input
from dynamo._core import run_input as run_input
from dynamo._core import run_kv_indexer as run_kv_indexer
from dynamo._core import run_select_service as run_select_service
from dynamo._core import run_slot_tracker as run_slot_tracker
Expand All @@ -65,7 +62,7 @@
from ._unary import LLMUnaryClient as LLMUnaryClient
from ._unary import UnaryChatModel as UnaryChatModel
from ._unary import with_engine_data as with_engine_data
from .exceptions import HttpError
from .exceptions import HttpError as HttpError
from .exceptions import RouterQueueLimitExceeded as RouterQueueLimitExceeded
from .exceptions import WorkerOverloaded as WorkerOverloaded

Expand Down
2 changes: 0 additions & 2 deletions lib/bindings/python/src/dynamo/llm/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

# flake8: noqa

import logging

from dynamo._core import Cancelled as Cancelled
Expand Down
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,13 @@ markers = [
line-length = 88
indent-width = 4

[tool.ruff.lint]
# E4, E7, E9, and F are the rules that ruff 0.5.2 enabled by default. Newer ruff enables many more.
# W605 flags invalid escape sequences, and PLW0602 flags a `global` name that is never assigned.
# TODO: enable flake8-bugbear (B) after its findings on main are fixed. Ruff has no B950;
# E501 (line too long) is the closest ruff rule.
select = ["E4", "E7", "E9", "F", "W605", "PLW0602"]

[tool.ruff.lint.extend-per-file-ignores]
"icp/tests/**/test_*.py" = ["F811", "F401"]
"*_inc.py" = ["F821"]
Expand Down
Loading