Skip to content

Update default rules for v0.17 - #28786

Merged
ntBre merged 1 commit into
brent/0.17.0from
brent/update-default-rules-0.17
Sep 23, 2026
Merged

ntBre merged 1 commit into
brent/0.17.0from
brent/update-default-rules-0.17

Conversation

@ntBre

@ntBre ntBre commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Summary

This makes a few modifications to our default rule set for v0.17. As the snapshots show, these had
already been incorporated into our preview defaults via rule recategorization. This just ports them
back to the stable default rules.

This closes #27197, which brought the problems with the DTZ rules to our attention. F406 being a
syntax error was raised in this comment.

Test Plan

Updated snapshots

Summary
--

This makes a few modifications to our default rule set for v0.17. As the snapshots show, these had
already been incorporated into our preview defaults via rule recategorization. This just ports them
back to the stable default rules.

This closes #27197, which brought the problems with the DTZ rules to our attention. F406 being a
syntax error was raised in [this comment].

[this comment]: #27199 (comment)

Test Plan
--

Updated snapshots
@ntBre ntBre added the rule-selection Related to enabling or disabling rules label Sep 22, 2026
@ntBre ntBre mentioned this pull request Sep 22, 2026
2 tasks done
@astral-sh-bot

astral-sh-bot Bot commented Sep 22, 2026

Copy link
Copy Markdown

ruff-ecosystem results

Linter (stable)

ℹ️ ecosystem check detected linter changes. (+2 -144 violations, +0 -0 fixes in 5 projects; 54 projects unchanged)

binary-husky/gpt_academic (+0 -34 violations, +0 -0 fixes)

- crazy_functions/Academic_Conversation.py:162:28: DTZ005 `datetime.datetime.now()` called without a `tz` argument
- crazy_functions/Paper_Reading.py:239:17: DTZ005 `datetime.datetime.now()` called without a `tz` argument
- crazy_functions/doc_fns/AI_review_doc.py:170:47: DTZ005 `datetime.datetime.now()` called without a `tz` argument
- crazy_functions/doc_fns/batch_file_query_doc.py:170:47: DTZ005 `datetime.datetime.now()` called without a `tz` argument
- crazy_functions/doc_fns/conversation_doc/excel_doc.py:102:42: DTZ005 `datetime.datetime.now()` called without a `tz` argument
- crazy_functions/doc_fns/conversation_doc/txt_doc.py:54:20: DTZ005 `datetime.datetime.now()` called without a `tz` argument
... 26 additional changes omitted for rule DTZ005
- crazy_functions/doc_fns/text_content_loader.py:235:31: DTZ006 `datetime.datetime.fromtimestamp()` called without a `tz` argument
- crazy_functions/高级功能函数模板.py:51:25: DTZ011 `datetime.date.today()` used
- crazy_functions/高级功能函数模板.py:52:23: DTZ011 `datetime.date.today()` used
... 25 additional changes omitted for project

docker/docker-py (+0 -5 violations, +0 -0 fixes)

- docs/conf.py:60:8: DTZ005 `datetime.datetime.now()` called without a `tz` argument
- tests/integration/api_container_test.py:975:54: DTZ005 `datetime.datetime.now()` called without a `tz` argument
- tests/integration/client_test.py:38:17: DTZ005 `datetime.datetime.now()` called without a `tz` argument
- tests/integration/client_test.py:48:25: DTZ005 `datetime.datetime.now()` called without a `tz` argument
- tests/unit/client_test.py:29:17: DTZ001 `datetime.datetime()` called without a `tzinfo` argument

prefecthq/prefect (+0 -93 violations, +0 -0 fixes)

- scripts/backfill_release_notes.py:319:20: DTZ007 Naive datetime constructed using `datetime.datetime.strptime()` without %z
- scripts/prepare_integration_release_notes.py:246:53: DTZ005 `datetime.datetime.now()` called without a `tz` argument
- scripts/prepare_integration_release_notes.py:250:36: DTZ005 `datetime.datetime.now()` called without a `tz` argument
- scripts/prepare_release_notes.py:113:12: DTZ005 `datetime.datetime.now()` called without a `tz` argument
- scripts/prepare_release_notes.py:337:20: DTZ007 Naive datetime constructed using `datetime.datetime.strptime()` without %z
- src/integrations/prefect-dbt/tests/cli/test_commands.py:129:35: DTZ005 `datetime.datetime.now()` called without a `tz` argument
- src/integrations/prefect-dbt/tests/cli/test_commands.py:130:36: DTZ005 `datetime.datetime.now()` called without a `tz` argument
- src/integrations/prefect-dbt/tests/cli/test_commands.py:160:30: DTZ005 `datetime.datetime.now()` called without a `tz` argument
- src/integrations/prefect-dbt/tests/cli/test_commands.py:182:35: DTZ005 `datetime.datetime.now()` called without a `tz` argument
... 14 additional changes omitted for rule DTZ005
- src/prefect/_internal/schemas/validators.py:317:24: DTZ001 `datetime.datetime()` called without a `tzinfo` argument
- src/prefect/_vendor/croniter/croniter.py:147:37: DTZ001 `datetime.datetime()` called without a `tzinfo` argument
- src/prefect/_vendor/croniter/croniter.py:65:9: DTZ006 `datetime.datetime.fromtimestamp()` called without a `tz` argument
- src/prefect/flow_engine.py:382:16: DTZ001 `datetime.datetime()` called without a `tzinfo` argument
- src/prefect/flow_engine.py:394:16: DTZ001 `datetime.datetime()` called without a `tzinfo` argument
- src/prefect/server/schemas/schedules.py:466:17: DTZ001 `datetime.datetime()` called without a `tzinfo` argument
- src/prefect/task_engine.py:360:20: DTZ001 `datetime.datetime()` called without a `tzinfo` argument
- src/prefect/task_engine.py:361:18: DTZ001 `datetime.datetime()` called without a `tzinfo` argument
... 61 additional changes omitted for rule DTZ001
- tests/_internal/schemas/test_validation.py:327:14: DTZ007 Naive datetime constructed using `datetime.datetime.strptime()` without %z
- tests/events/server/test_events_counts.py:33:9: DTZ011 `datetime.date.today()` used
- tests/fixtures/deprecation.py:29:28: DTZ007 Naive datetime constructed using `datetime.datetime.strptime()` without %z
... 73 additional changes omitted for project

pypa/setuptools (+2 -0 violations, +0 -0 fixes)

+ setuptools/warnings.py:50:63: RUF100 [*] Unused `noqa` directive (non-enabled: `DTZ011`)
+ setuptools/warnings.py:64:31: RUF100 [*] Unused `noqa` directive (non-enabled: `DTZ011`)

qdrant/qdrant-client (+0 -12 violations, +0 -0 fixes)

- qdrant_client/local/datetime_utils.py:67:22: DTZ007 Naive datetime constructed using `datetime.datetime.strptime()` without %z
- tests/congruence_tests/test_payload.py:268:22: DTZ001 `datetime.datetime()` called without a `tzinfo` argument
- tests/congruence_tests/test_scroll_order_by.py:188:60: DTZ001 `datetime.datetime()` called without a `tzinfo` argument
- tests/conversions/fixtures.py:1268:24: DTZ005 `datetime.datetime.now()` called without a `tz` argument
- tests/conversions/fixtures.py:1540:14: DTZ005 `datetime.datetime.now()` called without a `tz` argument
- tests/conversions/test_validate_conversions.py:264:9: DTZ001 `datetime.datetime()` called without a `tzinfo` argument
- tests/conversions/test_validate_conversions.py:266:9: DTZ005 `datetime.datetime.now()` called without a `tz` argument
- tests/conversions/test_validate_conversions.py:267:9: DTZ011 `datetime.date.today()` used
- tests/fixtures/filters.py:248:22: DTZ001 `datetime.datetime()` called without a `tzinfo` argument
- tests/fixtures/filters.py:249:20: DTZ001 `datetime.datetime()` called without a `tzinfo` argument
... 2 additional changes omitted for project

Changes by rule (6 rules affected)

code total + violation - violation + fix - fix
DTZ001 75 0 75 0 0
DTZ005 58 0 58 0 0
DTZ007 5 0 5 0 0
DTZ011 4 0 4 0 0
RUF100 2 2 0 0 0
DTZ006 2 0 2 0 0

Linter (preview)

✅ ecosystem check detected no linter changes.

@ntBre ntBre added this to the v0.17 milestone Sep 22, 2026
@ntBre ntBre linked an issue Sep 22, 2026 that may be closed by this pull request
@ntBre
ntBre marked this pull request as ready for review September 22, 2026 19:12
@ntBre
ntBre requested a review from MichaReiser September 22, 2026 19:13
@codspeed

codspeed Bot commented Sep 22, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 7.28%

⚡ 1 improved benchmark
✅ 59 untouched benchmarks
⏩ 153 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
⚡ Simulation linter/default-rules[large/dataset.py] 20.3 ms 18.9 ms +7.28%

Tip

Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.


Comparing brent/update-default-rules-0.17 (43fe330) with brent/0.17.0 (7b9514a)

Open in CodSpeed

Footnotes

  1. 153 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@ntBre
ntBre merged commit 6883f4a into brent/0.17.0 Sep 23, 2026
51 checks passed
@ntBre
ntBre deleted the brent/update-default-rules-0.17 branch September 23, 2026 17:08
@ntBre ntBre mentioned this pull request Sep 23, 2026
2 of 3 tasks
ntBre added a commit that referenced this pull request Sep 25, 2026
Summary
--

This makes a few modifications to our default rule set for v0.17. As the
snapshots show, these had
already been incorporated into our preview defaults via rule
recategorization. This just ports them
back to the stable default rules.

This closes #27197, which brought the problems with the DTZ rules to our
attention. F406 being a
syntax error was raised in [this comment].

[this comment]:
#27199 (comment)

Test Plan
--

Updated snapshots
ntBre added a commit that referenced this pull request Sep 25, 2026
Summary
--

This makes a few modifications to our default rule set for v0.17. As the
snapshots show, these had
already been incorporated into our preview defaults via rule
recategorization. This just ports them
back to the stable default rules.

This closes #27197, which brought the problems with the DTZ rules to our
attention. F406 being a
syntax error was raised in [this comment].

[this comment]:
#27199 (comment)

Test Plan
--

Updated snapshots
ntBre added a commit that referenced this pull request Oct 1, 2026
Summary
--

This makes a few modifications to our default rule set for v0.17. As the
snapshots show, these had
already been incorporated into our preview defaults via rule
recategorization. This just ports them
back to the stable default rules.

This closes #27197, which brought the problems with the DTZ rules to our
attention. F406 being a
syntax error was raised in [this comment].

[this comment]:
#27199 (comment)

Test Plan
--

Updated snapshots
ntBre added a commit that referenced this pull request Oct 9, 2026
Summary
--

This makes a few modifications to our default rule set for v0.17. As the
snapshots show, these had
already been incorporated into our preview defaults via rule
recategorization. This just ports them
back to the stable default rules.

This closes #27197, which brought the problems with the DTZ rules to our
attention. F406 being a
syntax error was raised in [this comment].

[this comment]:
#27199 (comment)

Test Plan
--

Updated snapshots
ntBre added a commit that referenced this pull request Oct 9, 2026
Summary
--

This makes a few modifications to our default rule set for v0.17. As the
snapshots show, these had
already been incorporated into our preview defaults via rule
recategorization. This just ports them
back to the stable default rules.

This closes #27197, which brought the problems with the DTZ rules to our
attention. F406 being a
syntax error was raised in [this comment].

[this comment]:
#27199 (comment)

Test Plan
--

Updated snapshots
tcely added a commit to meeb/tubesync that referenced this pull request Oct 9, 2026
> Several of the flake8-datetimez rules
> (DTZ001, DTZ005, DTZ006, DTZ007, DTZ011, DTZ012, and DTZ901)
> are no longer enabled by default, while
> undefined-local-with-nested-import-star-usage (F406),
> which corresponds to a syntax error, is now enabled by default.

https://github.com/astral-sh/ruff/releases/tag/0.17.0
astral-sh/ruff#28786
davidpoblador added a commit to alltuner/vibetuner that referenced this pull request Oct 13, 2026
Bumps ruff to 0.17.0 and ty to 0.0.86. There is one commit per tool, and
each one regenerates both lockfiles
(`vibetuner-py/uv.lock` and root `uv.lock`) with only that package
changed.

## ruff 0.17.0 (#2216)

