8000 ⬆️ Upgrade configuration for Ruff v0.2.0 by charliermarsh · Pull Request #11075 · fastapi/fastapi · GitHub
[go: up one dir, main page]

Skip to content

Conversation

@charliermarsh
Copy link
Contributor

In Ruff v0.2.0 (upcoming), we start to warn about adding these settings under [tool.ruff] instead of [tool.ruff.lint]. This PR just adjusts FastAPI's configuration to fix those warnings. (This works today, with the version of FastAPI uses now, and will also work with v0.2.0.)

@alejsdev alejsdev changed the title Upgrade configuration for Ruff v0.2.0 ⬆️ Upgrade configuration for Ruff v0.2.0 Feb 2, 2024
@chrimaho
Copy link
chrimaho commented Feb 4, 2024

In this PR, I'd also recommend:

  1. Adjust the requirements-tests.txt file to: ruff >=0.1.2

https://github.com/tiangolo/fastapi/blob/50e558e944860fb237cb5934e899ce3c5ecc37f9/requirements-tests.txt#L7

  1. Adjust the .pre-commit-config.yaml file to: rev: v0.2.0

https://github.com/tiangolo/fastapi/blob/50e558e944860fb237cb5934e899ce3c5ecc37f9/.pre-commit-config.yaml#L16-L17

@charliermarsh
Copy link
Contributor Author

Will do! v0.2.0 wasn't out yet when I put this up -- I'll update the PR to do the version bump too.

@app.get("/items/")
async def read_query(
query_or_default: Annotated[str, Depends(query_or_cookie_extractor)]
query_or_default: Annotated[str, Depends(query_or_cookie_extractor)],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a change that was also made in latest Black: psf/black#4164.

@tiangolo
Copy link
Member
tiangolo commented Feb 7, 2024

📝 Docs preview for commit 312978b at: https://d38c0b0b.fastapitiangolo.pages.dev

Copy link
@siavashyj siavashyj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ruff v0.2.2 is out.

- id: trailing-whitespace
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.1.2
rev: v0.2.0

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

v0.2.2 is out!

Suggested change
rev: v0.2.0
rev: v0.2.2

coverage[toml] >= 6.5.0,< 8.0
mypy ==1.4.1
ruff ==0.1.2
ruff ==0.2.0

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ruff ==0.2.0
ruff ==0.2.2

@tiangolo tiangolo merged commit 5ccc869 into fastapi:master Mar 26, 2024
@tiangolo
Copy link
Member

Awesome, thank you @charliermarsh! 🚀

hsuanchi pushed a commit to hsuanchi/fastapi that referenced this pull request May 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

0