Visitar URL original
⬆️ Upgrade configuration for Ruff v0.2.0 by charliermarsh · Pull Request #11075 · fastapi/fastapi · GitHub
Skip to content

⬆️ Upgrade configuration for Ruff v0.2.0 - #11075

Merged
tiangolo merged 3 commits into
fastapi:masterfrom
charliermarsh:charlie/ruff
Mar 26, 2024
Merged

tiangolo merged 3 commits into
fastapi:masterfrom
charliermarsh:charlie/ruff

Conversation

@charliermarsh

Copy link
Copy Markdown
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
@alejsdev alejsdev added the internal Internal changes label Feb 2, 2024
@chrimaho

chrimaho commented Feb 4, 2024 •

Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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

tiangolo commented Feb 7, 2024

Copy link
Copy Markdown
Member

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

@siavashyj siavashyj left a comment

Copy link
Copy Markdown

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.

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

Copy link
Copy Markdown

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

Comment thread requirements-tests.txt
coverage[toml] >= 6.5.0,< 8.0
mypy ==1.4.1
ruff ==0.1.2
ruff ==0.2.0

Copy link
Copy Markdown

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
Copy Markdown
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

internal Internal changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants