Repository navigation
refactor: import datetime as dt for ruff 0.17's ICN001 - #149
Merged
Merged
Conversation
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
11 tasks done
This was referenced Nov 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What are the relevant tickets?
N/A. Unblocks #118 and #105.
Description (What does it do?)
ruff 0.17.0 added
datetime as dtto the defaultICN001import aliases (astral-sh/ruff#28790). Withselect = ["ALL"], everyimport datetimenow 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 toimport datetime as dt.Implementation details
The rename is ruff's own
--select ICN001 --fix --unsafe-fixesoutput, unedited. None of the 18 files already bounddt, so the alias shadows nothing. Works under both ruff 0.16.10 (current lock) and 0.17.3.How can this be tested?
uv run ruff check . && uv run mypy src && uv run pytestpasses on this branch with the current lock.uv.lockswapped in (ruff 0.17.3, plus sqlalchemy 2.1, fastapi 0.162, starlette 1.10, pydantic 2.14),ruff check,ruff format --check,mypy src,bin/generate-openapi-spec --check, andpytestall pass (670 tests).https://claude.ai/code/session_01FGZebGv1QWb8gnk7RGJqMZ