Skip to content

Commit d60c71b

Browse files
authored
chore: adopt ruff 0.16.0 (#161)
ruff 0.16.0 stabilized CPY001 (missing-copyright-notice) out of preview, so `select = ["ALL"]` now picks it up. Ignore it, matching modern-di. 0.16.0 also formats Python code blocks inside Markdown; reformat the 9 affected file(s). No .py file changed.
1 parent 56ba454 commit d60c71b

10 files changed

Lines changed: 36 additions & 22 deletions

docs/introduction/configuration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,8 @@ import logging
156156
from lite_bootstrap import FastStreamConfig
157157

158158
config = FastStreamConfig(
159-
logging_log_level=logging.INFO, # your application logs
160-
faststream_log_level=logging.WARNING, # broker "Received"/"Processed" messages (default)
159+
logging_log_level=logging.INFO, # your application logs
160+
faststream_log_level=logging.WARNING, # broker "Received"/"Processed" messages (default)
161161
)
162162
```
163163

docs/introduction/quickstart.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ bootstrapper:
106106
bootstrapper = FastAPIBootstrapper(config)
107107
app = bootstrapper.bootstrap()
108108

109-
print(bootstrapper.build_summary()) # human-readable summary
109+
print(bootstrapper.build_summary()) # human-readable summary
110110
for cls, reason in bootstrapper.skipped_instruments:
111111
print(f"skipped {cls.__name__}: {reason}")
112112
```

planning/audits/2026-06-05-bug-audit-v2.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ no-op default:
178178

179179
```python
180180
from opentelemetry.trace import NoOpTracerProvider
181+
181182
set_tracer_provider(NoOpTracerProvider())
182183
```
183184

@@ -216,7 +217,7 @@ def teardown(self) -> None:
216217
root_logger = logging.getLogger()
217218
for h in root_logger.handlers[:]:
218219
root_logger.removeHandler(h)
219-
h.close() # ← unprotected; can raise
220+
h.close() # ← unprotected; can raise
220221
root_logger.setLevel(logging.WARNING)
221222
if self._logger_factory is not None:
222223
try:

planning/changes/2026-05-31.01-audit-implementation.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ non-negotiable.
254254
```python
255255
ConfigT = typing.TypeVar("ConfigT", bound=BaseConfig)
256256

257+
257258
@dataclasses.dataclass(kw_only=True, slots=True, frozen=True)
258259
class BaseInstrument(typing.Generic[ConfigT]):
259260
bootstrap_config: ConfigT

planning/changes/2026-06-01.02-fastmcp-bootstrapper.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,7 @@ def _make_fastmcp() -> "FastMCP[typing.Any]":
9797

9898

9999
@dataclasses.dataclass(kw_only=True, slots=True, frozen=True)
100-
class FastMcpConfig(
101-
HealthChecksConfig, LoggingConfig, PrometheusConfig, PyroscopeConfig, SentryConfig
102-
):
100+
class FastMcpConfig(HealthChecksConfig, LoggingConfig, PrometheusConfig, PyroscopeConfig, SentryConfig):
103101
application: "FastMCP[typing.Any]" = dataclasses.field(default_factory=_make_fastmcp)
104102
logging_turn_off_middleware: bool = False
105103
```
@@ -127,11 +125,15 @@ class FastMcpLoggingMiddleware(Middleware):
127125
result = await call_next(context)
128126
except Exception:
129127
fastmcp_access_logger.exception(
130-
context.method or "unknown", mcp=mcp_fields, duration=time.perf_counter_ns() - start,
128+
context.method or "unknown",
129+
mcp=mcp_fields,
130+
duration=time.perf_counter_ns() - start,
131131
)
132132
raise
133133
fastmcp_access_logger.info(
134-
context.method or "unknown", mcp=mcp_fields, duration=time.perf_counter_ns() - start,
134+
context.method or "unknown",
135+
mcp=mcp_fields,
136+
duration=time.perf_counter_ns() - start,
135137
)
136138
return result
137139
```
@@ -210,6 +212,7 @@ if import_checker.is_fastmcp_installed:
210212

211213
if import_checker.is_structlog_installed:
212214
import structlog
215+
213216
fastmcp_access_logger: typing.Final = structlog.get_logger("mcp.access")
214217

215218
if import_checker.is_prometheus_client_installed:

planning/changes/2026-06-02.01-stdlib-logging-and-build-summary.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ try:
2727
return structlog.get_logger(__name__)
2828

2929
except ImportError:
30+
3031
def _get_logger() -> typing.Any: # noqa: ANN401
3132
return logging.getLogger(__name__)
3233
```
@@ -156,9 +157,7 @@ Replaces `_get_logger().warning(f"Error tearing down {name}: {e}")`. Uses stdlib
156157
### `test_teardown_error_isolation`
157158

158159
```python
159-
def test_teardown_error_isolation(
160-
free_bootstrapper_config: FreeConfig, caplog: pytest.LogCaptureFixture
161-
) -> None:
160+
def test_teardown_error_isolation(free_bootstrapper_config: FreeConfig, caplog: pytest.LogCaptureFixture) -> None:
162161
bootstrapper = FreeBootstrapper(bootstrap_config=free_bootstrapper_config)
163162
bootstrapper.bootstrap()
164163

planning/changes/2026-06-23.01-structured-log-payload.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ A consumer-side interpretation type living beside the existing serializer:
7575
```python
7676
@dataclasses.dataclass(frozen=True, slots=True)
7777
class StructuredLogPayload:
78-
message: str | None # the structlog `event` key; None when absent
79-
extra: dict[str, typing.Any] # user fields, meta-keys already stripped
78+
message: str | None # the structlog `event` key; None when absent
79+
extra: dict[str, typing.Any] # user fields, meta-keys already stripped
8080
skip_sentry: bool
8181

8282
@classmethod
@@ -124,9 +124,12 @@ forgets the set.
124124

125125
```python
126126
payload = StructuredLogPayload.parse(formatted_message)
127-
if payload is None: return event # not a structlog JSON line
128-
if payload.skip_sentry: return None # drop — checked BEFORE message
129-
if not payload.message: return event # JSON without an `event` key
127+
if payload is None:
128+
return event # not a structlog JSON line
129+
if payload.skip_sentry:
130+
return None # drop — checked BEFORE message
131+
if not payload.message:
132+
return event # JSON without an `event` key
130133
event["logentry"]["formatted"] = payload.message
131134
if payload.extra:
132135
event["contexts"]["structlog"] = payload.extra

planning/changes/2026-06-24.02-otel-excluded-urls-home.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ instead of silently dropping URLs from the trace-exclusion set.
2121
stringly-typed cross-config reads:
2222

2323
```python
24-
excluded_urls = set(getattr(self.bootstrap_config, "opentelemetry_excluded_urls", [])) # OTel's OWN field
25-
prometheus_path = getattr(self.bootstrap_config, "prometheus_metrics_path", None) # PrometheusConfig
24+
excluded_urls = set(getattr(self.bootstrap_config, "opentelemetry_excluded_urls", [])) # OTel's OWN field
25+
prometheus_path = getattr(self.bootstrap_config, "prometheus_metrics_path", None) # PrometheusConfig
2626
if not self.bootstrap_config.opentelemetry_generate_health_check_spans:
27-
health_path = getattr(self.bootstrap_config, "health_checks_path", None) # HealthChecksConfig
27+
health_path = getattr(self.bootstrap_config, "health_checks_path", None) # HealthChecksConfig
2828
```
2929

3030
These are two different kinds of read, and conflating them hides the real issue:

planning/changes/2026-07-18.01-free-threaded-python-support.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,14 @@ import. Two explicit implementations so both branches are unit-testable on a
5858
normal (orjson-present) run:
5959

6060
```python
61-
def _dumps_orjson(value, **kw): return orjson.dumps(value, **kw).decode()
62-
def _dumps_stdlib(value, **kw): return json.dumps(value, separators=(",", ":"), ensure_ascii=False, **kw)
61+
def _dumps_orjson(value, **kw):
62+
return orjson.dumps(value, **kw).decode()
63+
64+
65+
def _dumps_stdlib(value, **kw):
66+
return json.dumps(value, separators=(",", ":"), ensure_ascii=False, **kw)
67+
68+
6369
_serialize_log_to_string = _dumps_orjson if import_checker.is_orjson_installed else _dumps_stdlib
6470
```
6571

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ ignore = [
178178
"COM812", # flake8-commas "Trailing comma missing"
179179
"ISC001", # flake8-implicit-str-concat
180180
"G004", # allow f-strings in logging
181+
"CPY001", # no per-file copyright header
181182
]
182183
isort.lines-after-imports = 2
183184
isort.no-lines-before = ["standard-library", "local-folder"]

0 commit comments

Comments
 (0)