**Cause.** Config discovery did not change. Under both 0.16.10 and
0.17.0, `ruff check --show-settings` resolves to
the root `.ruff.toml`, which is the symlink to
`vibetuner-template/.ruff.toml`. What did change is ruff's
**default rule set**. The [0.17.0
changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md#0170)
(astral-sh/ruff#28786) removes `DTZ001`, `DTZ005`, `DTZ006`, `DTZ007`,
`DTZ011`, `DTZ012` and `DTZ901` from the
defaults and adds `F406`. Our `extend-select` never listed `DTZ`, so
those rules quietly turned off. RUF100 then
reported our 6 `# noqa: DTZ00x` comments as unused (`non-enabled:
DTZ00x`).

S101, BLE001 and S104 did **not** go stale: they are still in the 0.17
enabled set, and no RUF100 fires for them.
Only the DTZ noqa comments were affected.

**Fix.** Add `'DTZ'` to `extend-select` in
`vibetuner-template/.ruff.toml`. The noqa comments stay as they are.

- Enabled rules, 0.16.10 with the old config vs 0.17.0 with the new
config: the only difference is `+F406`.
- Enabled rules under 0.16.10, old config vs new config: identical.
Under 0.16 all DTZ rules were already defaults.
- `ruff check` is clean under both 0.16.10 and 0.17.0.
- `ruff>=0.17.0` floor in the `dev` extra.

**What changes for scaffolded apps.** `vibetuner-template/.ruff.toml`
ships to every app.

- A freshly scaffolded app already locks ruff 0.17.0, because the
published `vibetuner[dev]` floor is
`>=0.16.10`. Without this change, those apps silently lose the DTZ
checks. Probe:
`datetime.datetime.now()` passes with the old template config under 0.17
and is flagged `DTZ005` with the new one.
- With this change they keep exactly the 0.16 rule set, plus whatever
ruff 0.17 adds to the defaults itself (`F406`,
  which flags a syntax error anyway).
- Apps still locked to ruff 0.16 see no change.
- Not affected:
- The new `datetime as dt` ICN001 convention, because ICN001 isn't
enabled.
- The new default `target-version` (3.11), because the template sets
`requires-python`.

I scaffolded an app from this branch into `./.tmp/` (`vibetuner scaffold
new --template <worktree> --branch ...
--defaults`). Its locked ruff 0.17.0 and ruff 0.16.10 both pass `ruff
check`, and `ruff format --check` passes.

## ty 0.0.86 (#2217)

ty 0.0.86 reported 3 errors and 2 warnings on this tree:

- `test_capability_detection.py`: the tests instantiated abstract
classes to get a `TypeError`. They now assert
`inspect.isabstract(...)` (plus `__abstractmethods__ == {"detect"}`).
That checks the same contract without calling
  the class.
- `test_oauth_app.py:98`: the missing-required-fields test now uses
`OAuthProviderAppModel.model_validate({"provider": "google"})`, the
idiomatic way to validate incomplete input.
- `test_robust_task.py:25`: the `@contextmanager` helper is now
annotated `Generator[None, None, None]`. The
  `Iterator` overload is deprecated.
- `services/s3_storage.py:385` (`redundant-condition` warning): this is
a **ty false positive caused by the stub**.
`types-aiobotocore-s3` types
`GetBucketLocationOutputTypeDef.LocationConstraint` as non-null, but S3
returns `None`
for us-east-1. I added a targeted `# ty: ignore[redundant-condition]`
with that reason in the comment.

The existing `crud.py` `_build_update_schema` ignore
(`unsupported-operator` on `annotation | None`) is still needed.
Removing it under 0.0.86 reproduces the error. `ty check --error
unused-ignore-comment` reports no unused ignores
anywhere in vibetuner-py.

`ty check` is clean with `--python-version` 3.11, 3.12 and 3.13. A
freshly scaffolded app from this branch (which
locks ty 0.0.86 and ruff 0.17.0) passes both `ty check` and `ruff
check`.

## Verification

All commands were run with `UV_NO_CONFIG=1`.

- `just lint-md lint-py lint-toml lint-jinja lint-yaml lint-po
type-check type-check-py`: all pass (rebased on #2222,
which fixed the djlint failures), as does `pre-commit run --all-files`.
- `uv run --frozen --extra dev python -m pytest tests/unit
tests/integration -q`: 1124 passed. The 37 warnings are
  third-party deprecations (slowapi's `asyncio.iscoroutinefunction`).
- Lockfile diffs contain only ruff, ty and the matching `requires-dist`
floors. There is no `[options]` stanza.

Fixes #2216
Fixes #2217
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rule-selection Related to enabling or disabling rules

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DTZ rules should not be in the default set

2 participants