Skip to content

refactor: import datetime as dt for ruff 0.17's ICN001 - #149

Merged
blarghmatey merged 1 commit into
mainfrom
ruff-datetime-dt-alias
Nov 5, 2026
Merged

blarghmatey merged 1 commit into
mainfrom
ruff-datetime-dt-alias

Conversation

@blarghmatey

Copy link
Copy Markdown
Member

What are the relevant tickets?

N/A. Unblocks #118 and #105.

Description (What does it do?)

ruff 0.17.0 added datetime as dt to the default ICN001 import aliases (astral-sh/ruff#28790). With select = ["ALL"], every import datetime now fails lint, which is what's failing Renovate #118 (ruff-pre-commit 0.17.1) and #105 (lock file maintenance, ruff 0.17.3). This switches the 18 affected files to import datetime as dt.

Implementation details

The rename is ruff's own --select ICN001 --fix --unsafe-fixes output, unedited. None of the 18 files already bound dt, so the alias shadows nothing. Works under both ruff 0.16.10 (current lock) and 0.17.3.

How can this be tested?

https://claude.ai/code/session_01FGZebGv1QWb8gnk7RGJqMZ

ruff 0.17.0 added `datetime as dt` to the default flake8-import-conventions
aliases (astral-sh/ruff#28790). With `select = ["ALL"]`
every `import datetime` now fails ICN001, which blocks the ruff-pre-commit
bump (#118) and lock file maintenance (#105). The rename is ruff's own
--unsafe-fixes output; none of the 18 files already bound `dt`.

Claude-Session: https://claude.ai/code/session_01FGZebGv1QWb8gnk7RGJqMZ
@blarghmatey
blarghmatey merged commit 571af57 into main Nov 5, 2026
7 checks passed
@blarghmatey
blarghmatey deleted the ruff-datetime-dt-alias branch November 5, 2026 21:05
@ol-release-bot ol-release-bot Bot mentioned this pull request Nov 5, 2026
11 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant